MtxExpr.Sub Method

Overload List

#SignatureDescription
1Matrix Sub(TMtx X, TMtxVec Y, TCplx Z)Result = X - Y - zScalar, where X is a Matrix
2Matrix Sub(TMtx X, TMtxVec Y, TMtxVec Z)Result = X - Y - Z, where X is a Matrix
3Matrix Sub(TMtx X, TMtxVec Y, Double Z)Result = X - Y - zScalar, where X is a Matrix
4Vector Sub(TVec X, TMtxVec Y, TCplx Z)Result = X - Y - zScalar
5Vector Sub(TVec X, TMtxVec Y, TMtxVec Z)Result = X - Y - Z
6Vector Sub(TVec X, TMtxVec Y, Double Z)Result = X - Y - zScalar

Overload 1: Matrix Sub(TMtx X, TMtxVec Y, TCplx Z)

Compute X - Y - zScalar, where X is a Matrix.

#NameTypeDescription
1XTMtxsource TMtx
2YTMtxVecsource TVec or TMtx
3ZTCplxscalar

Returns: Matrix

Overload 2: Matrix Sub(TMtx X, TMtxVec Y, TMtxVec Z)

Compute X - Y - Z, where X is a Matrix

#NameTypeDescription
1XTMtxsource TMtx
2YTMtxVecsource TVec or TMtx
3ZTMtxVecsource TVec or TMtx

Returns: Matrix

Overload 3: Matrix Sub(TMtx X, TMtxVec Y, Double Z)

Compute X - Y - zScalar, where X is a Matrix.

#NameTypeDescription
1XTMtxsource TMtx
2YTMtxVecsource TVec or TMtx
3ZDoublescalar

Returns: Matrix

Overload 4: Vector Sub(TVec X, TMtxVec Y, TCplx Z)

Compute X - Y - zScalar

#NameTypeDescription
1XTVecsource TVec
2YTMtxVecsource TVec or TMtx
3ZTCplxscalar

Returns: Vector

Overload 5: Vector Sub(TVec X, TMtxVec Y, TMtxVec Z)

Compute X - Y - Z

#NameTypeDescription
1XTVecsource TVec
2YTMtxVecsource TVec or TMtx
3ZTMtxVecsource TVec or TMtx

Returns: Vector

Remarks:

Computes the difference of three vector-based operands (X, Y, and Z) without creating temporary objects.

Examples
using Dew.Math;
using Dew.Math.Units;

namespace Dew.Examples
{
    void Example()
    {
        Vector X = (Vector) new double[] { 5, 6, 7, 8 };
        Vector Y = (Vector) new double[] { 1, 2, 3, 4 };
        Vector Z = (Vector) new double[] { 1, 1, 1, 1 };
        Vector A1 = X - Y - Z;
        Vector A2 = Sub(X, Y, Z);
        Vector A3 = new Vector();
        A3.Sub(X, Y, Z);
        if (!A2.IsEqual(A1)) Math387.ERaise("Problem");
        if (!A3.IsEqual(A1)) Math387.ERaise("Problem");
    }
}

Overload 6: Vector Sub(TVec X, TMtxVec Y, Double Z)

Compute X - Y - zScalar

#NameTypeDescription
1XTVecsource TVec
2YTMtxVecsource TVec or TMtx
3ZDoublescalar

Returns: Vector

Remarks:

Computes the difference between X and Y and then subtracts a scalar zScalar, without creating temporary objects.

Examples
using Dew.Math;
using Dew.Math.Units;

namespace Dew.Examples
{
    void Example()
    {
        double zScalar = 3.0;
        Vector X = (Vector) new double[] { 5, 6, 7, 8 };
        Vector Y = (Vector) new double[] { 1, 2, 3, 4 };
        Vector A1 = X - Y - zScalar;
        Vector A2 = Sub(X, Y, zScalar);
        Vector A3 = new Vector();
        A3.Sub(X, Y, zScalar);
        if (!A2.IsEqual(A1)) Math387.ERaise("Problem");
        if (!A3.IsEqual(A1)) Math387.ERaise("Problem");
    }
}