Vector::Sub Method

Overload List

#SignatureDescription
1TMtxVec *Sub(TMtxVec *X, TMtxVec *Y, TMtxVec *Z) const;Compute X - Y - Z
2TMtxVec *Sub(TMtxVec *X, int XIndex, TMtxVec *Y, int YIndex, TMtxVec *Z, int zIndex, int Index, int Len) const;Compute X - Y - Z on sub array
3TMtxVec *Sub(TMtxVec *X, TMtxVec *Y, const double Z) const;Compute X - Y - zScalar
4TMtxVec *Sub(TMtxVec *X, TMtxVec *Y, const TCplx &Z) const;Compute X - Y - zScalar
5TMtxVec *Sub(TMtxVec *X, int XIndex, TMtxVec *Y, int YIndex, const double Z, int Index, int Len) const;Compute X - Y - zScalar on sub array
6TMtxVec *Sub(TMtxVec *X, int XIndex, TMtxVec *Y, int YIndex, const TCplx &Z, int Index, int Len) const;Compute X - Y - zScalar on sub array
7TMtxVec *Sub(double Value) const;Subtracts Value from object elements.
8TMtxVec *Sub(TCplx Value) const;Subtracts complex Value from all calling object complex elements.
9TMtxVec *Sub(double Value, int Index, int Len) const;Subtracts Value from calling object elements [Index]..[Index+Len-1].
10TMtxVec *Sub(TCplx Value, int Index, int Len) const;Subtracts complex Value from calling object complex elements [Index]..[Index+Len-1].
11TMtxVec *Sub(TMtxVec *Src, double Value) const;Subtract real Value from Src.
12TMtxVec *Sub(TMtxVec *Src, TCplx Value) const;Subtract complex Value from Src store the results in calling object.
13TMtxVec *Sub(TMtxVec *Src, double Value, int SrcIndex, int Index, int Len) const;Subtract real Value from Src elements [SrcIndex]..[SrcIndex+Len-1] and store the result in calling object elements [Index]..[Index+Len-1].
14TMtxVec *Sub(TMtxVec *Src, TCplx Value, int SrcIndex, int Index, int Len) const;Subtract complex Value from Src elements [SrcIndex]..[SrcIndex+Len-1] and store the result in calling object elements [Index]..[Index+Len-1].
15TMtxVec *Sub(TMtxVec *Vec) const;Array subtraction.
16TMtxVec *Sub(TMtxVec *Vec1, TMtxVec *Vec2) const;Subtract Vec2 elements from Vec1 elements and store the results in calling object.
17TMtxVec *Sub(TMtxVec *Vec, int VecIndex, int Index, int Len) const;Subtract Vec elements [VecIndex]..[VecIndex+Len-1] from corresponding calling object elements [Index]..[Index+Len-1].
18TMtxVec *Sub(TMtxVec *Vec1, TMtxVec *Vec2, int Vec1Index, int Vec2Index, int Index, int Len) const;Subtract Vec22 elements [Vec2Index]..[Vec2Index+Len-1] from Vec1 object elements [Vec1Index]..[Vec1Index+Len-1].

Overload 1: TMtxVec *Sub(TMtxVec *X, TMtxVec *Y, TMtxVec *Z) const;

Compute X - Y - Z

#NameTypeDescription
1XTMtxVec *
2YTMtxVec *
3ZTMtxVec *
Examples
#include "MtxExpr.h"
#include "Units.Math387.h"
#include "Units.MtxExpr.h"
#include "Units.MtxVec.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;
using namespace Dew::Math::Units::MtxExpr;
using namespace Dew::Math::Units::MtxVec;

void Example()
{
    Vector X, Y, Z, A1, A2, A3;

    X = {5, 6, 7, 8};
    Y = {1, 2, 3, 4};
    Z = {1, 1, 1, 1};
    A1 = X - Y - Z;
    A2 = Sub(X, Y, Z);
    A3.Sub(X, Y, Z);
    if (!A2.IsEqual(A1))
        ERaise("Problem");
    if (!A3.IsEqual(A1))
        ERaise("Problem");
}
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 2: TMtxVec *Sub(TMtxVec *X, int XIndex, TMtxVec *Y, int YIndex, TMtxVec *Z, int zIndex, int Index, int Len) const;

