Skip to main content

cusparse_spsv

Function cusparse_spsv 

Source
pub fn cusparse_spsv(
    handle: &CusparseCompatHandle,
    fill_mode: FillMode,
    diag_type: DiagType,
    alpha: f64,
    a: &HostCsr,
    b: &[f64],
) -> SparseResult<Vec<f64>>
Expand description

Solves the triangular system A * x = alpha * b, mirroring cusparseSpSV.

A must be square and is interpreted as lower-triangular when fill_mode == FillMode::Lower (forward substitution) or upper-triangular when fill_mode == FillMode::Upper (backward substitution). Entries on the “wrong” side of the diagonal for the chosen fill_mode are ignored, as in cuSPARSE. With diag_type == DiagType::Unit the diagonal is treated as an implicit all-ones diagonal and any stored diagonal entries are not read.

The returned vector x has length A.nrows and satisfies A * x ≈ alpha * b (taking the configured triangle and diagonal mode into account).

§Errors

Returns SparseError::InvalidArgument if fill_mode == FillMode::Full (the solve requires a triangle), SparseError::DimensionMismatch if A is not square or b.len() != A.nrows, and SparseError::SingularMatrix if a needed diagonal entry is missing or numerically zero under DiagType::NonUnit.