Apache Commons Math3:将行与列向量相乘

Apache Commons Math3: Multiply row with column vector

我想将两个向量 a^T = (1,2,3) 和 b = (4,5,6) 相乘。用钢笔和铅笔,我得到了

c = 1*4 + 2*5 + 3*6 = 4 + 10 + 18 = 32

我用 apache commons math3

ArrayRealVector a = new ArrayRealVector(new double []{1, 2, 3});
ArrayRealVector b = new ArrayRealVector(new double []{4, 5, 6});

获得向量的表示。为了得到结果,我想做类似

的事情
double c = a.transpose().multiply(b);

但我找不到合适的方法(无论是转置还是相乘)。

这是点积,你可以用 double c = a.dotProduct(b);