4

使用MathNet.numericsC# ,我创建了密集的双精度矩阵。

我希望找到矩阵的最小和最大元素值。

是否有获取密集矩阵元素的最大值/最小值的访问器?

其实我这样做

var minValue = MyDenseMatrix.Values.Min();
var minValue = MyDenseMatrix.Values.Max();
4

1 回答 1

3

There is none. Vectors do have Minimum/Maximum methods, so I've just opened ticket #160 to add the symmetric functionality to matrices as well.

The way you do it in the example code is actually reasonable and fast, but will work only with dense matrices. Otherwise you can use the Enumerate() or for sparse also EnumerateNonZero() methods to get a normal enumerable you can use with LINQ or our statistics classes.

于 2013-10-03T11:30:53.593 回答