TMtx::Mul Method

Overload List

#SignatureDescription
1TMtxVec *Mul(const double Value);Multiply object elements with Value.
2TMtxVec *Mul(const TCplx &Value);Multiply all calling object elements with complex Value in-place.
3TMtxVec *Mul(const double Value, int Index, int Len);Multipy calling object elements [Index]..[Index+Len-1] with Value in-place.
4TMtxVec *Mul(const TCplx &Value, int Index, int Len);Multipy calling object elements [Index]..[Index+Len-1] with complex Value in-place.
5TMtxVec *Mul(TMtxVec *Vec, const double Value);Multiply each element of Vec with Value.
6TMtxVec *Mul(TMtxVec *Vec, const TCplx &Value);Multiply each element of Vec with complex Value.
7TMtxVec *Mul(TMtxVec *Vec, const double Value, int VecIndex, int Index, int Len);Multiply Vec elements [VecIndex]..[VecIndex+Len-1] with Value.
8TMtxVec *Mul(TMtxVec *Vec, const TCplx &Value, int VecIndex, int Index, int Len);Multiply Vec elements [VecIndex]..[VecIndex+Len-1] with complex Value.
9TMtxVec *Mul(TMtxVec *X, TMtxVec *Y, TMtxVec *Z);Compute X*Y*Z
10TMtxVec *Mul(TMtxVec *X, TMtxVec *Y, const double Z);Compute X*Y*zScalar
11TMtxVec *Mul(TMtxVec *X, TMtxVec *Y, const TCplx &Z);Compute X*Y*zScalar
12TMtxVec *Mul(TMtxVec *X, int XIndex, TMtxVec *Y, int YIndex, TMtxVec *Z, int zIndex, int Index, int Len);Compute X*Y*Z on sub array
13TMtxVec *Mul(TMtxVec *X, int XIndex, TMtxVec *Y, int YIndex, const double Z, int Index, int Len);Compute X*Y*zScalar on sub array
14TMtxVec *Mul(TMtxVec *X, int XIndex, TMtxVec *Y, int YIndex, const TCplx &Z, int Index, int Len);Compute X*Y*zScalar on sub array
15TMtxVec *Mul(TMtxVec *Vec);Vector multiplication.
16TMtxVec *Mul(TMtxVec *Vec, int VecIndex, int Index, int Len);Multiply Vec elements [VecIndex]..[VecIndex+Len-1] with calling object elements [Index]..[Index+Len-1] in-place.
17TMtxVec *Mul(TMtxVec *Vec1, TMtxVec *Vec2);Multiply all Vec1 elements with corresponding Vec2 elements.
18TMtxVec *Mul(TMtxVec *Vec1, TMtxVec *Vec2, int Vec1Index, int Vec2Index, int Index, int Len);Multiply Vec1 elements [Vec1Index]..[Vec1Index+Len-1] with Vec2 object elements [Vec2Index]..[Vec2Index+Len-1].
19TMtx *Mul(TMtx *A, TMtx *B);Matrix multiplication.
20TMtx *Mul(TMtx *Mtx1, TMtx *Mtx2, TMtxOperation Operation1, TMtxOperation Operation2 = TMtxOperation::opNone, TJITedMul JITedMul = TJITedMul::jtmDisabled);Left side multiply Mtx2 with Mtx1 matrix and store the results in the calling matrix.
21TMtx *Mul(TMtx *Mtx1, TMtx *Mtx2, TMtxType Mtx1Type, TMtxType Mtx2Type = TMtxType::mtGeneral, TMtxOperation Operation1 = TMtxOperation::opNone, TMtxOperation Operation2 = TMtxOperation::opNone, TJITedMul JITedMul = TJITedMul::jtmDisabled);Left side multiply Mtx2 with Mtx1 matrix and store the results in the calling matrix.
22TMtx *Mul(TMtx *Mtx1, TMtx *Mtx2, TMtx *Mtx3);Returns the matrix product of three matrices.
23TMtx *Mul(TMtx *Mtx1, TMtx *Mtx2, TMtx *Mtx3, TMtx *Mtx4);Returns the matrix product of four matrices.

