我正在寻找非对称母系Math.NET Numerics的Numpy.dot等效物。
np.dot:对于2-D阵列,它相当于矩阵乘法,对于1-D阵列到向量的内积(没有复共轭)。对于N维,它是a的最后一个轴上的和积,b是倒数第二个:
import numpy as np
a = np.random.randn(2, 3) * 0.01
b = np.random.randn(3, 1) * 0.01
a
array([[ 0.01543693, 0.0090974 , 0.00835993],
[ 0.00475191, 0.00953389, -0.00854795]])
b
array([[ 0.00853528],
[ 0.00428625],
[-0.0110117 ]])
np.dot(a, b)
array([[ 7.86952720e-05],
[ 1.75551012e-04]])
我尝试过:Matrix<float>.op_DotMultiply
和其他各种方法,但没有一个方法可以提供我想要的东西。
答案 0 :(得分:0)
好吧,对我来说,点积和*是不同的野兽:
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
Matrix<double> a = DenseMatrix.OfArray(new double[,]
{
{ 0.01543693, 0.0090974, 0.00835993 },
{ 0.00475191, 0.00953389, -0.00854795 }
});
Matrix<double> b = DenseMatrix.OfArray(new double[,]
{
{ 0.00853528 },
{ 0.00428625},
{ -0.0110117 }
});
Console.WriteLine("{0:0}", (a * b).ToString());
给出:
DenseMatrix 2x1-Double
7.86952E-05
0.000175551
对于非对称矩阵,Numpy.dot与Math.Net M * M
相同吗?这对我没有意义!