koblas

F64Kernels

The vector-vector routines as a backend half, alongside F64Blas and F64Decompositions. Implementations must agree with F64PlatformKernels to within rounding and read nothing outside the (offset, length) window.

To within rounding rather than exactly, because bit-for-bit is not a contract these routines can hold: F64PlatformKernels itself fuses its multiply-add above one lane width and does not below it, and reduces over lanes as a tree rather than in order. Two conforming implementations can differ in the last bits of a sum, and the reference routines are written not to depend on which one they got.

A length of zero is legal everywhere and does nothing: the triangular and Householder kernels reach the last row with an empty tail, so every routine here is called that way.

Inheritors

F64CblasKernels
F64CblasKernels

Properties

minDispatchLength

The run length from which this backend replaces the compiled-in kernels, or null for the platform default.

Link copied to clipboard

Whether this backend can do work on this host. koblas's own implementations always can, so the default is true; a binding reports whether the library it calls resolved.

Link copied to clipboard

Whether this is koblas's own implementation rather than a binding to a host library. The compiled-in SIMD kernels are portable however fast they are; only something calling out counts as accelerated.

Link copied to clipboard
abstract val name: String

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

Link copied to clipboard
open val priority: Int

Relative preference among the backends offered for one half (F64Blas, F64Decompositions, F64Kernels or a sparse counterpart). registerBackend picks the highest; the portable reference is 0.

Functions

asum

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

Sum of the absolute values of the len entries from vOff (BLAS dasum); 0 for an empty run.

axpy

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

Adds alpha * x(xOff + i) into y(yOff + i) over the first len entries.

dot

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

Sum of a(aOff + i) * b(bOff + i) over the first len entries; 0 for an empty run.

dot4

open fun dot4(a: DoubleArray, aOff: Int, stride: Int, b: DoubleArray, bOff: Int, len: Int, out: DoubleArray, outOff: Int)(source)

Four dots against a shared right operand. For r in 0..3, out(outOff + r) is the dot of the run at aOff + r * stride with the run at bOff. Defaults to four dot calls, so an implementation that can read the shared operand once for all four should override it.

nrm2

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

Euclidean norm of the len entries from vOff (BLAS dnrm2), 0 for an empty run. Must rescale to stay in range, so a plain sqrt(sum of squares) is not a valid implementation.

scale

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

Scales the len entries from vOff by alpha.

swap

open fun swap(a: DoubleArray, aOff: Int, b: DoubleArray, bOff: Int, len: Int)(source)

Exchange the two runs (BLAS dswap). Two loads and two stores an element, so an implementation is bound by memory rather than by issue rate; the default is the plain loop for that reason.

symvColumn

open fun symvColumn(a: DoubleArray, aOff: Int, x: DoubleArray, xOff: Int, y: DoubleArray, yOff: Int, mult: Double, len: Int): Double(source)

Adds mult * a(k) into y and returns the dot of the same run with x, in one pass. A symmetric product needs both halves of every column, and one pass reads the column once rather than twice.

symvColumn4

open fun symvColumn4(a: DoubleArray, aOff: Int, stride: Int, x: DoubleArray, xOff: Int, y: DoubleArray, yOff: Int, mult: DoubleArray, out: DoubleArray, len: Int)(source)

Four symvColumn runs at aOff + r * stride, their dots landing in out(r). Defaults to four calls, so an implementation that can read x and y once for all four should override it.