Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtxVec *Sign(); | Changes elements sign. |
| 2 | TMtxVec *Sign(int Index, int Len); | Change calling object elements [Index]..[Index+Len-1] sign in-place. |
| 3 | TMtxVec *Sign(TMtxVec *X); | Change all X object elements sign. |
| 4 | TMtxVec *Sign(TMtxVec *X, int XIndex, int Index, int Len); | Change X object elements [XIndex]..[XIndex+Len-1] sign. |
Overload 1: TMtxVec *Sign();
Changes elements sign.
Remarks:
Changes all calling object elements sign (v -> -v) in-place.
Examples
#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>{-1,2,-3,4});
a->Sign(); // a = 1,-2, 3, -4
FreeIt(a);
}
#include "Math387.h"
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Vector a;
a.SetIt(DewArray<double>{ -3.0, -1.0, 1.0, 2.0 });
a.Sign();
Vector expected;
expected.SetIt(DewArray<double>{ 3.0, 1.0, -1.0, -2.0 });
if (!a.IsEqual(expected, 1e-10, TCompare::cmpAbsolute))
throw tException("Vector.Sign: mismatch");
}
See Also: TSparseMtx::Mul
Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler
Overload 2: TMtxVec *Sign(int Index, int Len);
Change calling object elements [Index]..[Index+Len-1] sign in-place.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | int | |
| 2 | Len | int |
Remarks:
An exception is raised if array borders are overrun or underrun.
Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler
Overload 3: TMtxVec *Sign(TMtxVec *X);
Change all X object elements sign.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec * |
Remarks:
Store the results in calling object. Size and TSparseMtx::Complex properties of calling object are adjusted automatically.
Examples
#include "Math387.h"
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Vector a;
Vector x;
x.SetIt(DewArray<double>{ -3.0, -1.0, 1.0, 2.0 });
a.Sign(x);
Vector expected;
expected.SetIt(DewArray<double>{ 3.0, 1.0, -1.0, -2.0 });
if (!a.IsEqual(expected, 1e-10, TCompare::cmpAbsolute))
throw tException("Vector.Sign: mismatch");
}
Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler
Overload 4: TMtxVec *Sign(TMtxVec *X, int XIndex, int Index, int Len);
Change X object elements [XIndex]..[XIndex+Len-1] sign.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec * | |
| 2 | XIndex | int | |
| 3 | Index | int | |
| 4 | Len | int |
Remarks:
Store the results in callingobject elements [Index]..[Index+Len-1]. An exception is raised if array borders are overrun or underrun.
Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler