KoblasEngine
An immutable dense and sparse BLAS engine.
The default koblas instance is selected once for the platform. Tests and benchmarks can construct an exact scalar, C, or SIMD composition from BuiltinEngines without changing process-global state. Each composition binds its dense vector, dense panel, packed tile, indexed sparse, and sparse panel kernels once.
Properties
name
nativeVariant
Ordinary C variant bound to native components; policy calls may retain in-runtime arithmetic.
packedKernels
Packed layout shape and tile arithmetic kernels.
packedPanels
Packed panel operations bound to this engine's exact packed kernels.
panelKernels
Dense matrix-panel arithmetic kernels.
sparseKernels
Sparse-vector kernels used by sparse convenience operations.
tuningDiagnostics
Malformed performance overrides retained as read-only diagnostic messages.
vectorKernels
Standalone contiguous dense-vector kernels.
Functions
explain
Describes the selected implementation without performing arithmetic. length is the vector/panel length, product-tile depth, or standalone solve order. Semantic no-work exits still precede execution. Native IDs and layouts identify the selected component. Runtime descriptions identify scalar stages and potential data-dependent or stride fallbacks; inspecting length does not inspect operand values.
toString
Fresh CSC alpha · op(A) + B. The structural union is retained, including explicit zeros, cancellations, and A-only positions when alpha is zero. Zero alpha does not read A's values; B values are copied. Output rows are strictly ascending and all arrays are independently owned.
gemm with alpha = 1, beta = 0, into a fresh matrix. A.cols must equal B.rows.
gemm over borrowed panels into a fresh owned matrix.
gemm over borrowed column-major panels. c must not overlap either input; disjoint panels may share a backing buffer. Implementations must preserve each physical leading dimension without copying.
C = alpha · op(A) · op(B) + beta · C (BLAS dgemm), with shapes op(A): m×k, op(B): k×n, C: m×n. beta == 0.0 overwrites c without reading it. workspace reuses any needed transpose packing.
gemm with alpha = 1, beta = 0, into a fresh matrix. A.cols must equal B.rows.
C = A · B for two sparse operands, into a fresh matrix.
Fresh CSC alpha · op(A) · op(B). Product support is discovered from stored positions, including explicit zeros, retained cancellations, and underflowed values; rows are sorted within every column and all result arrays are owned. When alpha == 0.0, the same structure is discovered without reading operand values and filled with alpha's signed zero.
Direct dense-destination C = alpha · op(A) · op(B) + beta · C for two sparse operands. No sparse intermediate is created and implicit sparse zeros are not evaluated. alpha == 0.0 reads neither sparse operand's values; beta == 0.0 does not read c. Sparse value buffers shared with c are staged using workspace.
C = alpha · op(A) · op(B) + beta · C in only the selected triangle (Netlib GEMMTR, commonly exposed as gemmt). op(A) is n×k, op(B) is k×n, and c is n×n. The opposite triangle is neither read nor written. alpha == 0.0 does not read either input and beta == 0.0 does not read selected destination entries. If c shares either input buffer, workspace supplies reusable staging.
gemv with alpha = 1, beta = 0, into a fresh result.
gemv over borrowed storage into a fresh owned array.
gemv over borrowed strided storage. The destination must not overlap a or x; disjoint views may share one backing buffer. Implementations may pass offsets, strides, and leading dimensions directly to BLAS and must not materialize a contiguous copy. Like BLAS dgemv, a zero row or column count returns without reading or changing y.
y = alpha · op(A) · x + beta · y (BLAS dgemv), with op(A) being Aᵀ when transpose. beta == 0.0 overwrites y without reading it.
A · x, or Aᵀ · x when transpose, into a fresh result.
A = A + alpha · x · yᵀ (BLAS dger), the dense form a backend can dispatch. The free ger accepts VectorStorage operands and takes a sparse fast path.
Copies a into an immutable snapshot for repeated products.
C = alpha · A · B + beta · C, or C = alpha · B · A + beta · C when right (BLAS dsymm). Only the lower triangle of a is read; beta == 0.0 overwrites c without reading it. workspace reuses the packed operand panels and edge tile.
C = alpha · A · B + beta · C, or C = alpha · B · A + beta · C when right, interpreting square sparse a as symmetric from exactly its selected lower or upper triangle. alpha == 0.0 reads neither input; beta == 0.0 does not read c. Shared input/destination buffers are staged, with workspace reused when supplied.
y = alpha · A · x + beta · y for a symmetric a (BLAS dsymv). Only the lower triangle is read, diagonal included; beta == 0.0 overwrites y without reading it.
y = alpha · A · x + beta · y for a square sparse a interpreted as symmetric. Exactly the selected lower or upper stored triangle is read; the other triangle and implicit zeros are ignored. A stored off-diagonal entry contributes to both mirrored positions. alpha == 0.0 reads neither a nor x, and beta == 0.0 overwrites y without reading it. Aliasing x with y, or a's values with y, is supported through internal staging.
C = alpha · A·Aᵀ + beta · C, or alpha · Aᵀ·A + beta · C when transpose (BLAS dsyrk). Only the lower or upper triangle is written; beta == 0.0 overwrites it without reading.
Fresh CSC selected triangle of op(A) · op(A)ᵀ. Stored-product support and cancellations are retained, rows are sorted, and result arrays are owned. The opposite triangle is absent rather than implicitly mirrored; consume the result with symv or symm when symmetric meaning is intended.
Fresh transposed a. For a product prefer the transpose flags on gemv and gemm, which avoid a caller-visible intermediate; this is for a caller that means to hold the transpose.
Fresh transposed a, still CSC, which makes this the CSC-to-CSR conversion as well. Explicitly stored zeros survive, since the transpose is structural rather than arithmetic.
B = alpha · op(T) · B, or B = alpha · B · op(T) when right (BLAS dtrmm), the counterpart of trsm. workspace reuses portable staging.
x = op(T) · x in place (BLAS dtrmv), the product counterpart of trsv.
B = alpha · op(T)⁻¹ · B in place, or B = alpha · B · op(T)⁻¹ when right (BLAS dtrsm). Flags follow trsv; the right-hand sides are the columns of b from the left and its rows from the right. workspace reuses portable staging.
B = alpha · op(T)⁻¹ · B in place, or B = alpha · B · op(T)⁻¹ when right (Sparse BLAS ussm). The triangle flags follow trsv; the right-hand sides are the columns of b from the left and its rows from the right. workspace reuses portable diagonal and RHS-panel staging. A missing diagonal entry behaves as zero, and singularity is not reported, as in dense dtrsm.
Solve op(T) · x = b in place (BLAS dtrsv) for the lower or upper triangle of the square a, op transposing when transpose and unitDiag taking the diagonal as 1. x carries b in and x out.