Module operations

Module operations 

Source
Expand description

Matrix operations.

Numeric type matrices implement elementwise addition and subtraction and matrix multiplication.

When doing numeric operations with matrices you should be careful to not consume a matrix by accidentally using it by value. All the operations are also defined on references to matrices so you should favor &x * &y style notation for matrices you intend to continue using. There are also convenience operations defined for a matrix and a scalar.

These implementations are written here but Rust docs will display them on their implemented types. All 16 combinations of owned and referenced Matrix and MatrixView operations are implemented. All 8 left hand side assigning addition (+=) and subtraction (-=) operations are also implemented.

Matrix multiplication is such that a matrix of dimensionality (LxM) multiplied with a matrix of dimensionality (MxN) yields a new matrix of dimensionality (LxN) with each element corresponding to the sum of products of the ith row in the first matrix and the jth column in the second matrix.

Operations on matrices of the wrong sizes will result in a panic. No broadcasting is performed, ie you cannot multiply a (NxM) matrix by a (Nx1) column vector, you must transpose one of the arguments so that the operation is valid.