Overload 1: TMtxVec *Mul(const double Value);

Multiply object elements with Value.

#NameTypeDescription
1Valueconst double
Remarks:

Multiplies all calling object elements with Value in-place.

See Also: TMtx::Add
Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 2: TMtxVec *Mul(const TCplx &Value);

Multiply all calling object elements with complex Value in-place.

#NameTypeDescription
1Valueconst TCplx &
Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 3: TMtxVec *Mul(const double Value, int Index, int Len);

Multipy calling object elements [Index]..[Index+Len-1] with Value in-place.

#NameTypeDescription
1Valueconst double
2Indexint
3Lenint
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 *Mul(const TCplx &Value, int Index, int Len);

Multipy calling object elements [Index]..[Index+Len-1] with complex Value in-place.

#NameTypeDescription
1Valueconst TCplx &
2Indexint
3Lenint
Remarks:

An exception is raised if array borders are overrun or underrun.

Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 5: TMtxVec *Mul(TMtxVec *Vec, const double Value);

Multiply each element of Vec with Value.

#NameTypeDescription
1VecTMtxVec *
2Valueconst double
Remarks:

Store the result in the calling object. Size and TMtx::Complex properties of the calling object are adjusted automatically.

Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 6: TMtxVec *Mul(TMtxVec *Vec, const TCplx &Value);

Multiply each element of Vec with complex Value.

#NameTypeDescription
1VecTMtxVec *
2Valueconst TCplx &
Remarks:

Store the result in the calling object. Size of the calling object is set automatically. TMtx::Complex property of the calling object is set to True.

Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 7: TMtxVec *Mul(TMtxVec *Vec, const double Value, int VecIndex, int Index, int Len);

Multiply Vec elements [VecIndex]..[VecIndex+Len-1] with Value.

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

Store the result in calling object elements [Index]..[Index+Len-1]. Size of the calling object is not changed. An exception is raised if array borders are overrun or underrun. TMtx::Complex propertiy of the calling object is set implicitly.

Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 8: TMtxVec *Mul(TMtxVec *Vec, const TCplx &Value, int VecIndex, int Index, int Len);

Multiply Vec elements [VecIndex]..[VecIndex+Len-1] with complex Value.

#NameTypeDescription
1VecTMtxVec *
2Valueconst TCplx &
3VecIndexint
4Indexint
5Lenint
Remarks:

Store the result in calling object elements [Index]..[Index+Len-1]. Size of the calling object is not changed. An exception is raised if array borders are overrun or underrun. TMtx::Complex propertiy of the calling object is set to True.

Declared in Dew::Math::TMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 9: TMtxVec *Mul(TMtxVec *X, TMtxVec *Y, TMtxVec *Z);

Compute X*Y*Z

#NameTypeDescription
1XTMtxVec *
2YTMtxVec *
3ZTMtxVec *
Remarks:

The following expression would also run at the same or higher speed, when passing X also for the Z parameter:

X^2*Y

Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 10: TMtxVec *Mul(TMtxVec *X, TMtxVec *Y, const double Z);

Compute X*Y*zScalar

#NameTypeDescription
1XTMtxVec *
2YTMtxVec *
3Zconst double
Remarks:

The following expression would also run at the same or higher speed, when passing X also for the Z parameter:

X^2*zScalar

Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 11: TMtxVec *Mul(TMtxVec *X, TMtxVec *Y, const TCplx &Z);

Compute X*Y*zScalar

#NameTypeDescription
1XTMtxVec *
2YTMtxVec *
3Zconst TCplx &
Remarks:

The following expression would also run at the same or higher speed, when passing X also for the Z parameter:

X^2*zScalar

Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 12: TMtxVec *Mul(TMtxVec *X, int XIndex, TMtxVec *Y, int YIndex, TMtxVec *Z, int zIndex, int Index, int Len);

Compute X*Y*Z on sub array

#NameTypeDescription
1XTMtxVec *
2XIndexint
3YTMtxVec *
4YIndexint
5ZTMtxVec *
6zIndexint
7Indexint
8Lenint
Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

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

Compute X*Y*zScalar on sub array

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

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

Compute X*Y*zScalar on sub array

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

