Struct rgsl::types::series_acceleration::LevinUTruncWorkspace
source · [−]pub struct LevinUTruncWorkspace { /* private fields */ }
Expand description
The following functions perform the same calculation without estimating the errors. They require
O(N)
storage instead of O(N^2)
. This may be useful for summing many similar series where the
size of the error has already been estimated reliably and is not expected to change.
Implementations
sourceimpl LevinUTruncWorkspace
impl LevinUTruncWorkspace
sourcepub fn new(n: usize) -> Option<LevinUTruncWorkspace>
pub fn new(n: usize) -> Option<LevinUTruncWorkspace>
This function allocates a workspace for a Levin u-transform of n terms, without error estimation. The size of the workspace is O(3n).
sourcepub fn accel(&mut self, array: &[f64]) -> (Value, f64, f64)
pub fn accel(&mut self, array: &[f64]) -> (Value, f64, f64)
This function takes the terms of a series in array of size array_size and computes the extrapolated limit of the series using a Levin u-transform. Additional working space must be provided in w. The extrapolated sum is stored in sum_accel. The actual term-by-term sum is returned in w->sum_plain. The algorithm terminates when the difference between two successive extrapolations reaches a minimum or is sufficiently small. The difference between these two values is used as estimate of the error and is stored in abserr_trunc. To improve the reliability of the algorithm the extrapolated values are replaced by moving averages when calculating the truncation error, smoothing out any fluctuations.
Returns (Value, sum_accel, abserr_trunc)
.
pub fn sum_plain(&self) -> f64
pub fn terms_used(&self) -> usize
pub fn size(&self) -> usize
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for LevinUTruncWorkspace
impl !Send for LevinUTruncWorkspace
impl !Sync for LevinUTruncWorkspace
impl Unpin for LevinUTruncWorkspace
impl UnwindSafe for LevinUTruncWorkspace
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more