Matrix.Multiply Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

Multiply<T>(Matrix<T>, T) Multiplies a matrix by a scalar.
Multiply<T>(Matrix<T>, Matrix<T>) Multiplies two matrix objects.
Multiply<T>(Matrix<T>, Vector<T>) Multiplies a vector by a matrix.
Multiply<T>(T, Matrix<T>) Multiplies a matrix by a scalar.
Multiply<T>(Matrix<T>, TransposeOperation, Vector<T>) Multiplies a vector by a matrix.
Multiply<T>(Matrix<T>, TransposeOperation, Matrix<T>, TransposeOperation) Multiplies one matrix by another matrix and returns the result.

Multiply<T>(Matrix<T>, T)

Multiplies a matrix by a scalar.
C#
public static Matrix<T> Multiply<T>(
	Matrix<T> matrix,
	T factor
)

Parameters

matrix  Matrix<T>
A matrix.
factor  T
A number.

Type Parameters

T

Return Value

Matrix<T>
A matrix whose elements are the corresponding elements of matrix multiplied by factor.

Exceptions

ArgumentNullException

matrix is null.

Multiply<T>(Matrix<T>, Matrix<T>)

Multiplies two matrix objects.
C#
public static Matrix<T> Multiply<T>(
	Matrix<T> matrix1,
	Matrix<T> matrix2
)

Parameters

matrix1  Matrix<T>
The first Matrix<T>.
matrix2  Matrix<T>
The second Matrix<T>.

Type Parameters

T

Return Value

Matrix<T>
A Matrix<T> that is the product of matrix1 and matrix2.

Remarks

This method returns the matrix product of its two arguments. For this operation to be defined, the number of columns of matrix1 must equal the number of rows of matrix2.

Exceptions

ArgumentNullException

matrix1 is null.

-or-

matrix2 is null.

DimensionMismatchException

The number of columns of matrix1 does not equal the number of rows of matrix2.

Multiply<T>(Matrix<T>, Vector<T>)

Multiplies a vector by a matrix.
C#
public static Vector<T> Multiply<T>(
	Matrix<T> matrix,
	Vector<T> vector
)

Parameters

matrix  Matrix<T>
A matrix.
vector  Vector<T>
A vector.

Type Parameters

T

Return Value

Vector<T>

Exceptions

ArgumentNullException

matrix is null.

-or-

vector is null.

Multiply<T>(T, Matrix<T>)

Multiplies a matrix by a scalar.
C#
public static Matrix<T> Multiply<T>(
	T factor,
	Matrix<T> matrix
)

Parameters

factor  T
A number.
matrix  Matrix<T>
A matrix.

Type Parameters

T

Return Value

Matrix<T>
A matrix whose elements are the corresponding elements of matrix multiplied by factor.

Exceptions

ArgumentNullException

matrix is null.

Multiply<T>(Matrix<T>, TransposeOperation, Vector<T>)

Multiplies a vector by a matrix.
C#
public static Vector<T> Multiply<T>(
	Matrix<T> matrix,
	TransposeOperation operation,
	Vector<T> vector
)

Parameters

matrix  Matrix<T>
A matrix.
operation  TransposeOperation
The operation to apply to matrix before multiplying.
vector  Vector<T>
A vector.

Type Parameters

T

Return Value

Vector<T>

Exceptions

ArgumentNullException

matrix is null.

-or-

vector is null.

Multiply<T>(Matrix<T>, TransposeOperation, Matrix<T>, TransposeOperation)

Multiplies one matrix by another matrix and returns the result.
C#
public static Matrix<T> Multiply<T>(
	Matrix<T> left,
	TransposeOperation leftOperation,
	Matrix<T> right,
	TransposeOperation rightOperation
)

Parameters

left  Matrix<T>
The left operand of the multiplication.
leftOperation  TransposeOperation
A TransposeOperation value that indicates which operation, if any, should be performed on this instance before multiplying.
right  Matrix<T>
The right operand of the multiplication.
rightOperation  TransposeOperation
A TransposeOperation value that indicates which operation, if any, should be performed on the matrix right before multiplying.

Type Parameters

T

Return Value

Matrix<T>
A matrix that is the product of the matrix left, transformed as specified by leftOperation, with the matrix right, transformed as specified by rightOperation.

Remarks

This method calculates the matrix product of two matrices. The exact form of the operation is determined by the other parameters. The dimensions of the two matrices must be compatible with this form.

Exceptions

ArgumentNullException

left is null.

-or-

right is null.

See Also