Tensor.MatrixMultiply<T> Method

Performs matrix multiplication over the last two dimensions of a pair of tensors.

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.1
C#
public static Tensor<T> MatrixMultiply<T>(
	Tensor<T> left,
	Tensor<T> right,
	Tensor<T>? result = null
)

Parameters

left  Tensor<T>
A tensor that serves as the left operand.
right  Tensor<T>
A tensor that serves as the right operand.
result  Tensor<T>  (Optional)
Optional. The tensor that is to hold the result. May be null.

Type Parameters

T
The type of the elements of the tensor.

Return Value

Tensor<T>
The matrix product of left and right.

Remarks

left and right must be at least one-dimensional. Scalars are not allowed.

The result is always a tensor, even when the product is equivalent to the dot product of two vectors.

Exceptions

RankException

left or right is a scalar.

DimensionMismatchException

The size of the last dimension of left does not equal the size of the second to last dimension of right.

See Also