Module easy_ml::linear_algebra[][src]

Linear algebra algorithms on numbers and matrices

Note that many of these functions are also exposed as corresponding methods on the Matrix type, but in depth documentation is only presented here.

It is recommended to favor the corresponding methods on the Matrix type as the Rust compiler can get confused with the generics on these functions if you use these methods without turbofish syntax.

Nearly all of these functions are generic over Numeric types, unfortunately, when using these functions the compiler may get confused about what type T should be and you will get the error:

overflow evaluating the requirement &'a _: easy_ml::numeric::NumericByValue<_, _>

In this case you need to manually specify the type of T by using the turbofish syntax like: linear_algebra::inverse::<f32>(&matrix)

You might be working with a generic type of T, in which case specify that linear_algebra::inverse::<T>(&matrix)

Structs

QRDecomposition

The result of a QR Decomposition of some matrix A such that QR = A.

Functions

cholesky_decomposition

Computes the cholesky decomposition of a matrix. This yields a matrix L such that for the provided matrix A, L * L^T = A. L will always be lower triangular, ie all entries above the diagonal will be 0. Hence cholesky decomposition can be interpreted as a generalised square root function.

covariance_column_features

Computes the covariance matrix for an NxM feature matrix, in which each N’th row has M features to find the covariance and variance of.

covariance_row_features

Computes the covariance matrix for an NxM feature matrix, in which each M’th column has N features to find the covariance and variance of.

determinant

Computes the determinant of a square matrix. For a 2 x 2 matrix this is given by ad - bc for:

f1_score

Computes the F-1 score of the Precision and Recall

inverse

Computes the inverse of a matrix provided that it exists. To have an inverse a matrix must be square (same number of rows and columns) and it must also have a non zero determinant.

mean

Computes the mean of the values in an iterator, consuming the iterator.

qr_decomposition

Computes a QR decomposition of a MxN matrix where M >= N.

softmax

Computes the softmax of the values in an iterator, consuming the iterator.

variance

Computes the variance of the values in an iterator, consuming the iterator.