pub trait SparseLuKernels<R: Runtime> {
// Required methods
fn scatter_column(
&self,
values: &[f64],
row_indices: &[i64],
work: &mut [f64],
);
fn sparse_axpy(
&self,
scale: f64,
values: &[f64],
row_indices: &[i64],
work: &mut [f64],
);
fn find_pivot(&self, work: &[f64], start: usize, end: usize) -> (usize, f64);
fn gather_and_clear(
&self,
work: &mut [f64],
row_indices: &[i64],
output: &mut [f64],
);
fn divide_by_pivot(&self, work: &mut [f64], row_indices: &[i64], pivot: f64);
fn swap_rows(
&self,
work: &mut [f64],
perm: &mut [usize],
row_a: usize,
row_b: usize,
);
}Expand description
Low-level kernel operations for sparse LU
These are the primitive operations that benefit from SIMD/GPU acceleration. Higher-level factorization algorithms compose these kernels.
Required Methods§
Sourcefn scatter_column(&self, values: &[f64], row_indices: &[i64], work: &mut [f64])
fn scatter_column(&self, values: &[f64], row_indices: &[i64], work: &mut [f64])
Scatter sparse column into dense work vector
work[row_indices[i]] = values[i] for i in 0..nnz
§Arguments
values- Sparse column valuesrow_indices- Row indices for each valuework- Dense work vector (length n), modified in place
Sourcefn sparse_axpy(
&self,
scale: f64,
values: &[f64],
row_indices: &[i64],
work: &mut [f64],
)
fn sparse_axpy( &self, scale: f64, values: &[f64], row_indices: &[i64], work: &mut [f64], )
Sparse AXPY: work[indices] -= scale * values
For each i: work[row_indices[i]] -= scale * values[i]
§Arguments
scale- Scalar multipliervalues- Sparse vector valuesrow_indices- Row indices for each valuework- Dense work vector, modified in place
Sourcefn find_pivot(&self, work: &[f64], start: usize, end: usize) -> (usize, f64)
fn find_pivot(&self, work: &[f64], start: usize, end: usize) -> (usize, f64)
Find index of maximum absolute value in work[start..end]
Returns (index, max_abs_value) where index is in [start, end)
§Arguments
work- Dense work vectorstart- Start index (inclusive)end- End index (exclusive)
Sourcefn gather_and_clear(
&self,
work: &mut [f64],
row_indices: &[i64],
output: &mut [f64],
)
fn gather_and_clear( &self, work: &mut [f64], row_indices: &[i64], output: &mut [f64], )
Gather nonzeros from work vector into sparse output
output[i] = work[row_indices[i]] for i in 0..nnz
Then: work[row_indices[i]] = 0.0 (clear for next column)
§Arguments
work- Dense work vector, cleared after gatherrow_indices- Row indices to gatheroutput- Output sparse values