java - 如何使用 JAMA 将两个一维矩阵相乘?

标签 java matrix matrix-multiplication jama

这可能是一个有点愚蠢的问题,我也可能误解了解决这个问题的最佳方法,但我本质上想做的是:

我想将以下矩阵相乘以获得结果 -0.8。但是,理想情况下,我希望使用 JAMA 函数来执行此操作。到目前为止,我有以下内容,我想我快到了,这只是我坚持的最后一步..

// Create the two arrays (in reality I won't be creating these, the two 1D matrices
// will be the result of other calculations - I have just created them for this example)
double[] aArray = [0.2, -0.2];
double[] bArray = [0, 4];

// Create matrices out of the arrays
Matrix a = new Matrix( aArray, 1 );
Matrix b = new Matrix( bArray, 1 );

// Multiply matrix a by matrix b to get matrix c
Matrix c = a.times(b);

// Turn matrix c into a double
double x = // ... this is where I'm stuck

如能提供任何帮助,我们将不胜感激。提前致谢!

最佳答案

你是说使用 get 吗?

double x = c.get(0, 0);

http://math.nist.gov/javanumerics/jama/doc/

关于java - 如何使用 JAMA 将两个一维矩阵相乘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7260144/

相关文章:

java - Java中的列表内列表

java - 如何在Android中获取 "onTouchEnd"事件?

python - 将 n 个最大元素保留在矩阵的行或列中的可靠方法

python - NumPy:填充数组中 1 周围的字段

java - 当用户从菜单屏幕返回应用程序时,Marker InfoWindowAdapter 导致崩溃

Java:即使没有编译错误,if/else 也没有响应

java - 删除拆分数组上带有 0 的列

python - python中巨大矩阵的点积的行总和

python - 坐标时间序列与旋转矩阵时间序列的点积

python - 帮助新手了解 TensorFlow 中的线性代数(三阶张量)