pub struct AMGPreconditioner<T>{ /* private fields */ }
Expand description
AMG preconditioner implementation
Implementations§
Source§impl<T> AMGPreconditioner<T>
impl<T> AMGPreconditioner<T>
Sourcepub fn new(matrix: &CsrArray<T>, options: AMGOptions) -> SparseResult<Self>
pub fn new(matrix: &CsrArray<T>, options: AMGOptions) -> SparseResult<Self>
Create a new AMG preconditioner from a sparse matrix
§Arguments
matrix
- The coefficient matrixoptions
- AMG options
§Returns
A new AMG preconditioner
§Example
use scirs2_sparse::csr_array::CsrArray;
use scirs2_sparse::linalg::{AMGPreconditioner, AMGOptions};
// Create a simple matrix
let rows = vec![0, 0, 1, 1, 2, 2];
let cols = vec![0, 1, 0, 1, 1, 2];
let data = vec![2.0, -1.0, -1.0, 2.0, -1.0, 2.0];
let matrix = CsrArray::from_triplets(&rows, &cols, &data, (3, 3), false).unwrap();
// Create AMG preconditioner
let amg = AMGPreconditioner::new(&matrix, AMGOptions::default()).unwrap();
Sourcepub fn apply(&self, b: &ArrayView1<'_, T>) -> SparseResult<Array1<T>>
pub fn apply(&self, b: &ArrayView1<'_, T>) -> SparseResult<Array1<T>>
Sourcepub fn num_levels(&self) -> usize
pub fn num_levels(&self) -> usize
Get the number of levels in the hierarchy
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for AMGPreconditioner<T>
impl<T> RefUnwindSafe for AMGPreconditioner<T>where
T: RefUnwindSafe,
impl<T> Send for AMGPreconditioner<T>where
T: Send,
impl<T> Sync for AMGPreconditioner<T>where
T: Sync,
impl<T> Unpin for AMGPreconditioner<T>
impl<T> UnwindSafe for AMGPreconditioner<T>where
T: RefUnwindSafe,
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