Expand description
Small dense helpers on row-major f64 buffers.
Heavy products and symmetric eigendecompositions go through faer
(Par::Seq). tang_la::gemm_* and tang_la::SymmetricEigen were the
first choice; on the codec’s shapes (m ≈ 700, k ≈ 10⁴) the eigensolver
took >95% of encode time and the GEMMs were the next bottleneck, so the
hot paths moved to faer, which tang-la already bridges behind a feature. Truncated SVDs of the
m × n TT unfoldings are computed from the Gram matrix of the smaller
side (min(m,n) ≤ 2·r_max), which is what makes TT-SVD of a 2^24-entry
tensor cheap: one-sided Jacobi (tang_la::Svd) on a 2 × 2^23 unfolding
would be far slower. The Gram route squares the condition number; in f64
that leaves singular values down to ~1e-7·σ₁ resolved, well below any
truncation tolerance the codec uses (see the crate docs).
Functions§
- cholesky
- Lower Cholesky factor of SPD
a(n×n), orNoneif not positive definite. - gram_
cols Aᵀ·Afor row-majora(m × n).- gram_
rows A·Aᵀfor row-majora(m × n).- kron_
eye_ apply (H ⊗ I_n)·XforHr×r andX(r·n)×p, row-major — computed asH · X'withX'the free r×(n·p) reshape,n× cheaper than the dense Kronecker product.- matmul
C = A·B(A: m×k, B: k×n), row-major.- matmul_
tn C = Aᵀ·B(A: k×m, B: k×n), row-major.- orthonormalize_
cols - Modified Gram–Schmidt (two passes) on the columns of row-major m×k
u. - solve_
lower - Solve
L·X = Bin place (L lower n×n, B n×m row-major). - solve_
lower_ t - Solve
Lᵀ·X = Bin place (L lower n×n, B n×m row-major). - svd_
left - Truncated SVD of a row-major m×n matrix via the Gram matrix of the
smaller side. Returns all singular values (descending, length min(m,n))
and a closure-free pair:
u(m × k, row-major) for the leadingkcolumns requested bypick(which sees the singular values). - sym_
eig_ desc - Eigenpairs of a symmetric matrix, descending: (values, vectors as row-major n×n with eigenvector j in column j).
- transpose
- Transpose a row-major m×n matrix.