Skip to main content

Crate caroli_dense

Crate caroli_dense 

Source
Expand description

Dense complex kernels for caroli: the Schur decomposition, its reordering, LU solves, QR and SVD, and matrix products. They dominate the lead modes and the nested-dissection fronts.

On macOS, with the accelerate feature (on by default), they can call Apple’s Accelerate framework (LAPACK and BLAS, which run on the matrix units of Apple silicon); elsewhere, or with the feature off, they use faer and an in-house QR algorithm. The reordering is in-house everywhere: adjacent swaps (LAPACK ztrexc) made in small windows, whose rotations reach the rest of the matrix as products.

set_backend chooses the library at run time (see Backend); the environment variable CAROLI_DENSE_BACKEND (accelerate, faer) sets the initial choice.

Structs§

Lu
LU factorisation with partial pivoting of a square matrix.
Svd
Thin singular value decomposition a = u diag(s) v†.

Enums§

Accum
determines whether to replace or add to the result of a matmul operatio
Backend
Which library runs the dense kernels. Without Accelerate in the build, both choices run faer.
DenseError
Errors of the dense kernels.
Op
How a factor enters a product.

Constants§

BACKEND
Libraries this build can use: "accelerate" (with faer) on macOS with the feature, else "faer".

Traits§

Field
A complex scalar the elimination kernels run in: c64, or c32 for reduced precision. Through Accelerate on Apple silicon, the Schur step of a front of 128 to 2048 variables runs 2.7–3.7× faster in c32.

Functions§

backend
The current choice (from CAROLI_DENSE_BACKEND at the first call, Accelerate by default).
hermitian_eigen
Eigen-decomposition a = v diag(w) v† of a Hermitian matrix, from its lower triangle: eigenvalues in increasing order, orthonormal eigenvectors in columns.
is_real
Whether a matrix has no imaginary part at all.
matmul
dst = α op(a) op(b) (Accum::Replace) or dst += α op(a) op(b) (Accum::Add).
norm_1
‖a‖₁, the largest column sum of moduli.
orthonormal_columns
Orthonormal basis of the columns of a full-rank m × n matrix, m ≥ n: the thin Q of its QR factorisation.
partition
Moves the selected eigenvalues of the Schur form (t, q) to the leading positions, keeping the order among the selected and among the others (as LAPACK ztrsen). Returns their number.
product
op(a) op(b) as a new matrix.
reorder
Stable reordering of the Schur form (t, q) by increasing keys, by adjacent swaps on the whole matrix. Cheap when few eigenvalues move; partition is the fast way to move many.
schur
Complex Schur decomposition a = q t q†: q unitary, t upper triangular with exact zeros below the diagonal. Returns (q, t).
schur_of_real
Complex Schur decomposition a = q t q† of a real matrix (given with zero imaginary parts): the real Schur form (a quarter of the arithmetic of the complex one), whose 2 × 2 blocks of complex pairs are then split by complex rotations (rsf2csf). Same output as schur.
set_backend
Chooses the library of the dense kernels for the whole process.
svd
Thin singular value decomposition of a.
svd_of_real
Thin singular value decomposition of a real matrix (given with zero imaginary parts), with real singular vectors (a complex decomposition may mix degenerate ones with phases). Without Accelerate, svd.

Type Aliases§

Mat
heap allocated resizable matrix, similar to a 2d alloc::vec::Vec
MatMut
mutable view over a matrix, similar to a mutable reference to a 2d strided slice
MatRef
immutable view over a matrix, similar to an immutable reference to a 2d strided slice
c32
Complex<f32>
c64
Complex<f64>