koblas

DenseVectorKernels

Contiguous dense Level 1 operations that are independently useful outside matrix algorithms. Implementations must read and write only the array windows selected by their offsets and lengths. Callers must supply non-negative lengths and valid windows; implementations need not validate them. A zero length is legal for every operation that accepts one and produces the documented empty result without reading either array.

Results agree to within rounding rather than bit for bit: compiled leaves may fuse multiplication and addition or reduce vector lanes as a tree. Shared algorithms must not depend on the final rounding order.

Properties

name

abstract val name: String(source)

Short implementation identifier for diagnostics.

Functions

asum

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

Sum of absolute values over len entries, or zero 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 len entries. A zero alpha returns without evaluating the products, as required by standalone BLAS AXPY semantics.

dot

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

Returns sum(a[aOff + i] * b[bOff + i]) over len entries, or zero for an empty run.

iamax

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

Zero-based index within the selected run of its first maximum absolute value, or -1 when empty. NaNs are ignored; nonempty runs containing only zeros and NaNs return 0.

nrm2

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

Returns the rescaled Euclidean norm over len entries, or zero for an empty run. Implementations must avoid the avoidable overflow and underflow of a plain square-sum followed by a square root.

rot

abstract fun rot(x: DoubleArray, xOff: Int, y: DoubleArray, yOff: Int, len: Int, c: Double, s: Double)(source)

Applies the plane rotation (c, s, -s, c) to two contiguous runs. Each pair is loaded before either result is stored. Equal runs are therefore safe, but callers must snapshot any other overlap whose stores could precede a later input load.

rotm

abstract fun rotm(x: DoubleArray, xOff: Int, xStride: Int, y: DoubleArray, yOff: Int, yStride: Int, len: Int, transformation: ModifiedGivens)(source)

Applies a modified Givens transformation to two strided runs. Each pair is loaded before either result is stored. Equal runs are therefore safe, but callers must snapshot any other overlap whose stores could precede a later input load.

rotmg

abstract fun rotmg(d1: Double, d2: Double, x1: Double, y1: Double): ModifiedGivens(source)

Constructs a modified Givens transformation.

scale

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

Scales len entries in v by alpha.

ssqd

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

Returns sum((a[aOff + i] - b[bOff + i])^2) over len entries, or zero for an empty run. This is a single-pass squared distance and may overflow; it does not inherit the rescaling contract of nrm2.

sum

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

Returns the plain sum over len entries, or zero for an empty run. This is not compensated summation; compiled leaves may reduce vector lanes as a tree.

swap

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

Exchanges len entries of the two runs.