Matrix::ThreshTop Method

Overload List

#SignatureDescription
1TMtxVec *ThreshTop(double Value) const;Threshold top operation.
2TMtxVec *ThreshTop(double Value, int Index, int Len) const;Perfrom the threshold operation on calling object values [Index]..[Index+Len-1].
3TMtxVec *ThreshTop(TMtxVec *Src, double Value) const;Perform threshold operation on all Src object values and store the results in calling object.
4TMtxVec *ThreshTop(TMtxVec *Vec, double Value, int VecIndex, int Index, int Len) const;Perform a threshold operation Vec elements [VecIndex]..[VecIndex+Len-1].

Overload 1: TMtxVec *ThreshTop(double Value) const;

Threshold top operation.

#NameTypeDescription
1Valuedouble
Remarks:

Perform threshold operation on all calling object values. The Value parameter is an upper bound for threshold operation. All values bigger than Value will be replaced with Value.

Examples
#include "Math387.h"
#include "MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    Matrix a;
    a.SetIt(1, 5, false, DewArray<double>{ 1.0, 5.0, 3.0, 7.0, 2.0 });
    a.ThreshTop(4.0);
    Matrix expected;
    expected.SetIt(1, 5, false, DewArray<double>{ 1.0, 4.0, 3.0, 4.0, 2.0 });
    if (!a.IsEqual(expected, 1e-10, TCompare::cmpAbsolute))
        throw tException("Matrix.ThreshTop: mismatch");
}
#include "MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    Matrix a;

    a.SetIt(1, 2, true, DewArray<double>{2, 0.1, 3, 4});
    a.ThreshTop(0.2); // a = [0.2,0.1,0.2,0.2]
}
See Also: Matrix::ThreshTop
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 2: TMtxVec *ThreshTop(double Value, int Index, int Len) const;

Perfrom the threshold operation on calling object values [Index]..[Index+Len-1].

#NameTypeDescription
1Valuedouble
2Indexint
3Lenint
Remarks:

An exception is raised if array borders are overrun/underrun.

Examples
#include "MtxExpr.h"
#include "Units.Math387.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;

void Example()
{
    Matrix a;

    a = {{Cplx(2, 0.1), Cplx(3, 4)}};
    a.ThreshTop(0.2); // a = [0.2,0.1,0.2,0.2]
}
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 3: TMtxVec *ThreshTop(TMtxVec *Src, double Value) const;

Perform threshold operation on all Src object values and store the results in calling object.

#NameTypeDescription
1SrcTMtxVec *
2Valuedouble
Remarks:

Size and Matrix::Complex properties of the calling object are adjusted automatically.

Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler

Overload 4: TMtxVec *ThreshTop(TMtxVec *Vec, double Value, int VecIndex, int Index, int Len) const;

Perform a threshold operation Vec elements [VecIndex]..[VecIndex+Len-1].

#NameTypeDescription
1VecTMtxVec *
2Valuedouble
3VecIndexint
4Indexint
5Lenint
Remarks:

Store the results in the calling object elements [Index]..[Index+Len-1]. Size and Matrix::Complex properties of the calling object must be set explicitly. An exception is raised if Matrix::ConditionCheck is true and array borders are overrun/underrun.

Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler