Skip to main content

VectorSource

Trait VectorSource 

Source
pub trait VectorSource<F>: Sync {
    // Required methods
    fn len(&self) -> usize;
    fn is_empty(&self) -> bool;
    fn get_at(&self, index: usize) -> F;

    // Provided methods
    fn get_batch<const N: usize>(&self, indices: &[usize; N]) -> [F; N] { ... }
    fn prefetch(&self, _indices: &[usize]) { ... }
}
Expand description

Abstract source of a vector for Matrix-Vector multiplication. Allows using both dense slices (RAM) and algorithmic generators (JIT).

Required Methods§

Source

fn len(&self) -> usize

Get the length of the virtual vector.

Source

fn is_empty(&self) -> bool

Source

fn get_at(&self, index: usize) -> F

Get the element at the specified index.

Provided Methods§

Source

fn get_batch<const N: usize>(&self, indices: &[usize; N]) -> [F; N]

Optimized batch fetch. Allows the source to use pipelining.

Source

fn prefetch(&self, _indices: &[usize])

Software prefetching hook.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<F: Copy + Sync> VectorSource<F> for [F]

Implementation for standard slice access (Zero-Cost abstraction).

Source§

fn prefetch(&self, indices: &[usize])

Explicit prefetching implementation using Inline ASM.

Source§

fn len(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

fn get_at(&self, index: usize) -> F

Implementors§