Skip to main content

Module vector

Module vector 

Source
Expand description

§Vector operations for DSP

This module provides an embedded domain-specific language (eDSL) for vector operations optimised with SIMD instructions.

§Features

  • Basic vector types for f32 and f64 with various SIMD lane widths
  • Arithmetic operations (+, -, *, /, %)
  • Math functions (sin, cos, exp, ln, sqrt, …)
  • Automatic CPU SIMD capability detection

§Usage

use rill_core::vector::prelude::*;

let a = ScalarVector4::splat(1.0);
let b = ScalarVector4::splat(2.0);
let c = a + b;
assert_eq!(c, ScalarVector4::splat(3.0));

§Architecture

  • traits — core traits (Vector, VectorOps, VectorMath)
  • ops — arithmetic operator implementations
  • math — math function implementations
  • simd — SIMD backends for different architectures
  • scalar — scalar fallback implementations

§Supported platforms

  • x86/x86_64: SSE2, SSE4.1, AVX, AVX2, AVX512 (runtime detection)
  • ARM: NEON (AArch64)
  • WebAssembly: SIMD128
  • Scalar fallback for platforms without SIMD

Re-exports§

pub use macros::*;
pub use math::*;
pub use ops::*;
pub use scalar::*;
pub use traits::*;

Modules§

macros
Vector construction macros. Macros for convenient construction of vector expressions.
math
Vector math functions (sin, cos, etc.).
ops
Arithmetic operator implementations for vectors.
prelude
Convenience prelude for importing all vector types and traits.
scalar
Scalar fallback vector implementations.
simdx86 or x86-64
SIMD-accelerated vector implementations.
traits
Core vector traits (Vector, VectorTranscendental, etc.).