- HasNan
- Transpose
- TransposeConjugate
- TriL
- TriU
- Diag
- Row
- Col
- Copy
- Compare
- CompareByDigits
- CompareEqual
- Flat
- Clip
- Reshape
- Resize
- Set
- SwapRows
- SwapCols
- Split
- Hsplit
- Vsplit
- ArgSort
- Sort
CompareEqual
Perform an absolute comparison of two matrices by unfolding successive rows into one-dimensional vectors.
ulong vector::Compare(
|
Parameters
vec
[in] Vector to compare.
mat
[in] Matrix to compare.
Method description
Let us have two matrices: matrix A the method is called for and matrix B, which is passed as a method parameter. The comparison is performed as follows:
- Matrices are expanded into one-dimensional vectors by successive concatenation of rows.
- Vectors are compared element by element until the first mismatched element.
- Depending on the comparison results, one of the values described below is returned.
Return Value
-1 — if the matrix A element is less than the corresponding matrix B element.
0 — if all elements of A and B matrices are identical.
1 — if the matrix A element exceeds the corresponding matrix B element.
Note
NaN value elements are taken into account when comparing.
NaN value elements are considered equal if they are present in both matrices at corresponding positions.
The NaN sign is not taken into account in the comparison.
An element with a NaN value is considered to be less than any other numeric value.
Example
//+------------------------------------------------------------------+
|