Matrix.Subtract Method

Definition

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

Overload List

Subtract<T>(Matrix<T>, T) Subtracts a scalar from a matrix.
Subtract<T>(Matrix<T>, Matrix<T>) Subtracts two matrices.
Subtract<T>(T, Matrix<T>) Subtracts a matrix from a scalar.
Subtract<T>(Matrix<T>, Vector<T>, Dimension) Subtracts a vector broadcast along the specified dimension from a matrix.
Subtract<T>(Vector<T>, Dimension, Matrix<T>) Subtracts a matrix from a vector broadcast along the specified dimension.
Subtract<T>(Vector<T>, Dimension, Vector<T>) Subtracts one broadcast vector from another to form a matrix.

Subtract<T>(Matrix<T>, T)

Subtracts a scalar from a matrix.
C#
public static Matrix<T> Subtract<T>(
	Matrix<T> matrix,
	T value
)

Parameters

matrix  Matrix<T>
A matrix.
value  T
The constant.

Type Parameters

T

Return Value

Matrix<T>
A matrix whose elements are the difference of the corresponding elements of matrix and value.

Exceptions

ArgumentNullException

matrix is null.

Subtract<T>(Matrix<T>, Matrix<T>)

Subtracts two matrices.
C#
public static Matrix<T> Subtract<T>(
	Matrix<T> left,
	Matrix<T> right
)

Parameters

left  Matrix<T>
The matrix to subtract from.
right  Matrix<T>
The matrix to subtract.

Type Parameters

T

Return Value

Matrix<T>
A matrix whose elements are equal to the corresponding element of left minus the corresponding element of right.

Exceptions

ArgumentNullException

left is null.

-or-

right is null.

DimensionMismatchException

left and right do not have the same length.

Subtract<T>(T, Matrix<T>)

Subtracts a matrix from a scalar.
C#
public static Matrix<T> Subtract<T>(
	T value,
	Matrix<T> matrix
)

Parameters

value  T
The constant.
matrix  Matrix<T>
A matrix.

Type Parameters

T

Return Value

Matrix<T>
A matrix whose elements are the difference between the corresponding elements of matrix and value.

Exceptions

ArgumentNullException

matrix is null.

Subtract<T>(Matrix<T>, Vector<T>, Dimension)

Subtracts a vector broadcast along the specified dimension from a matrix.
C#
public static Matrix<T> Subtract<T>(
	Matrix<T> left,
	Vector<T> right,
	Dimension broadcastDimension
)

Parameters

left  Matrix<T>
The matrix to subtract from.
right  Vector<T>
The vector to broadcast and subtract.
broadcastDimension  Dimension
A value that specifies whether the elements in right should be broadcast across rows or columns.

Type Parameters

T

Return Value

Matrix<T>
A matrix whose elements are equal to the corresponding element of left minus the corresponding element of right.

Exceptions

ArgumentNullException

left is null.

-or-

right is null.

DimensionMismatchException

left and right do not have the same length.

Subtract<T>(Vector<T>, Dimension, Matrix<T>)

Subtracts a matrix from a vector broadcast along the specified dimension.
C#
public static Matrix<T> Subtract<T>(
	Vector<T> left,
	Dimension broadcastDimension,
	Matrix<T> right
)

Parameters

left  Vector<T>
The vector to broadcast and subtract from.
broadcastDimension  Dimension
A value that specifies whether the elements in right should be broadcast across rows or columns.
right  Matrix<T>
The matrix to subtract from.

Type Parameters

T

Return Value

Matrix<T>
A matrix whose elements are equal to the corresponding element of left minus the corresponding element of right.

Exceptions

ArgumentNullException

left is null.

-or-

right is null.

DimensionMismatchException

left and right do not have the same length.

Subtract<T>(Vector<T>, Dimension, Vector<T>)

Subtracts one broadcast vector from another to form a matrix.
C#
public static Matrix<T> Subtract<T>(
	Vector<T> left,
	Dimension leftBroadcastDimension,
	Vector<T> right
)

Parameters

left  Vector<T>
A matrix.
leftBroadcastDimension  Dimension
A value that specifies whether the elements in left should be broadcast across rows or columns.
right  Vector<T>
A vector.

Type Parameters

T

Return Value

Matrix<T>
A matrix whose elements are the sum of the corresponding elements of left and right.

Exceptions

ArgumentNullException

left is null.

-or-

right is null.

See Also