sparse
Sparse linear algebra over the CSC com.eignex.koblas.SparseMatrix, behind three swappable seams that mirror the dense ones.
SparseVectorKernels — the sparse level-1 tier: a sparse vector against a dense one (
usdot,usaxpyin Sparse BLAS terms) or against another sparse one, plus scatter and the reductions. Unlike the denseVectorKernelsthere is no length threshold, because the fallback here is an object rather than a compiled-in primitive and there is no compile-time kernel to protect.SparseBlas — the sparse matrix routines.
gemvin both directions, walking columns, which is what CSC stores. Deliberately thin: a sparsegemmfills in and is a different algorithm with a different result type, so it lands here when something needs it.SparseLapack — the factorizations. SparseLapack.factor returns SparseFactorization, never null: a singular matrix yields a factorization reporting
singular, matching the dense contract.SparseLinearAlgebra pairs the two matrix seams. All three are offered through
registerSparseBlas/ com.eignex.koblas.registerBackend and forced with com.eignex.koblas.installBackends, resolving as com.eignex.koblas.koblas and itssparseVectorKernels.Implementation: SparseLu, a Markowitz threshold-pivoting
P·B·Q = L·Uthat keeps the factors sparse instead of filling towardO(m²).
SparseFactorization is an interface rather than a class, which is the one place this deviates from the dense shape. LAPACK's packed formats are a standard, so a dense com.eignex.koblas.dense.LuDecomposition travels between backends; no sparse solver describes its factors — UMFPACK hands back a void *, KLU and CHOLMOD their own structs — so a seam demanding a concrete type could never admit one.
The containers themselves live in the parent package, alongside the dense ones, because the sealed view roots require their subtypes in one package.
Types
The portable sparse backend: every routine in Kotlin, no host dependency, and the semantic reference a host backend is validated against.
What SparseLapack.factor returns when no numerically acceptable pivot remains.
The sparse matrix routines, the seam a host sparse BLAS plugs into.
A factored sparse matrix you can solve against, whoever produced it.
The sparse factorizations, the seam a host sparse solver plugs into.
Both sparse matrix seams at once, the counterpart of com.eignex.koblas.dense.LinearAlgebra.
Sparse LU factorization P·B·Q = L·U of an m × m matrix, with Markowitz threshold pivoting: at each step the pivot (near-)minimises fill (the Markowitz count (rowNnz−1)·(colNnz−1) over the active submatrix, searched over a bounded set of lowest-count candidate columns à la Suhl & Suhl) among entries that are numerically acceptable (|a| ≥ τ·max|column|), so the factors stay sparse instead of filling toward O(m²). Both a row permutation P and a column permutation Q are produced; only the nonzeros of L/U are stored, so memory is O(nnz).
The sparse level-1 kernels: a sparse vector against a dense one, or against another sparse one.
Properties
The default SparseLapack.factor drop tolerance: keep every entry the elimination produces.
Functions
Factorize this sparse matrix with the active backend (koblas) — the sparse counterpart of DenseMatrix.lu(), carrying the same name for the same operation on the other storage.
Solve op(T) · x = b in place against this matrix's lower or upper triangle, with the active backend (koblas) — the sparse counterpart of the dense trsv free function. See SparseBlas.trsv.