Skip to main content

Poly

Struct Poly 

Source
pub struct Poly<I, T> { /* private fields */ }
Expand description

Polynomial preconditioner M^{-1} = p(A).

Stores an owned copy of A and the polynomial coefficients. Apply is a sequence of sparse matvecs and vector updates with no triangular solves and no heap allocation. See the module documentation for guidance.

Implementations§

Source§

impl<I: Index, T: ComplexField> Poly<I, T>

Source

pub fn try_new( a: SparseColMatRef<'_, I, T>, params: PolyParams, ) -> Result<Self, PolyError>

Build a polynomial preconditioner with an explicit PolyKind.

§Errors
Source

pub fn try_new_auto( a: SparseColMatRef<'_, I, T>, degree: usize, estimate: BoundEstimate, ) -> Result<Self, PolyError>

Build a Chebyshev preconditioner, estimating the spectral interval with estimate.

Chebyshev acceleration is only as good as its bounds; see BoundEstimate. For precise control pass BoundEstimate::Manual or use Poly::try_new with PolyKind::Chebyshev.

§Errors

As Poly::try_new, plus PolyError::InvalidBounds if the estimate does not yield a usable 0 < lambda_min < lambda_max.

Source

pub fn refactorize( &mut self, a: SparseColMatRef<'_, I, T>, ) -> Result<(), PolyError>

Refactorise against a new matrix with the same sparsity pattern.

Updates the stored operator values in place. If the preconditioner was built via Poly::try_new_auto, the spectral bounds are re-estimated from the new values; otherwise the original PolyKind is retained.

§Errors

PolyError::PatternMismatch if a’s shape or column lengths disagree with the stored pattern.

Source§

impl<I, T> Poly<I, T>

Source

pub fn dim(&self) -> usize

Dimension n of the preconditioner.

Source

pub fn degree(&self) -> usize

Polynomial degree (number of matvecs per apply).

Trait Implementations§

Source§

impl<I, T> BiLinOp<T> for Poly<I, T>
where I: Index, T: ComplexField + Debug + Sync,

Source§

fn transpose_apply_scratch(&self, rhs_ncols: usize, _par: Par) -> StackReq

computes the workspace layout required to apply the transpose or adjoint o self to a matrix with rhs_ncols columns
Source§

fn transpose_apply( &self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack, )

applies the transpose of self to rhs, and stores the result in out
Source§

fn adjoint_apply( &self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack, )

applies the adjoint of self to rhs, and stores the result in out
Source§

impl<I, T> BiPrecond<T> for Poly<I, T>
where I: Index, T: ComplexField + Debug + Sync,

Source§

fn transpose_apply_in_place_scratch( &self, rhs_ncols: usize, _par: Par, ) -> StackReq

computes the workspace layout required to apply the transpose or adjoint of self to a matrix with rhs_ncols columns in place
Source§

fn transpose_apply_in_place( &self, rhs: MatMut<'_, T>, par: Par, stack: &mut MemStack, )

applies the transpose of self to rhs, and stores the result in rhs
Source§

fn adjoint_apply_in_place( &self, rhs: MatMut<'_, T>, par: Par, stack: &mut MemStack, )

applies the adjoint of self to rhs, and stores the result in rhs
Source§

impl<I: Clone, T: Clone> Clone for Poly<I, T>

Source§

fn clone(&self) -> Poly<I, T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<I: Debug, T: Debug> Debug for Poly<I, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<I, T> LinOp<T> for Poly<I, T>
where I: Index, T: ComplexField + Debug + Sync,

Source§

fn apply_scratch(&self, rhs_ncols: usize, _par: Par) -> StackReq

computes the workspace layout required to apply self or the conjugate o self to a matrix with rhs_ncols columns
Source§

fn nrows(&self) -> usize

output dimension of the operator
Source§

fn ncols(&self) -> usize

input dimension of the operator
Source§

fn apply( &self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack, )

applies self to rhs, and stores the result in out
Source§

fn conj_apply( &self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack, )

applies the conjugate of self to rhs, and stores the result in out
Source§

impl<I, T> Precond<T> for Poly<I, T>
where I: Index, T: ComplexField + Debug + Sync,

Source§

fn apply_in_place_scratch(&self, rhs_ncols: usize, _par: Par) -> StackReq

computes the workspace layout required to apply self or the conjugate of self to a matrix with rhs_ncols columns in place
Source§

fn apply_in_place(&self, rhs: MatMut<'_, T>, par: Par, stack: &mut MemStack)

applies self to rhs, and stores the result in rhs
Source§

fn conj_apply_in_place( &self, rhs: MatMut<'_, T>, par: Par, stack: &mut MemStack, )

applies the conjugate of self to rhs, and stores the result in rhs

Auto Trait Implementations§

§

impl<I, T> Freeze for Poly<I, T>
where T: Freeze,

§

impl<I, T> RefUnwindSafe for Poly<I, T>

§

impl<I, T> Send for Poly<I, T>
where T: Send, I: Send,

§

impl<I, T> Sync for Poly<I, T>
where T: Sync, I: Sync,

§

impl<I, T> Unpin for Poly<I, T>
where T: Unpin, I: Unpin,

§

impl<I, T> UnsafeUnpin for Poly<I, T>
where T: UnsafeUnpin,

§

impl<I, T> UnwindSafe for Poly<I, T>
where T: UnwindSafe, I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V