C#Accord.NET elementwise添加过时了吗?

时间:2018-05-11 14:13:59

标签: c# matrix accord.net

当我尝试使用以下方法在NxD矩阵和Nx1向量(所有元素都是双重类型)之间进行添加时:

var result = Elementwise.Add(M, v, 1);

虽然结果不对,但我收到了警告:

'Elementwise.Add(double[*,*], double[], int)' is obsolete: 'Please specify a VectorType instead of an integer for the dimension argument'

在谷歌查找文档之后,我仍然不知道我应该如何处理C#中Matrix的元素添加。似乎开发者将来会消除一些过载。

谢谢,

1 个答案:

答案 0 :(得分:2)

Elementwise.Add并不是过时的 - 这是你使用的特定过载已经过时了。看一下源代码,我怀疑你只是想要:

var result = Elementwise.Add(M, v, VectorType.ColumnVector);

我认为您使用1作为维度值进行的调用有效地将1强制转换为VectorType,并且如Elementwise.cs所示,值1对应ColumnVector