pub struct MixedPreconditionedCg { /* private fields */ }Expand description
Mixed CPU/GPU preconditioned conjugate gradient solver.
The preconditioner (ILU(0)) runs entirely on CPU; SpMV is the hot path
that would execute on GPU in a real deployment. In this pure-Rust
implementation SpMV uses GpuPrecondCsr::spmv, which simulates the GPU
compute path without an actual GPU dependency.
Implementations§
Source§impl MixedPreconditionedCg
impl MixedPreconditionedCg
Sourcepub fn new(a: &GpuPrecondCsr, max_iter: usize, tol: f64) -> SparseResult<Self>
pub fn new(a: &GpuPrecondCsr, max_iter: usize, tol: f64) -> SparseResult<Self>
Create a new solver, pre-computing ILU(0) from matrix a.
§Errors
Propagates any error from Ilu0Preconditioner::compute.
Sourcepub fn solve(
&self,
a: &GpuPrecondCsr,
b: &Array1<f64>,
) -> SparseResult<(Array1<f64>, usize)>
pub fn solve( &self, a: &GpuPrecondCsr, b: &Array1<f64>, ) -> SparseResult<(Array1<f64>, usize)>
Solve Ax = b using preconditioned CG (Fletcher-Reeves with ILU(0)).
Returns (x, iterations_used).
§Errors
Returns SparseError::ValueError if b.len() != a.nrows.
Auto Trait Implementations§
impl Freeze for MixedPreconditionedCg
impl RefUnwindSafe for MixedPreconditionedCg
impl Send for MixedPreconditionedCg
impl Sync for MixedPreconditionedCg
impl Unpin for MixedPreconditionedCg
impl UnsafeUnpin for MixedPreconditionedCg
impl UnwindSafe for MixedPreconditionedCg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more