I have an ilnumerics symetric matrix of double like that
100 90,38000 87,27000 44,23000 34,62000 30,77000
90,38000 100 90,91000 34,62000 44,23000 34,62000
87,27000 90,91000 100 36,36000 38,18000 47,27000
34,62000 44,23000 38,18000 89,80000 100 90,38000
30,77000 34,62000 47,27000 86,54000 90,38000 100
I want to find maximum value. I use
ILNumerics.ILRetArray<double> maxValue = ILNumerics.ILMath.maxall(matrixSimilarity);
The result is maxValue = 100. I want result without taking the values on the diagonal => maxValue = 90,91
How can do this with ilnumerics function in C#?
There might be faster ways to the result, but this would work:
ILArray<double> E = counter(5, 5);
E is now:
<Double> [5,5]
[0]: 1 6 11 16 21
[1]: 2 7 12 17 22
[2]: 3 8 13 18 23
[3]: 4 9 14 19 24
[4]: 5 10 15 20 25
Copy to a new variable, modify the diagonal and acquire the maximum value:
// make a copy of E
ILArray<double> maxE = E.C;
// set diagonal of the copy to smallest value
maxE[r(0,maxE.S[0]+1,numel(maxE)-1)] = minall(maxE);
// compute the max value
maxE = maxall(maxE);
>maxE
<Double> 24
Note, the code is expected to get executed in the context of a subclass of ILMath, as usual.