koblas

CblasVectorKernels

class CblasVectorKernels : VectorKernels(source)

The host OpenBLAS behind koblas's level-1 primitives, for the runs long enough to be worth a call.

The com.eignex.koblas.dense.LinearAlgebra seam does not reach dot, axpy and scale: those compile per target and, on native, are scalar loops measured 4x to 7x slower than the JVM's SIMD ones. Registering this closes that gap for long vectors, which is where a simplex spends its level-1 time — the public dot/axpy/scale and the eta-file ftran/btran both bottom out in these calls with no other seam above them. koblas applies com.eignex.koblas.DispatchThresholds.level1, so these methods only ever see runs worth dispatching.

Offsets are handled by pinning and taking the address of the element, so no repacking happens at the boundary — the same zero-copy property the rest of this backend relies on.

Constructors

CblasVectorKernels

constructor()(source)

Properties

name

open override val name: String(source)

A short backend identifier for diagnostics (e.g. "reference").

priority

open override val priority: Int(source)

Above the reference (0), matching the other cblas halves.

Functions

asum

open override fun asum(v: DoubleArray, vOff: Int, len: Int): Double(source)

Sum |v[vOff..vOff+len-1]|, with len >= 1 (BLAS dasum).

axpy

open override fun axpy(y: DoubleArray, yOff: Int, alpha: Double, x: DoubleArray, xOff: Int, len: Int)(source)

y[yOff..yOff+len-1] += alpha * x[xOff..xOff+len-1], with len >= 1.

dot

open override fun dot(a: DoubleArray, aOff: Int, b: DoubleArray, bOff: Int, len: Int): Double(source)

Sum a[aOff..aOff+len-1] * b[bOff..bOff+len-1], with len >= 1.

nrm2

open override fun nrm2(v: DoubleArray, vOff: Int, len: Int): Double(source)

Euclidean norm of v[vOff..vOff+len-1], with len >= 1 (BLAS dnrm2).

Must be accurate for components whose squares overflow or underflow — koblas's built-in kernel rescales to stay in range, and netlib dnrm2 does the same, so a plain sqrt(sum of squares) is not a valid implementation.

scale

open override fun scale(v: DoubleArray, vOff: Int, alpha: Double, len: Int)(source)

v[vOff..vOff+len-1] *= alpha, with len >= 1.

Link copied to clipboard
open fun dot4(a: DoubleArray, aOff: Int, stride: Int, b: DoubleArray, bOff: Int, len: Int, out: DoubleArray, outOff: Int)

Four dots against a shared right operand: out[outOff + r] = Sum a[aOff + r*stride + i] * b[bOff + i] for r in 0..3. Four columns of a column-major matrix against one vector, which is the shape gemv and the Aᵀ·B gemm branch need.