Crate russell_lab
source · [−]Expand description
Russell - Rust Scientific Library
lab: Matrix-vector laboratory including linear algebra tools
Example - Cholesky factorization
use russell_lab::{cholesky_factor, Matrix, StrError};
fn main() -> Result<(), StrError> {
// set matrix
let a = Matrix::from(&[
[ 4.0, 12.0, -16.0],
[ 12.0, 37.0, -43.0],
[-16.0, -43.0, 98.0],
]);
// perform factorization
let m = a.nrow();
let mut l = Matrix::new(m, m);
cholesky_factor(&mut l, &a)?;
// compare with solution
let l_correct = "┌ ┐\n\
│ 2 0 0 │\n\
│ 6 1 0 │\n\
│ -8 5 3 │\n\
└ ┘";
assert_eq!(format!("{}", l), l_correct);
Ok(())
}
Structs
Implements a matrix with numeric components for linear algebra
Implements a vector with numeric components for linear algebra
Assists in measuring computation time
Enums
Traits
Functions
Performs the addition of two matrices
Performs the addition of two vectors
Implements the boxcar function
Performs the Cholesky factorization of a symmetric positive-definite matrix
Performs the addition of two matrices
Performs the addition of two vectors
Copies vector (complex version)
Performs the matrix-matrix multiplication resulting in a matrix (complex version)
Zips two arrays (real and imag) to make a new ComplexMatrix
Computes the matrix norm (complex version)
Zips two arrays (real and imag) to make a new ComplexVector
Copies matrix
Copies vector
Returns package description
Performs the eigen-decomposition of a square matrix
Performs the eigen-decomposition of a square matrix (left and right)
Returns a nice string representing the value in nanoseconds
Generates 2d points (meshgrid)
Generates 3d points (function over meshgrid)
Implements the Heaviside step function (derivative of ramp(x))
Performs the inner (dot) product between two vectors resulting in a scalar value
Computes the inverse of a square matrix and returns its determinant
Implements the standard logistic function
Returns the first derivative of the standard logistic function
Performs the matrix-matrix multiplication resulting in a matrix
Finds the maximum absolute difference between the components of two matrices
Sums the columns of a matrix
Sums the rows of a matrix
Performs the matrix(transposed)-matrix multiplication resulting in a matrix
Performs the matrix-vector multiplication resulting in a vector
Computes the matrix norm
Performs the outer (tensor) product between two vectors resulting in a matrix
Computes the pseudo-inverse matrix
Scales matrix
Scales vector
Implements the sign function
Implements a smooth ramp function
Returns the first derivative of smooth_ramp
Returns the second derivative of smooth_ramp
Solves a general linear system (real numbers)
Sorts 2 values
Sorts 3 values
Sorts 4 values
Implements the superquadric auxiliary involving cos(x)
Implements the superquadric function involving sin(x)
Computes the singular value decomposition (SVD) of a matrix
Updates matrix based on another matrix (axpy)
Updates vector based on another vector (axpy)
Performs the vector-matrix multiplication resulting in a vector
Finds the maximum absolute difference between the components of two vectors
Returns the vector norm
Type Definitions
ComplexMatrix is an alias to NumMatrix
ComplexVector is an alias to NumVector
Matrix is an alias to NumMatrix
Defines a type alias for the error type as a static string
Vector is an alias to NumVector