koblas

DenseBlas

interface DenseBlas(source)

Dense matrix routines bound to one immutable kernel implementation.

Inheritors

Functions

gemm

abstract fun gemm(alpha: Double, a: DenseMatrix, transposeA: Boolean, b: DenseMatrix, transposeB: Boolean, beta: Double, c: DenseMatrix, workspace: Workspace? = null)(source)

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.


open fun gemm(alpha: Double, a: StridedMatrixView, transposeA: Boolean, b: StridedMatrixView, transposeB: Boolean, beta: Double, c: StridedMatrixView)(source)

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.


gemm over borrowed panels into a fresh owned matrix.

gemmt

abstract fun gemmt(alpha: Double, a: DenseMatrix, transposeA: Boolean, b: DenseMatrix, transposeB: Boolean, beta: Double, c: DenseMatrix, lower: Boolean = true, workspace: Workspace? = null)(source)

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

abstract fun gemv(alpha: Double, a: DenseMatrix, x: DoubleArray, beta: Double, y: DoubleArray, transpose: Boolean = false, workspace: Workspace? = null)(source)

y = alpha · op(A) · x + beta · y (BLAS dgemv), with op(A) being Aᵀ when transpose. beta == 0.0 overwrites y without reading it.


open fun gemv(a: DenseMatrix, x: DoubleArray, transpose: Boolean = false): DoubleArray(source)

gemv with alpha = 1, beta = 0, into a fresh result.


open fun gemv(alpha: Double, a: StridedMatrixView, x: StridedVectorView, beta: Double, y: StridedVectorView, transpose: Boolean = false)(source)

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.


open fun gemv(a: StridedMatrixView, x: StridedVectorView, transpose: Boolean = false): DoubleArray(source)

gemv over borrowed storage into a fresh owned array.

ger

abstract fun ger(alpha: Double, x: DoubleArray, y: DoubleArray, a: DenseMatrix)(source)

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.

symm

abstract fun symm(alpha: Double, a: DenseMatrix, b: DenseMatrix, beta: Double, c: DenseMatrix, lower: Boolean = true, right: Boolean = false, workspace: Workspace? = null)(source)

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.

symv

abstract fun symv(alpha: Double, a: DenseMatrix, x: DoubleArray, beta: Double, y: DoubleArray, lower: Boolean = true)(source)

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.

syr

abstract fun syr(alpha: Double, x: Vector, a: DenseMatrix, lower: Boolean = true)(source)

A += alpha · x · xᵀ (BLAS dsyr), writing only the lower or upper triangle.

syr2

abstract fun syr2(alpha: Double, x: Vector, y: Vector, a: DenseMatrix, lower: Boolean = true)(source)

A += alpha · (x · yᵀ + y · xᵀ) (BLAS dsyr2), writing only the lower or upper triangle.

syr2k

abstract fun syr2k(alpha: Double, a: DenseMatrix, b: DenseMatrix, transpose: Boolean, beta: Double, c: DenseMatrix, lower: Boolean = true, workspace: Workspace? = null)(source)

C = alpha · (op(A) · op(B)ᵀ + op(B) · op(A)ᵀ) + beta · C (BLAS dsyr2k), where op transposes when transpose. Writes only the lower or upper triangle; beta == 0.0 overwrites it without reading.

In the non-transposed form, a rank step is skipped only when both output-column coefficients are zero, following Netlib dsyr2k; the transposed form evaluates both products. Pass a workspace to reuse the packed panels and diagonal tile.

syrk

abstract fun syrk(alpha: Double, a: DenseMatrix, transpose: Boolean, beta: Double, c: DenseMatrix, lower: Boolean = true, workspace: Workspace? = null)(source)

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.

In the non-transposed form, a zero entry used as the rank-one multiplier is skipped before it can multiply an infinity, following Netlib dsyrk; the transposed dot-product form evaluates that product. Pass a workspace to reuse the packed panels and diagonal tile.

transpose

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.

On the seam rather than beside the other whole-matrix operations because a library has its own routine for it, omatcopy in the BLAS-like extensions, where the standard has none.

trmm

abstract fun trmm(a: DenseMatrix, b: DenseMatrix, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false, right: Boolean = false, alpha: Double = 1.0, workspace: Workspace? = null)(source)

B = alpha · op(T) · B, or B = alpha · B · op(T) when right (BLAS dtrmm), the counterpart of trsm. workspace reuses portable staging.

trmv

abstract fun trmv(a: DenseMatrix, x: DoubleArray, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false)(source)

x = op(T) · x in place (BLAS dtrmv), the product counterpart of trsv.

trsm

abstract fun trsm(a: DenseMatrix, b: DenseMatrix, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false, right: Boolean = false, alpha: Double = 1.0, workspace: Workspace? = null)(source)

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.

trsv

abstract fun trsv(a: DenseMatrix, x: DoubleArray, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false)(source)

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.

The diagonal is divided by, not tested: dtrsv carries no info and reports nothing, so a singular triangle yields infinities or NaNs and the caller who needs the distinction tests the diagonal first. The sparse com.eignex.koblas.sparse.SparseBlas.trsv follows the same rule.