Compute X - Y - Z on sub array

#NameTypeDescription
1XTMtxVec *
2XIndexint
3YTMtxVec *
4YIndexint
5ZTMtxVec *
6zIndexint
7Indexint
8Lenint
Examples
#include "MtxExpr.h"
#include "Units.Math387.h"
#include "Units.MtxExpr.h"
#include "Units.MtxVec.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;
using namespace Dew::Math::Units::MtxExpr;
using namespace Dew::Math::Units::MtxVec;

void Example()
{
    Vector X, Y, A1, A2, A3;
    double zScalar;

    zScalar = 3.0;
    X = {5, 6, 7, 8};
    Y = {1, 2, 3, 4};
    A1 = X - Y - zScalar;
    A2 = Sub(X, Y, zScalar);
    A3.Sub(X, Y, zScalar);
    if (!A2.IsEqual(A1))
        ERaise("Problem");
    if (!A3.IsEqual(A1))
        ERaise("Problem");
}
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 3: TMtxVec *Sub(TMtxVec *X, TMtxVec *Y, const double Z) const;

Compute X - Y - zScalar

#NameTypeDescription
1XTMtxVec *
2YTMtxVec *
3Zconst double
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 4: TMtxVec *Sub(TMtxVec *X, TMtxVec *Y, const TCplx &Z) const;

Compute X - Y - zScalar

#NameTypeDescription
1XTMtxVec *
2YTMtxVec *
3Zconst TCplx &
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 5: TMtxVec *Sub(TMtxVec *X, int XIndex, TMtxVec *Y, int YIndex, const double Z, int Index, int Len) const;

Compute X - Y - zScalar on sub array

#NameTypeDescription
1XTMtxVec *
2XIndexint
3YTMtxVec *
4YIndexint
5Zconst double
6Indexint
7Lenint
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 6: TMtxVec *Sub(TMtxVec *X, int XIndex, TMtxVec *Y, int YIndex, const TCplx &Z, int Index, int Len) const;

Compute X - Y - zScalar on sub array

#NameTypeDescription
1XTMtxVec *
2XIndexint
3YTMtxVec *
4YIndexint
5Zconst TCplx &
6Indexint
7Lenint
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 7: TMtxVec *Sub(double Value) const;

Subtracts Value from object elements.

#NameTypeDescription
1Valuedouble
Remarks:

Subtracts Value from all calling object elements.

See Also: Vector::Add
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 8: TMtxVec *Sub(TCplx Value) const;

Subtracts complex Value from all calling object complex elements.

#NameTypeDescription
1ValueTCplx
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 9: TMtxVec *Sub(double Value, int Index, int Len) const;

Subtracts Value from calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1Valuedouble
2Indexint
3Lenint
Remarks:

An exception is raised if array borders are overrun.

Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 10: TMtxVec *Sub(TCplx Value, int Index, int Len) const;

Subtracts complex Value from calling object complex elements [Index]..[Index+Len-1].

#NameTypeDescription
1ValueTCplx
2Indexint
3Lenint
Remarks:

An exception is raised if array borders are overrun.

Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 11: TMtxVec *Sub(TMtxVec *Src, double Value) const;

Subtract real Value from Src.

#NameTypeDescription
1SrcTMtxVec *
2Valuedouble
Remarks:

Store the results in calling object. Size and Vector::Complex property of calling object are adjusted automatically.

Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 12: TMtxVec *Sub(TMtxVec *Src, TCplx Value) const;

Subtract complex Value from Src store the results in calling object.

#NameTypeDescription
1SrcTMtxVec *
2ValueTCplx
Remarks:

Size and Vector::Complex property of calling object are adjusted automatically.

Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 13: TMtxVec *Sub(TMtxVec *Src, double Value, int SrcIndex, int Index, int Len) const;

