| StatMin Method (ReadOnlyDoubleMatrix) |
Returns the minimum 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 Min(
ReadOnlyDoubleMatrix data
)
Public Shared Function Min (
data As ReadOnlyDoubleMatrix
) As IndexValuePair
public:
static IndexValuePair Min(
ReadOnlyDoubleMatrix^ data
)
static member Min :
data : ReadOnlyDoubleMatrix -> IndexValuePair
Parameters
- data
- Type: Novacta.AnalyticsReadOnlyDoubleMatrix
The data to search for a minimum.
Return Value
Type:
IndexValuePairThe pair given by the minimum data value and its first
linear index.
Exceptions Remarks
The method returns an
IndexValuePair structure which exposes the minimum 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 smallest entry of the
specified data is computed.
using System;
namespace Novacta.Analytics.CodeExamples
{
public class MinExample1
{
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 dataMin = Stat.Min(matrix);
Console.WriteLine();
Console.WriteLine("Data minimum is {0} on linear position {1}",
dataMin.Value, dataMin.Index);
ReadOnlyDoubleMatrix readOnlyMatrix = matrix.AsReadOnly();
var readOnlyDataMin = Stat.Min(readOnlyMatrix);
Console.WriteLine();
Console.WriteLine("Using read-only data. Minimum is {0} on linear position {1}",
readOnlyDataMin.Value, readOnlyDataMin.Index);
}
}
}
See Also