当我尝试使用以下方法在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的元素添加。似乎开发者将来会消除一些过载。
谢谢,
答案 0 :(得分:2)
Elementwise.Add
并不是过时的 - 这是你使用的特定过载已经过时了。看一下源代码,我怀疑你只是想要:
var result = Elementwise.Add(M, v, VectorType.ColumnVector);
我认为您使用1
作为维度值进行的调用有效地将1
强制转换为VectorType
,并且如Elementwise.cs
所示,值1对应ColumnVector
。