Subtract real Value from Src elements [SrcIndex]..[SrcIndex+Len-1] and store the result in calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1SrcTMtxVec *
2Valuedouble
3SrcIndexint
4Indexint
5Lenint
Remarks:

Size and Vector::Complex properties of the calling object must be set explicitly. An exception is raised if Vector::ConditionCheck is True and array borders are overrun or underrun.

Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 14: TMtxVec *Sub(TMtxVec *Src, TCplx Value, int SrcIndex, int Index, int Len) const;

Subtract complex Value from Src elements [SrcIndex]..[SrcIndex+Len-1] and store the result in calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1SrcTMtxVec *
2ValueTCplx
3SrcIndexint
4Indexint
5Lenint
Remarks:

Size and Vector::Complex properties of the calling object must be set explicitly. An exception is raised if Vector::ConditionCheck is True and array borders are overrun or underrun.

Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 15: TMtxVec *Sub(TMtxVec *Vec) const;

Array subtraction.

#NameTypeDescription
1VecTMtxVec *
Remarks:

Subtract each of Vec elements from corresponding elements in the calling object. An exception is raised if Vec and calling object size and Vector::Complex properties do not match.

Examples
#include "Math387.h"
#include "MtxExpr.h"

using namespace Dew;
using namespace Dew::Math;

void Example()
{
    Vector a;
    a.SetIt(DewArray<double>{ 1.0, 2.0, 3.0, 4.0 });
    Vector b;
    b.SetIt(DewArray<double>{ 5.0, 6.0, 7.0, 8.0 });
    a.Sub(b);
    Vector expected;
    expected.SetIt(DewArray<double>{ -4.0, -4.0, -4.0, -4.0 });
    if (!a.IsEqual(expected, 1e-10, TCompare::cmpAbsolute))
        throw tException("Vector.Sub: mismatch");
}
See Also: Vector::Add
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 16: TMtxVec *Sub(TMtxVec *Vec1, TMtxVec *Vec2) const;

Subtract Vec2 elements from Vec1 elements and store the results in calling object.

#NameTypeDescription
1Vec1TMtxVec *
2Vec2TMtxVec *
Remarks:

Size and Vector::Complex property of calling object are adjusted automatically. An exception is raised if Vec1 and Vec2 size and Vector::Complex property do not match.

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.0, 2.0, 3.0, 4.0 });
    Vector y;
    y.SetIt(DewArray<double>{ 5.0, 6.0, 7.0, 8.0 });
    a.Sub(x, y);
    Vector expected;
    expected.SetIt(DewArray<double>{ -4.0, -4.0, -4.0, -4.0 });
    if (!a.IsEqual(expected, 1e-10, TCompare::cmpAbsolute))
        throw tException("Vector.Sub: mismatch");
}
Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 17: TMtxVec *Sub(TMtxVec *Vec, int VecIndex, int Index, int Len) const;

Subtract Vec elements [VecIndex]..[VecIndex+Len-1] from corresponding calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1VecTMtxVec *
2VecIndexint
3Indexint
4Lenint
Remarks:

The results are stored in the calling object elements [Index]..[Index+Len-1]. Size and Vector::Complex properties of the calling object must be set explicitly. An exception is raised if Vector::ConditionCheck is True and array borders are overrun or underrun.

Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler

Overload 18: TMtxVec *Sub(TMtxVec *Vec1, TMtxVec *Vec2, int Vec1Index, int Vec2Index, int Index, int Len) const;

Subtract Vec22 elements [Vec2Index]..[Vec2Index+Len-1] from Vec1 object elements [Vec1Index]..[Vec1Index+Len-1].

#NameTypeDescription
1Vec1TMtxVec *
2Vec2TMtxVec *
3Vec1Indexint
4Vec2Indexint
5Indexint
6Lenint
Remarks:

Store the results in calling object elements [Index]..[Index+Len-1]. Size and Vector::Complex properties of the calling object must be set explicitly. An exception is raised if Vector::ConditionCheck is True and array borders are overrun or underrun.

Declared in Dew::Math::Vector · Dew.Math/MtxExpr.h · Cross-compiler