这可能是一个有点愚蠢的问题,我也可能误解了解决这个问题的最佳方法,但我本质上想要做的是以下几点:
我想将以下矩阵相乘得到结果-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
对此的任何帮助将不胜感激。提前致谢!