Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtxVec *Frac(); | Fractional part of values. |
| 2 | TMtxVec *Frac(TMtxVec *X); | Calculates the fractional part for all X object values. |
| 3 | TMtxVec *Frac(int Index, int Len); | Calculates the fractional part for calling object elements [Index]..[Index+Len-1] in-place. |
| 4 | TMtxVec *Frac(TMtxVec *X, int XIndex, int Index, int Len); | Calculates the fractional part for X object elements [XIndex]..[XIndex+Len-1]. |
Overload 1: TMtxVec *Frac();
Fractional part of values.
Remarks:
Calculates the fractional part for all object values 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,5.5,-1.6,6});
a->Frac(); // a = [0, 0.5, -0.6, 0]
FreeIt(a);
}
#include "Math387.h"
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Vector a;
a.SetIt(DewArray<double>{ 1.2, 2.7, -0.5, 3.9 });
a.Frac();
Vector expected;
expected.SetIt(DewArray<double>{ 0.2, 0.7, -0.5, 0.9 });
if (!a.IsEqual(expected, 1e-10, TCompare::cmpAbsolute))
throw tException("Vector.Frac: mismatch");
}
See Also: TSparseMtx::Trunc, TSparseMtx::Round
Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler
Overload 2: TMtxVec *Frac(TMtxVec *X);
Calculates the fractional part for all X object values.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec * |
Remarks:
Stores the result 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>{ 1.2, 2.7, -0.5, 3.9 });
a.Frac(x);
Vector expected;
expected.SetIt(DewArray<double>{ 0.2, 0.7, -0.5, 0.9 });
if (!a.IsEqual(expected, 1e-10, TCompare::cmpAbsolute))
throw tException("Vector.Frac: mismatch");
}
Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler
Overload 3: TMtxVec *Frac(int Index, int Len);
Calculates the fractional part for calling object elements [Index]..[Index+Len-1] 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 4: TMtxVec *Frac(TMtxVec *X, int XIndex, int Index, int Len);
Calculates the fractional part for X object elements [XIndex]..[XIndex+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec * | |
| 2 | XIndex | int | |
| 3 | Index | int | |
| 4 | Len | int |
Remarks:
Stores the result in calling object 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