koblas
Koblas is a Kotlin Multiplatform library for dense and sparse linear algebra: a defined subset of double-precision BLAS and LAPACK, sparse LU factorization, and a compute backend that swaps out for the host OpenBLAS on the Linux and macOS native targets when one is installed.
Kotlin has no standard multiplatform linear algebra library, so this is a small one built around serializable containers. A flat column-major DenseMatrix, DenseVector and SparseVector behind a shared view contract, and a CSC SparseMatrix that transposes in place instead of converting to CSR. Arithmetic lives as free functions over the views, while the heavier dense operations sit behind the swappable Blas and Lapack interfaces.
Coverage runs from level 1 through level 3 BLAS, the LU, Cholesky, QR, and symmetric indefinite solver families with condition estimation, and sparse LU. Every routine is implemented in portable Kotlin and tested against reference results on every target, so a host library is an accelerator rather than a requirement. Single precision, complex numbers, banded and packed storage, SVD, and eigendecompositions are out of scope. Nothing is supported silently, so a routine reaches the coverage table once a workload needs it.
The seams are named for what they cover. VectorKernels holds the vector-vector routines, Blas the matrix ones, Lapack the factorizations built on them, and the sparse side mirrors all three one for one. Each is ranked and selected independently, so a host that provides one library and not the other still accelerates the half it can. Level 1 is reached differently, specialized at compile time and consulting the interface only once a run is long enough to pay for a foreign call, because those kernels do nanoseconds of work and the virtual call would cost more than the kernel itself.
Routines that a steady-state loop repeats have a destination-passing form, so a loop owning its buffers allocates nothing. The few that need scratch of their own take an optional Workspace, a caller-owned pool of vectors keyed by width that grows on demand and can be reserved up front.
Install
dependencies {
implementation("com.eignex:koblas:0.1.0")
}
Where to go next
- API reference — full KDoc, generated from the
current
mainbranch. - Changelog — release notes.