Skip to main content

Module vector

Module vector 

Source
Expand description

§Vector Mathematics Module - High-Performance BLAS-Compatible Vector Operations

This module provides a streamlined set of vector operations without the need for BLAS/LAPACK linking. It includes SIMD-accelerated arms where appropriate.

§Usage Examples

§Basic Linear Algebra

use minarrow::vec64;
use crate::kernels::scientific::vector::{dot, scale, axpy, l2_norm};

let x = vec64![1.0, 2.0, 3.0, 4.0];
let mut y = vec64![5.0, 6.0, 7.0, 8.0];

// Dot product computation
let result = dot(&x, &y, None, None);

// In-place vector scaling
scale(&mut y, 2.0, None, None);

// Scaled addition: y ← 2.0 * x + y
axpy(4, 2.0, &x, 1, &mut y, 1, None, None)?;

// Euclidean norm
let norm = l2_norm(&x, None, None);

Constants§

W8
Auto-generated SIMD lane widths from build.rs SIMD lane count for 8-bit elements (u8, i8). Determined at build time based on target architecture capabilities, or overridden via SIMD_LANES_OVERRIDE.
W16
SIMD lane count for 16-bit elements (u16, i16). Determined at build time based on target architecture capabilities, or overridden via SIMD_LANES_OVERRIDE.
W32
SIMD lane count for 32-bit elements (u32, i32, f32). Determined at build time based on target architecture capabilities, or overridden via SIMD_LANES_OVERRIDE.
W64
SIMD lane count for 64-bit elements (u64, i64, f64). Determined at build time based on target architecture capabilities, or overridden via SIMD_LANES_OVERRIDE.

Functions§

argsort
Computes a stable key-based argsort of indices
axpy
Scaled vector addition: y ← α·x + y
dot
Computes the dot product with another vector, propagating nulls via an optional Bitmask.
histogram
Bins values into histogram buckets.
l2_norm
Computes the L2 norm (‖x‖₂)
reservoir_sample
Uniform reservoir sampling of size k.
scale
Scales the vector in place: x ← αx Kernel: SCAL (L2-2)
scale_vec
In-place vector scaling: x ← α·x
vector_norm
Computes the Euclidean (ℓ₂) norm of a vector: ‖x‖₂ = sqrt(Σ xᵢ²)