Overload 15: TMtxVec *Mul(TMtxVec *Vec);

Vector multiplication.

#NameTypeDescription
1VecTMtxVec *
Remarks:

Multiply each of Vec elements with corresponding elements in the calling object. Size and TMtx::Complex property of the calling object are set automatically. The result is stored in the calling object.

See Also: TMtx::Divide
Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 16: TMtxVec *Mul(TMtxVec *Vec, int VecIndex, int Index, int Len);

Multiply Vec elements [VecIndex]..[VecIndex+Len-1] with calling object elements [Index]..[Index+Len-1] in-place.

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

An exception is raised if Vec and calling object TMtx::Complex property do not match or if array borders are overrun/underrun.

Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 17: TMtxVec *Mul(TMtxVec *Vec1, TMtxVec *Vec2);

Multiply all Vec1 elements with corresponding Vec2 elements.

#NameTypeDescription
1Vec1TMtxVec *
2Vec2TMtxVec *
Remarks:

Store the results in calling object. Size and TMtx::Complex property of calling object are adjusted automatically to match those of Vec1 and Vec2. An exception is raised if Vec1 and Vec2 size and TMtx::Complex property do not match.

Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

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

Multiply Vec1 elements [Vec1Index]..[Vec1Index+Len-1] with Vec2 object elements [Vec2Index]..[Vec2Index+Len-1].

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

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

Declared in Dew::Math::TDenseMtxVec · Dew.Math/AbstractMtxVec.h · Cross-compiler

Overload 19: TMtx *Mul(TMtx *A, TMtx *B);

Matrix multiplication.

#NameTypeDescription
1ATMtx *
2BTMtx *
Remarks:

Performs matrix multiplication. In most general case the matrix multiplication is defined by the following equation (result = calling matrix):

result=αop(M1)op(M2)+βresult\text{result}=\alpha \cdot \text{op}(M_1) \cdot \text{op}(M_2) + \beta \cdot \text{result}

where a and b are TMtx::Alfa and TMtx::Beta variables. The default values for a and b are Cplx(1,0) and Cplx(0,0), so the above equation is reduced to:

result=op(M1)op(M2)\text{result}=\text{op}(M_1)\cdot \text{op}(M_2)

The Operation1 and Operation2 indicate additional TMtxOperation, performed on Mtx1 and Mtx2 respectively. Default value for operation is opNone (no additional operation). The Mtx1Type and Mtx2Type parameters indicate the TMtxType of Mtx1 and Mtx2 matrices. Depending what type of matrices you are multiplying, the Mul method will choose most optimized multiplication method. So, choosing the correct values for Mtx1Type and Mtx2Type can significantly speed up the multiplication.

This overloaded function performs a left side multiply operation B with A matrix and stores the results in the calling matrix. If Operation1 and/or Operation2 parameters are specified, perform additional operation on A or B. If Operation1 and/or Operation2 parameters are omitted, the default values (no operation) will be used. The TMtx::Rows, TMtx::Cols and TMtx::Complex properties of the calling matrix are adjusted automatically. An exception is raised is A Cols property does not match the B Rows property (matrix multiplication is not possible). An exception is raised, if TMtx::Complex property of A and B does not match.

Note

  • If you are not sure, which TMtxType of matrix are you multiplying, you can use the mtGeneral type (general case).
  • You can also use the TMtx::DetectMtxType method to determine the type of matrix.
  • The routine is multithreaded, if specified by the environment variable.
See Also: TMtx::MulElem
Declared in Dew::Math::TMtx · Dew.Math/MtxVec.h · Cross-compiler

Overload 20: TMtx *Mul(TMtx *Mtx1, TMtx *Mtx2, TMtxOperation Operation1, TMtxOperation Operation2 = TMtxOperation::opNone, TJITedMul JITedMul = TJITedMul::jtmDisabled);

Left side multiply Mtx2 with Mtx1 matrix and store the results in the calling matrix.

#NameTypeDescription
1Mtx1TMtx *
2Mtx2TMtx *
3Operation1TMtxOperation
4Operation2 = TMtxOperation::opNoneTMtxOperation
5JITedMul = TJITedMul::jtmDisabledTJITedMul
Remarks:

