lazymatrix
Lazy column normalization for design matrices in Rust. lazymatrix presents
X̃ = (X − 1cᵀ) S⁻¹
as a linear operator without materializing the centered matrix. This matters for sparse matrices, where subtracting a column center would turn structural zeros into nonzeros. Matrix–vector products instead use the original matrix:
X̃v = X(S⁻¹v) − 1(cᵀS⁻¹v)
X̃ᵀu = S⁻¹(Xᵀu − c Σu)
Centering and scaling are independently optional. The crate also provides borrowed logical column views and sparse column access for algorithms such as coordinate descent.
Install
The core trait and operator API has no linear algebra dependency beyond
num-traits. Enable a backend for ready-made dense and CSC implementations:
# or
Example
use ;
use ;
let x = from_row_slice;
let x = new;
let y = x.matvec;
The same interface works with faer and nalgebra dense matrices, their borrowed
views, and CSC sparse matrices. See examples/ for complete solver
examples that consume the operator.
License
Licensed under either the Apache License, Version 2.0 or the MIT license, at your option.