koblas

dense

Dense linear algebra: the three swappable seams and the routines behind them.

Types

Link copied to clipboard
interface Blas : Backend

The level-2 and level-3 BLAS routines, the seam a native BLAS plugs into.

Link copied to clipboard
sealed interface CholeskyPolicy

What Lapack.cholesky does when the matrix turns out not to be positive-definite.

Link copied to clipboard
interface Lapack : Backend

The factorizations and the solves built on them, the seam a native LAPACK plugs into.

Link copied to clipboard
class LdlDecomposition(val n: Int, val ldl: DoubleArray, val ipiv: IntArray, val failedAt: Int = NOT_SINGULAR)

A symmetric indefinite factorization A = L·D·Lᵀ with Bunch–Kaufman partial pivoting in LAPACK dsytrf (lower) packed form: ldl is the n×n column-major buffer whose lower triangle holds the unit-lower L columns and the 1×1/2×2 diagonal blocks of D (the strictly upper triangle is untouched input), and ipiv uses the LAPACK convention — ipiv[k] > 0 marks a 1×1 block with row interchange k ↔ ipiv[k]−1, while ipiv[k] == ipiv[k+1] < 0 marks a 2×2 block at (k, k+1) with interchange k+1 ↔ −ipiv[k]−1. Produced by LinearAlgebra.ldl; consumed by LinearAlgebra.solve.

Link copied to clipboard

Both halves of the compute seam at once: the Blas routines and the Lapack factorizations built on them. koblas is one of these, composed from whichever backend won each half.

Link copied to clipboard
class LuDecomposition(val n: Int, val lu: DoubleArray, val piv: IntArray, failedAt: Int = NOT_SINGULAR)

A general LU factorization with partial pivoting: P·A = L·U, the unit-lower L and upper U packed into one flat column-major lu buffer (L below the diagonal, U on and above) and the row permutation in piv (piv[k] is the original row now at position k). Produced by LinearAlgebra.factor.

Link copied to clipboard
class QrDecomposition(val m: Int, val n: Int, val qr: DoubleArray, val tau: DoubleArray)

A QR factorization A = Q·R in LAPACK dgeqrf packed form: qr is the m×n column-major buffer with R on and above the diagonal and the Householder vectors below it (each vector's implicit leading 1 is not stored), and tau holds the min(m, n) reflector coefficients of H_k = I − tau_k·v_k·v_kᵀ with Q = H_0·H_1···H_{k−1}. Produced by LinearAlgebra.qr; consumed by LinearAlgebra.applyQ and LinearAlgebra.solveLeastSquares.

Link copied to clipboard
class ReferenceBackend(kernels: VectorKernels? = null) : LinearAlgebra

Portable pure-Kotlin backend — correct on every target, no native dependency, and the semantic reference a native backend is validated against. Textbook Doolittle LU with partial pivoting and naive (SIMD-assisted where the vector kernels kick in) level-2/3 loops.

Link copied to clipboard
enum Uplo : Enum<Uplo>

Output-triangle selector for LinearAlgebra.syrk.

Link copied to clipboard

The vector-vector routines — dot, axpy, scale, nrm2, asum — as a backend half, alongside Blas and Lapack.

Properties

Link copied to clipboard

The shared portable backend: a ReferenceBackend following the process-default vector kernels.

Functions

Link copied to clipboard
fun MatrixLike.cholesky(policy: CholeskyPolicy = CholeskyPolicy.Strict): DenseMatrix

Lower-triangular Cholesky decomposition A = L * LT, returned as a fresh matrix, from the installed backend; see Lapack.cholesky.

Link copied to clipboard

det(A) from the factorization: sign(P) · ∏ U[k][k], or exactly 0.0 when LuDecomposition.singular. The floating-point counterpart of SparseLu.determinant.

Link copied to clipboard
fun invert(lu: LuDecomposition, workspace: Workspace? = null): DenseMatrix

A⁻¹ from an LU factorization (LAPACK dgetri); see LinearAlgebra.invert.

Link copied to clipboard
fun invertSpd(L: DenseMatrix, workspace: Workspace? = null): DenseMatrix

Invert an SPD matrix from its Cholesky factor; see Lapack.invertSpd.

Link copied to clipboard

LU-factorize this square matrix with the active backend (koblas).

Link copied to clipboard

Matrix-matrix product this · other with the active backend.

Link copied to clipboard
fun LuDecomposition.solve(b: DoubleArray, transpose: Boolean = false): DoubleArray

Solve A · x = b (or Aᵀ · x = b when transpose) for this factorization with the active backend.

Link copied to clipboard

Solve A * x = b given L = chol(A); see Lapack.solveSpd.

Link copied to clipboard
fun trmm(a: DenseMatrix, b: DenseMatrix, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false, right: Boolean = false)

Multiply B = op(T) · B, or B = B · op(T) when right (BLAS dtrmm); see LinearAlgebra.trmm.

Link copied to clipboard
fun trmv(a: DenseMatrix, x: DoubleArray, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false)

Multiply x = op(T) · x in place (BLAS dtrmv); see LinearAlgebra.trmv.

Link copied to clipboard
fun trsm(a: DenseMatrix, b: DenseMatrix, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false, right: Boolean = false)

Solve op(T) · X = B, or X · op(T) = B when right (BLAS dtrsm); see LinearAlgebra.trsm.

Link copied to clipboard
fun trsv(a: DenseMatrix, x: DoubleArray, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false)

Solve op(T) · x = b in place (BLAS dtrsv); see LinearAlgebra.trsv.

Link copied to clipboard
fun trtri(a: DenseMatrix, lower: Boolean, unitDiag: Boolean = false): DenseMatrix

Invert the lower or upper triangle of a (LAPACK dtrtri); see LinearAlgebra.trtri.