CblasLinearAlgebra
LinearAlgebra backed by the host's OpenBLAS through its C interfaces (CBLAS and LAPACKE), for the Linux and macOS native targets. Nothing is linked: the libraries are resolved with dlopen at program start, so the dependency is optional at runtime — libopenblas plus liblapacke on Debian/Ubuntu, brew install openblas on macOS. When they are present koblas installs this backend eagerly before main; when they are missing the program still runs on com.eignex.koblas.dense.ReferenceLinearAlgebra, and constructing this class throws. isAvailable and isBlasAvailable report which case the host is, since the two halves resolve independently.
Koblas storage is column-major, the order LAPACK defines, so buffers cross the FFI boundary without repacking. Semantics match com.eignex.koblas.dense.ReferenceLinearAlgebra exactly as specified by the LinearAlgebra contract: beta == 0 overwrites without reading, alpha == 0 reduces to the beta scale, syrk produces the full, exactly symmetric result by default, and the factorizations use the shared packed formats so they interchange between backends.
OpenBLAS runs single-threaded by default here, which is the faster configuration at koblas workload sizes; set the OPENBLAS_NUM_THREADS environment variable to opt into its threading.
Constructors
CblasLinearAlgebra
Both halves of the host library, for a caller that wants to install it explicitly.
Types
Functions
Apply Q (or Qᵀ when transpose) from qr to a length-m y, into a fresh result (LAPACK dormqr restricted to a single column). Allocates; applyQInto does not.
LU factorization with partial pivoting of a square a (LAPACK dgetrf); a is not modified. Allocates the factor buffers; factorInto refactorizes into existing ones.
Refactorize a into out's existing buffers, returning out. A periodic refactorization — the simplex rebuilding its basis, a filter re-decomposing a covariance — otherwise allocates an n² copy and a pivot array each time; this reuses both. out must have the same dimension as a, and its previous contents are discarded.
Matrix-matrix product A · B into a fresh matrix (restricted gemm with alpha = 1, beta = 0); A.cols must equal B.rows.
In-place matrix-matrix accumulate C = alpha · op(A) · op(B) + beta · C (full BLAS dgemm), where op transposes its operand when transposeA / transposeB is set. Shapes must satisfy op(A): m×k, op(B): k×n, C: m×n. Per BLAS convention, beta == 0.0 overwrites c without reading it, and alpha == 0.0 reduces to the beta scale.
Matrix-vector product A · x, or Aᵀ · x when transpose, into a fresh result (restricted gemv with alpha = 1, beta = 0).
Rank-one update A = A + alpha · x · yᵀ (BLAS dger).
Symmetric indefinite factorization A = L·D·Lᵀ with Bunch–Kaufman partial pivoting (LAPACK dsytrf, lower). As with Blas.symv, only the lower triangle of a is read — the strictly upper triangle may hold anything — and a is not modified. Use this where the matrix is symmetric but not positive definite (KKT systems); for SPD matrices cholesky is cheaper.
QR factorization A = Q·R of an m×n a via Householder reflections (LAPACK dgeqrf); a is not modified and any shape is accepted. Rank deficiency is not detected — zero diagonal entries of R surface in solveLeastSquares as infinities/NaNs, following the triangular-solve convention.
Reciprocal condition number estimate 1 / (anorm · est(‖A⁻¹‖₁)) from a factorization (LAPACK dgecon). anorm is the 1-norm of the original, unfactored matrix (see norm1), which the caller computes before factoring. Returns 1.0 for the empty factorization and exactly 0.0 when lu is singular or anorm is zero.
Solve A · X = B for the b.cols right-hand-side columns of b at once against a symmetric indefinite factorization (LAPACK dsytrs with nrhs); returns a fresh X. Backends may substitute a native block solve.
Solve A · x = b for a symmetric indefinite factorization ldl (LAPACK dsytrs); returns a fresh x. Symmetry makes the transposed solve identical, so there is no transpose flag. Allocates the result; solveInto writes into a caller-owned destination instead.
Solve A · X = B (or Aᵀ · X = B when transpose) for the b.cols right-hand-side columns of b at once (LAPACK dgetrs with nrhs); returns a fresh X. The default runs the permutation and the two triangular block solves directly on the shared packed format; backends may substitute a native block solve.
Solve A · X = B (or Aᵀ · X = B when transpose) into out, which is returned. out may be b. The transposed direction stages a block before scattering its rows through the permutation, so pass a workspace to lend that n·nrhs buffer.
Least-squares solve min ‖A·x − b‖₂ from the factorization (the dgels shape): requires m ≥ n and full column rank, returns the length-n solution x = R⁻¹·(Qᵀb)[0..n). This is the kernel square-root/array filters build on; it composes with cholesky rank-one updates for sliding-window problems.
Minimum-norm solution of the underdetermined consistent system A · x = b for a wide m×n A with m <= n and full row rank (LAPACK dgels's underdetermined shape, via QR of the transpose instead of LQ): pass the factorization qr(Aᵀ). With Aᵀ = Q·R we have A = Rᵀ·Qᵀ, so a forward solve Rᵀ·w = b followed by x = Q·(w padded with zeros) gives the solution of smallest 2-norm. b has length m; the result has length n. Rank deficiency is not detected and surfaces as infinities/NaNs, following the triangular-solve convention.
Solve A * x = b for x, given L = chol(A) (lower-triangular, A = L * LT). Allocates a fresh result vector; b is not modified.
In-place symmetric matrix-matrix accumulate C = alpha · A · B + beta · C, or C = alpha · B · A + beta · C when right (BLAS dsymm). As with symv, only the triangle of the symmetric a selected by lower is read. Shapes: b and c agree, and a is square with dimension B.rows (left) or B.cols (right). Per BLAS convention, beta == 0.0 overwrites c without reading it, and alpha == 0.0 reduces to the beta scale.
In-place symmetric matrix-vector accumulate y = alpha · A · x + beta · y for a symmetric a (BLAS dsymv). Only the triangle selected by lower (diagonal included) is read; the opposite strict triangle may hold anything. Exploits symmetry for roughly half the memory traffic of gemv. Per BLAS convention, beta == 0.0 overwrites y without reading it, and alpha == 0.0 reduces to the beta scale.
In-place symmetric rank-k accumulate C = alpha · A·Aᵀ + beta · C, or alpha · Aᵀ·A + beta · C when transpose (BLAS dsyrk). With the default Uplo.FULL the full symmetric result is produced (the alpha term is applied to both triangles, and beta scales all of c); with Uplo.LOWER / Uplo.UPPER the standard dsyrk semantics apply — only the selected triangle is written and beta-scaled, the opposite strict triangle untouched. c must be square with dimension op(A).rows. Per BLAS convention, beta == 0.0 overwrites without reading (within the written region), and alpha == 0.0 reduces to the beta scale.
Solve op(T) · x = b in place (BLAS dtrsv), where T is the lower or upper triangle of the square a, op transposes when transpose, and unitDiag takes the diagonal as 1 without reading it. x holds the right-hand side on entry and the solution on return. Only the selected triangle is read, so the rest of a may hold anything.