Question

Using MathNet.numerics for C# , I have created dense matrix of doubles.

I wish to find the minimum & maximum element-value of a matrix.

Is there an accessor to get the maximum/minimum value of the dense matrix elements?

Actually I do this

var minValue = MyDenseMatrix.Values.Min();
var minValue = MyDenseMatrix.Values.Max();
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top