pub struct AndersonAccelerator<F: IntegrateFloat> { /* private fields */ }Expand description
Anderson accelerator for fixed-point iterations
Accelerates iterations of the form x_{k+1} = G(x_k) by maintaining a history of iterates and residuals, then solving a least-squares problem to find optimal linear combination coefficients.
Implementations§
Source§impl<F: IntegrateFloat> AndersonAccelerator<F>
impl<F: IntegrateFloat> AndersonAccelerator<F>
Sourcepub fn new(dimension: usize, options: AcceleratorOptions<F>) -> Self
pub fn new(dimension: usize, options: AcceleratorOptions<F>) -> Self
Create a new Anderson accelerator
Sourcepub fn with_memory_depth(_dimension: usize, memorydepth: usize) -> Self
pub fn with_memory_depth(_dimension: usize, memorydepth: usize) -> Self
Create accelerator with default options
Sourcepub fn accelerate(
&mut self,
x_current: ArrayView1<'_, F>,
g_x_current: ArrayView1<'_, F>,
) -> Option<Array1<F>>
pub fn accelerate( &mut self, x_current: ArrayView1<'_, F>, g_x_current: ArrayView1<'_, F>, ) -> Option<Array1<F>>
Add a new iterate and return accelerated update if possible
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Get current memory usage (number of stored iterates)
Sourcepub fn iteration_count(&self) -> usize
pub fn iteration_count(&self) -> usize
Get iteration count
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for AndersonAccelerator<F>where
F: Freeze,
impl<F> RefUnwindSafe for AndersonAccelerator<F>where
F: RefUnwindSafe,
impl<F> Send for AndersonAccelerator<F>where
F: Send,
impl<F> Sync for AndersonAccelerator<F>where
F: Sync,
impl<F> Unpin for AndersonAccelerator<F>where
F: Unpin,
impl<F> UnwindSafe for AndersonAccelerator<F>where
F: UnwindSafe + 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