Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtxVec *ThreshTop(const double Value); | Threshold top operation. |
| 2 | TMtxVec *ThreshTop(const double Value, int Index, int Len); | Perfrom the threshold operation on calling object values [Index]..[Index+Len-1]. |
| 3 | TMtxVec *ThreshTop(TMtxVec *Src, const double Value); | Perform threshold operation on all Src object values. |
| 4 | TMtxVec *ThreshTop(TMtxVec *Vec, const double Value, int VecIndex, int Index, int Len); | Perform a threshold operation Vec elements [VecIndex]..[VecIndex+Len-1]. |
Overload 1: TMtxVec *ThreshTop(const double Value);
Threshold top operation.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | const double |
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.
#include "Units.MtxVec.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxVec;
void Example()
{
TVec* a;
CreateIt(a);
a->SetIt(false, DewArray<double>{2, 0.1, 3, 4});
a->ThreshTop(0.2); // a = [0.2, 0.1, 0.2, 0.2]
FreeIt(a);
}
#include "Math387.h"
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Vector a;
a.SetIt(DewArray<double>{ 1.0, 5.0, 3.0, 7.0, 2.0 });
a.ThreshTop(4.0);
Vector expected;
expected.SetIt(DewArray<double>{ 1.0, 4.0, 3.0, 4.0, 2.0 });
if (!a.IsEqual(expected, 1e-10, TCompare::cmpAbsolute))
throw tException("Vector.ThreshTop: mismatch");
}
Overload 2: TMtxVec *ThreshTop(const double Value, int Index, int Len);
Perfrom the threshold operation on calling object values [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Value | const double | |
| 2 | Index | int | |
| 3 | Len | int |
An exception is raised if array borders are overrun/underrun.
Overload 3: TMtxVec *ThreshTop(TMtxVec *Src, const double Value);
Perform threshold operation on all Src object values.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Src | TMtxVec * | |
| 2 | Value | const double |
Store the results in calling object. Size and TVec::Complex properties of the calling object are adjusted automatically.
Overload 4: TMtxVec *ThreshTop(TMtxVec *Vec, const double Value, int VecIndex, int Index, int Len);
Perform a threshold operation Vec elements [VecIndex]..[VecIndex+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TMtxVec * | |
| 2 | Value | const double | |
| 3 | VecIndex | int | |
| 4 | Index | int | |
| 5 | Len | int |
Store the results in the calling object elements [Index]..[Index+Len-1]. Size and TVec::Complex properties of the calling object must be set explicitly. An exception is raised if TVec::ConditionCheck is true and array borders are overrun/underrun.