Skip to main content

Module matrix

Module matrix 

Source
Expand description

Dense matrix operations.

A minimal, row-major dense matrix type with fundamental linear algebra operations required for statistical analysis: multiplication, transpose, determinant, inverse, Cholesky decomposition, and triangular solves.

§Design

  • Row-major storage: data[i * cols + j] = A[i, j]
  • No external dependencies: Pure Rust, no nalgebra/LAPACK
  • Partial pivoting: Used in LU and Gauss-Jordan for numerical stability
  • Explicit error handling: Returns Result<T, MatrixError> with descriptive variants

§Examples

use u_numflow::matrix::Matrix;

let a = Matrix::from_rows(&[
    &[1.0, 2.0],
    &[3.0, 4.0],
]);
let b = a.transpose();
let c = a.mul_mat(&b).unwrap();
assert_eq!(c.rows(), 2);
assert_eq!(c.cols(), 2);

Structs§

Matrix
A dense matrix stored in row-major order.

Enums§

MatrixError
Error type for matrix operations.