Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TMtxVec *Abs() const; | Absolute values. |
| 2 | TMtxVec *Abs(int Index, int Len) const; | Calculate the absolute value for calling object elements [Index]..[Index+Len-1]. |
| 3 | TMtxVec *Abs(TMtxVec *X) const; | Calculate the absolute value for all X object. |
| 4 | TMtxVec *Abs(TMtxVec *X, int XIndex, int Index, int Len) const; | Calculate the absolute value of X object elements [XIndex]..[XIndex+Len-1]. |
Overload 1: TMtxVec *Abs() const;
Absolute values.
Remarks:
Calculate the absolute value of all calling object elemets in-place.
Examples
#include "Math387.h"
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Matrix a;
a.SetIt(2, 2, false, DewArray<double>{ -3.0, -1.0, 1.0, 2.0 });
a.Abs();
Matrix expected;
expected.SetIt(2, 2, false, DewArray<double>{ 3.0, 1.0, 1.0, 2.0 });
if (!a.IsEqual(expected, 1e-10, TCompare::cmpAbsolute))
throw tException("Matrix.Abs: mismatch");
}
#include "MtxExpr.h"
#include "Units.MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxExpr;
void Example()
{
Matrix a, b;
a.SetIt(1, 2, true, DewArray<double>{1, -2, 3, 4});
a.Abs();
a = Abs(a); //same as a.Abs
b.Abs(a); //same as b := Abs(a);
b = Abs(a);
}
See Also: Matrix::Mag
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler
Overload 2: TMtxVec *Abs(int Index, int Len) const;
Calculate the absolute value for calling object elements [Index]..[Index+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Index | int | |
| 2 | Len | int |
Remarks:
An exception is raised if array borders are overrun or underrun.
Examples
#include "MtxExpr.h"
#include "Units.Math387.h"
#include "Units.MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;
using namespace Dew::Math::Units::MtxExpr;
void Example()
{
Matrix a, b;
a = {{Cplx(1, -2), Cplx(3, 4)}};
a.Abs();
a = Abs(a); //same as a.Abs
b.Abs(a); //same as b := Abs(a);
b = Abs(a);
}
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler
Overload 3: TMtxVec *Abs(TMtxVec *X) const;
Calculate the absolute value for all X object.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec * |
Remarks:
Store the results in the calling object. Size and Matrix::Complex property of calling object are adjusted automatically.
Examples
#include "Math387.h"
#include "MtxExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
Matrix a;
Matrix x;
x.SetIt(2, 2, false, DewArray<double>{ -3.0, -1.0, 1.0, 2.0 });
a.Abs(x);
Matrix expected;
expected.SetIt(2, 2, false, DewArray<double>{ 3.0, 1.0, 1.0, 2.0 });
if (!a.IsEqual(expected, 1e-10, TCompare::cmpAbsolute))
throw tException("Matrix.Abs: mismatch");
}
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler
Overload 4: TMtxVec *Abs(TMtxVec *X, int XIndex, int Index, int Len) const;
Calculate the absolute value of X object elements [XIndex]..[XIndex+Len-1].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TMtxVec * | |
| 2 | XIndex | int | |
| 3 | Index | int | |
| 4 | Len | int |
Remarks:
Store the results in calling object elements [Index]..[Index+Len-1]. An exception is raised if array borders are overrun or underrun.
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler