pub struct UniformBatchedSpMV<T> { /* private fields */ }Expand description
Optimised batched SpMV when all matrices share the same sparsity pattern.
Only the non-zero values differ between matrices; the row pointers and column indices are shared. This enables more efficient memory layout and potential vectorisation across the batch dimension.
Implementations§
Source§impl<T: GpuFloat + Add<Output = T> + Mul<Output = T> + AddAssign> UniformBatchedSpMV<T>
impl<T: GpuFloat + Add<Output = T> + Mul<Output = T> + AddAssign> UniformBatchedSpMV<T>
Sourcepub fn from_pattern(
pattern: &CsrMatrix<T>,
batch_values: Vec<Vec<T>>,
) -> SparseResult<Self>
pub fn from_pattern( pattern: &CsrMatrix<T>, batch_values: Vec<Vec<T>>, ) -> SparseResult<Self>
Create a uniform batch from a pattern matrix and per-batch values.
The pattern matrix supplies the shared structure (row_ptr, col_idx);
batch_values[i] supplies the non-zero values for the i-th matrix.
§Errors
Returns SparseError::InvalidArgument if batch_values is empty or
if any entry has the wrong length.
Returns SparseError::Cuda on download failure.
Sourcepub fn from_host_arrays(
rows: usize,
cols: usize,
row_ptr: Vec<i32>,
col_idx: Vec<i32>,
batch_values: Vec<Vec<T>>,
) -> SparseResult<Self>
pub fn from_host_arrays( rows: usize, cols: usize, row_ptr: Vec<i32>, col_idx: Vec<i32>, batch_values: Vec<Vec<T>>, ) -> SparseResult<Self>
Create a uniform batch from host-side arrays (no GPU required).
§Errors
Returns SparseError::InvalidArgument on dimension / length mismatch.
Sourcepub fn batch_size(&self) -> usize
pub fn batch_size(&self) -> usize
Number of matrices in the batch.
Sourcepub fn execute(
&self,
xs: &[Vec<T>],
ys: &mut [Vec<T>],
alpha: T,
beta: T,
) -> SparseResult<()>
pub fn execute( &self, xs: &[Vec<T>], ys: &mut [Vec<T>], alpha: T, beta: T, ) -> SparseResult<()>
Execute batched SpMV on the host.
§Errors
Returns SparseError::DimensionMismatch on vector size mismatch.
Trait Implementations§
Source§impl<T: Clone> Clone for UniformBatchedSpMV<T>
impl<T: Clone> Clone for UniformBatchedSpMV<T>
Source§fn clone(&self) -> UniformBatchedSpMV<T>
fn clone(&self) -> UniformBatchedSpMV<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more