Matrix::Find Method

Overload List

#SignatureDescription
1int Find(const double X) const;Finds a match for X in object values.
2int Find(const TCplx &X) const;Compare complex value X with all calling object elements.

Overload 1: int Find(const double X) const;

Finds a match for X in object values.

#NameTypeDescription
1Xconst double
Remarks:

Compare real value X with all calling object elements and return the Index of last matched element. If no matching elements are found, the result is -1.

Note
This method also supports the NAN and INF search.

Examples
#include "MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    Matrix a;
    int ind;

    a.SetIt(1, 4, false, DewArray<double>{2, 5, 1, 6});
    ind = a.Find(1.0); // returns 2 (the arrays are zero based)
}
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 2: int Find(const TCplx &X) const;

Compare complex value X with all calling object elements.

#NameTypeDescription
1Xconst TCplx &

Returns: the Index of last matched element. If no matching elements are found, the result is -1.

Remarks:

An exception is raised if calling object Matrix::Complex property is false.

Examples
#include "MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    Matrix a;
    int ind;

    a = {{2, 5, 1, 6}};
    ind = a.Find(1.0); // returns 2 (the arrays are zero based)
}
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler