2017-04-16 113 views
0

我在尋找Math.NET Numerics等效於Numpy.dot的非對稱矩陣。對於1d和Nd矩陣,Numpy.dot的Math.Net等效值是多少?

np.dot:對於二維陣列,它相當於矩陣乘法,而一維陣列是向量的內積(無複共軛)。對於N維它是一個和積過的最後一個軸和第二個到最後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

好了,好了,對我來說,點積和*不同的東西:

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用於非對稱矩陣?這對我來說毫無意義!

相關問題