Skip to main content

SparseBackend

Trait SparseBackend 

Source
pub trait SparseBackend {
    // Required methods
    fn spmv_kernel(
        a: &CsrMatrix<f32>,
        alpha: f32,
        x: &[f32],
        beta: f32,
        y: &mut [f32],
    );
    fn spmm_kernel(
        a: &CsrMatrix<f32>,
        alpha: f32,
        b: &[f32],
        b_cols: usize,
        beta: f32,
        c: &mut [f32],
    );
}
Expand description

Backend dispatch trait for pluggable SIMD SpMV kernels.

Implementations provide SpMV for a specific hardware target. The default dispatch in SparseOps::spmv selects the best available backend at runtime.

Required Methods§

Source

fn spmv_kernel( a: &CsrMatrix<f32>, alpha: f32, x: &[f32], beta: f32, y: &mut [f32], )

Perform SpMV: y = alpha * A * x + beta * y using this backend.

Source

fn spmm_kernel( a: &CsrMatrix<f32>, alpha: f32, b: &[f32], b_cols: usize, beta: f32, c: &mut [f32], )

Perform SpMM: C = alpha * A * B + beta * C using this backend.

B is row-major with b_cols columns.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl SparseBackend for Avx2Backend

Available on x86-64 only.
Source§

impl SparseBackend for ScalarBackend