| StatMax Method (ReadOnlyDoubleMatrix) |
Returns the maximum value and the linear index of its first occurrence
in the specified data.
Namespace:
Novacta.Analytics
Assembly:
Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.0.0
Syntax public static IndexValuePair Max(
ReadOnlyDoubleMatrix data
)
Public Shared Function Max (
data As ReadOnlyDoubleMatrix
) As IndexValuePair
public:
static IndexValuePair Max(
ReadOnlyDoubleMatrix^ data
)
static member Max :
data : ReadOnlyDoubleMatrix -> IndexValuePair
Parameters
- data
- Type: Novacta.AnalyticsReadOnlyDoubleMatrix
The data to search for a maximum.
Return Value
Type:
IndexValuePairThe pair given by the maximum data value and its first linear index.
Exceptions Remarks
The method returns an
IndexValuePair structure which exposes the maximum data value through
property
Value, while the corresponding first linear position can be
inspected by getting property
Index.
Note |
---|
In the Novacta.Analytics assembly, positions of matrix entries are
interpreted as linearly ordered following a column major ordering.
|
Examples
In the following example, the largest entry of the
specified data is computed.
using System;
namespace Novacta.Analytics.CodeExamples
{
public class MaxExample1
{
public void Main()
{
var data = new double[6] {
-1, -2,
2, 3,
3, -4
};
var matrix = DoubleMatrix.Dense(3, 2, data, StorageOrder.RowMajor);
Console.WriteLine("The data matrix:");
Console.WriteLine(matrix);
var dataMax = Stat.Max(matrix);
Console.WriteLine();
Console.WriteLine("Data maximum is {0} on linear position {1}",
dataMax.Value, dataMax.Index);
ReadOnlyDoubleMatrix readOnlyMatrix = matrix.AsReadOnly();
var readOnlyDataMax = Stat.Max(readOnlyMatrix);
Console.WriteLine();
Console.WriteLine("Using read-only data. Maximum is {0} on linear position {1}",
readOnlyDataMax.Value, readOnlyDataMax.Index);
}
}
}
See Also