TSparseMtx.ThreshAbsLT Method

Overload List

#SignatureDescription
1TMtxVec ThreshAbsLT(TMtxVec Src, Double Value)Perform threshold operation on all Src object values.
└ indexed: TMtxVec ThreshAbsLT(TMtxVec Vec, Double Value, Int32 VecIndex, Int32 Index, Int32 Len)
2TMtxVec ThreshAbsLT(Double Value)Threshold top and bottom centered around zero.
└ indexed: TMtxVec ThreshAbsLT(Double Value, Int32 Index, Int32 Len)

Overload 1: TMtxVec ThreshAbsLT(TMtxVec Src, Double Value)

Perform threshold operation on all Src object values.

#NameTypeDescription
1SrcTMtxVecsource TVec or TMtx
2ValueDoublescalar

Result: stored in self (calling object), returns self for chaining

Remarks:

Store the results in calling object. Size and Dew.Math.TMtxVec.Complex properties of the calling object are adjusted automatically.

Indexed: TMtxVec ThreshAbsLT(TMtxVec Vec, Double Value, Int32 VecIndex, Int32 Index, Int32 Len)

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

#NameTypeDescription
1VecTMtxVecsource TVec or TMtx
2ValueDoublescalar
3VecIndexInt32
4IndexInt32start index
5LenInt32element count

Result: stored in self (calling object), returns self for chaining

Remarks:

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

Overload 2: TMtxVec ThreshAbsLT(Double Value)

Threshold top and bottom centered around zero.

#NameTypeDescription
1ValueDoublescalar

Result: stored in self (calling object), returns self for chaining

Remarks:

Perform threshold operation on all calling object values. The Value parameter is an upper bound for threshold operation. All values smaller than Value will be replaced with Value and all values bigger than -Value will be replaced with -Value. The comparison checks if abs(Values[i]) < Value.

Examples
using Dew.Math;
using Dew.Math.Units;

namespace Dew.Examples
{
    void Example()
    {
        TVec a;
        MtxVec.CreateIt(out a);
        try
        {
            a.SetIt(false, new double[] {2,-0.1,3,4});
            a.ThreshAbsLT(0.2); // a = [2,-0.2,3,4]
        }
        finally
        {
            MtxVec.FreeIt(ref a);
        }
    }
}
Matrix a = new Matrix();
a.SetIt(1, 5, false, new double[] { 1.0, 5.0, 3.0, 7.0, 2.0 });
a.ThreshAbsLT(4.0);
Matrix expected = new Matrix();
expected.SetIt(1, 5, false, new double[] { 4.0, 5.0, 4.0, 7.0, 4.0 });
if (!a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute))
    throw new Exception("Matrix.ThreshAbsLT: mismatch");

Indexed: TMtxVec ThreshAbsLT(Double Value, Int32 Index, Int32 Len)

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

#NameTypeDescription
1ValueDoublescalar
2IndexInt32start index
3LenInt32element count

Result: stored in self (calling object), returns self for chaining

Remarks:

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