Skip to main content

Crate nuvec_cpu

Crate nuvec_cpu 

Source
Expand description

Pure-Rust CPU kernels for nuvec.

Kernels work on typed slices and know nothing about arrays or graphs; nuvec-core dispatches to them. Inputs may have any layout (contiguous, transposed, sliced with negative steps, broadcast with zero strides); outputs are always row-contiguous.

Status: pre-alpha. Element-wise, reduction and matrix-multiplication kernels.

Structs§

MatView
A strided matrix: element (i, j) lives at data[offset + i·row_stride + j·col_stride].
View
A strided view of elements: element i (a multi-index) lives at data[offset + Σ i_k · strides_k].

Constants§

VERSION
The version of this crate.

Traits§

Gemm
An element type with a GEMM kernel: f32, f64, f16, and [f32; 2] (complex64 as (re, im)).

Functions§

collapse_dims
Merges adjacent dimensions that are contiguous for every operand and drops unit dimensions, so that common layouts iterate as one flat loop.
map1
Applies f element-wise: out[i] = f(a[i]) in row-major order of shape.
map2
Applies f element-wise: out[i] = f(a[i], b[i]) in row-major order of shape.
map3
Applies f element-wise: out[i] = f(a[i], b[i], c[i]) in row-major order of shape.
matmul
out = a · b for an m × k matrix a and a k × n matrix b; out is row-major m × n. Operands may have any strides (transposed, reversed, broadcast).
reduce
Folds blocks of elements: out[i] is the fold of the reduced block at output position i, starting from init. kept and reduced are (shape, strides) pairs that split the input’s dimensions; the output is row-major over kept.