If Operation1 and/or Operation2 parameters are specified, perform additional operation on Mtx1 or Mtx2. If Operation1 and/or Operation2 parameters are omitted, the default values (no operation) will be used. The TMtx::Rows, TMtx::Cols and TMtx::Complex properties of the calling matrix are adjusted automatically. An exception is raised is Mtx1 Cols property does not match the Mtx2 Rows property (matrix multiplication is not possible). An exception is raised, if Complex property of Mtx1 and Mtx2 does not match.

When JITedMul is set to jtmEnabled, the JIT-ed matrix kernel will be created. This creation takes some time and should only be used, if the function will be called many times with the same parameters. The parameters that may not change include the size of the matrices, but matrix objects and memory locations can vary. As a rule of thumb, the change of the parameters can be 2-3x slower than using tmDisabled, but when the parameters do not change for a small matrix of 2x2 the speed-up can be 50x.

Declared in Dew::Math::TMtx · Dew.Math/MtxVec.h · Cross-compiler

Overload 21: TMtx *Mul(TMtx *Mtx1, TMtx *Mtx2, TMtxType Mtx1Type, TMtxType Mtx2Type = TMtxType::mtGeneral, TMtxOperation Operation1 = TMtxOperation::opNone, TMtxOperation Operation2 = TMtxOperation::opNone, TJITedMul JITedMul = TJITedMul::jtmDisabled);

Left side multiply Mtx2 with Mtx1 matrix and store the results in the calling matrix.

#NameTypeDescription
1Mtx1TMtx *
2Mtx2TMtx *
3Mtx1TypeTMtxType
4Mtx2Type = TMtxType::mtGeneralTMtxType
5Operation1 = TMtxOperation::opNoneTMtxOperation
6Operation2 = TMtxOperation::opNoneTMtxOperation
7JITedMul = TJITedMul::jtmDisabledTJITedMul
Remarks:

If parameters Mtx1Type and/or Mtx2Type are specified, the optimized multiplication method will be used. If parameters Mtx1Type and/or Mtx2Type are omitted, default values (general matrix) will be used. If Operation1 and/or Operation2 parameters are specified, perform additional operation on Mtx1 or Mtx2. If Operation1 and/or Operation2 parameters are omitted, the default values (no operation) will be used. The TMtx::Rows, TMtx::Cols and TMtx::Complex properties of the calling matrix are adjusted automatically. An exception is raised is Mtx1 Cols property does not match the Mtx2 Rows property (matrix multiplication is not possible). An exception is raised, if Complex property of Mtx1 and Mtx2 does not match.

When JITedMul is set to jtmEnabled, the JIT-ed matrix kernel will be created. This creation takes some time and should only be used, if the function will be called many times with the same parameters. The parameters that may not change include the size of the matrices, but matrix objects and memory locations can vary. As a rule of thumb, the change of the parameters can be 2-3x slower than using tmDisabled, but when the parameters do not change for a small matrix of 2x2 the speed-up can be 50x.

Declared in Dew::Math::TMtx · Dew.Math/MtxVec.h · Cross-compiler

Overload 22: TMtx *Mul(TMtx *Mtx1, TMtx *Mtx2, TMtx *Mtx3);

Returns the matrix product of three matrices.

#NameTypeDescription
1Mtx1TMtx *
2Mtx2TMtx *
3Mtx3TMtx *
Remarks:

Internally calls TMtx::Mul and does JIT-ed (faster) multiply only for small square sized matrices.

Declared in Dew::Math::TMtx · Dew.Math/MtxVec.h · Cross-compiler

Overload 23: TMtx *Mul(TMtx *Mtx1, TMtx *Mtx2, TMtx *Mtx3, TMtx *Mtx4);

Returns the matrix product of four matrices.

#NameTypeDescription
1Mtx1TMtx *
2Mtx2TMtx *
3Mtx3TMtx *
4Mtx4TMtx *
Remarks:

Internally calls TMtx::Mul and does JIT-ed (faster) multiply only for small square sized matrices.

Declared in Dew::Math::TMtx · Dew.Math/MtxVec.h · Cross-compiler