pub struct IlukFactorization<T: GpuFloat> {
pub lu: CsrMatrix<T>,
pub diag_inv: Vec<T>,
pub fill_level: usize,
}Expand description
ILU(k) factorization result stored as combined L\U in CSR.
L is unit lower triangular (diagonal = 1, stored implicitly) and U is
upper triangular (diagonal stored explicitly). Both share the CSR storage
lu.
Fields§
§lu: CsrMatrix<T>Combined L\U factors in CSR format. Lower triangle contains L (without unit diagonal). Upper triangle (including diagonal) contains U.
diag_inv: Vec<T>Inverse of the diagonal of U, for efficient forward/backward solve.
fill_level: usizeThe fill level used to compute this factorization.
Implementations§
Source§impl<T: GpuFloat> IlukFactorization<T>
impl<T: GpuFloat> IlukFactorization<T>
Sourcepub fn compute(
_handle: &SparseHandle,
matrix: &CsrMatrix<T>,
config: &IlukConfig,
) -> SparseResult<Self>
pub fn compute( _handle: &SparseHandle, matrix: &CsrMatrix<T>, config: &IlukConfig, ) -> SparseResult<Self>
Compute ILU(k) from a CSR matrix.
§Arguments
_handle– Sparse handle (reserved for GPU path).matrix– Square CSR matrix to factor.config– ILU(k) configuration (fill level).
§Errors
Returns SparseError::DimensionMismatch if the matrix is not square.
Returns SparseError::SingularMatrix if a zero pivot is encountered.
Sourcepub fn apply(&self, r: &[T], z: &mut [T]) -> SparseResult<()>
pub fn apply(&self, r: &[T], z: &mut [T]) -> SparseResult<()>
Apply as preconditioner: solve (L*U)*z = r.
Forward solve L*y = r then backward solve U*z = y.
§Arguments
r– Right-hand side vector (host, length n).z– Output vector (host, length n).
§Errors
Returns SparseError::DimensionMismatch if vector lengths are wrong.