pub struct ConjugateGradient<P, F> { /* private fields */ }Expand description
§Conjugate Gradient method
A solver for systems of linear equations with a symmetric and positive-definite matrix.
Solves systems of the form A * x = b where x and b are vectors and A is a symmetric and
positive-definite matrix.
Requires an initial parameter vector.
§Requirements on the optimization problem
The optimization problem is required to implement Operator.
§Reference
Jorge Nocedal and Stephen J. Wright (2006). Numerical Optimization. Springer. ISBN 0-387-30303-0.
Implementations§
Source§impl<P, F> ConjugateGradient<P, F>where
F: ArgminFloat,
impl<P, F> ConjugateGradient<P, F>where
F: ArgminFloat,
Sourcepub fn new(b: P) -> Self
pub fn new(b: P) -> Self
Constructs an instance of ConjugateGradient
Takes b, the right hand side of A * x = b as input.
§Example
let cg: ConjugateGradient<_, f64> = ConjugateGradient::new(b);Trait Implementations§
Source§impl<P: Clone, F: Clone> Clone for ConjugateGradient<P, F>
impl<P: Clone, F: Clone> Clone for ConjugateGradient<P, F>
Source§fn clone(&self) -> ConjugateGradient<P, F>
fn clone(&self) -> ConjugateGradient<P, F>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'de, P, F> Deserialize<'de> for ConjugateGradient<P, F>where
P: Deserialize<'de>,
F: Deserialize<'de>,
impl<'de, P, F> Deserialize<'de> for ConjugateGradient<P, F>where
P: Deserialize<'de>,
F: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<P, F> Serialize for ConjugateGradient<P, F>
impl<P, F> Serialize for ConjugateGradient<P, F>
Source§impl<P, O, R, F> Solver<O, IterState<P, (), (), (), R, F>> for ConjugateGradient<P, F>where
O: Operator<Param = P, Output = P>,
P: Clone + ArgminDot<P, F> + ArgminSub<P, R> + ArgminScaledAdd<P, F, P> + ArgminConj,
R: ArgminMul<F, R> + ArgminMul<F, P> + ArgminConj + ArgminDot<R, F> + ArgminScaledAdd<P, F, R>,
F: ArgminFloat + ArgminL2Norm<F>,
impl<P, O, R, F> Solver<O, IterState<P, (), (), (), R, F>> for ConjugateGradient<P, F>where
O: Operator<Param = P, Output = P>,
P: Clone + ArgminDot<P, F> + ArgminSub<P, R> + ArgminScaledAdd<P, F, P> + ArgminConj,
R: ArgminMul<F, R> + ArgminMul<F, P> + ArgminConj + ArgminDot<R, F> + ArgminScaledAdd<P, F, R>,
F: ArgminFloat + ArgminL2Norm<F>,
Source§fn next_iter(
&mut self,
problem: &mut Problem<O>,
state: IterState<P, (), (), (), R, F>,
) -> Result<(IterState<P, (), (), (), R, F>, Option<KV>), Error>
fn next_iter( &mut self, problem: &mut Problem<O>, state: IterState<P, (), (), (), R, F>, ) -> Result<(IterState<P, (), (), (), R, F>, Option<KV>), Error>
Perform one iteration of CG algorithm
Source§fn init(
&mut self,
problem: &mut Problem<O>,
state: IterState<P, (), (), (), R, F>,
) -> Result<(IterState<P, (), (), (), R, F>, Option<KV>), Error>
fn init( &mut self, problem: &mut Problem<O>, state: IterState<P, (), (), (), R, F>, ) -> Result<(IterState<P, (), (), (), R, F>, Option<KV>), Error>
Initializes the algorithm. Read more
Source§fn terminate_internal(&mut self, state: &I) -> TerminationStatus
fn terminate_internal(&mut self, state: &I) -> TerminationStatus
Checks whether basic termination reasons apply. Read more
Source§fn terminate(&mut self, _state: &I) -> TerminationStatus
fn terminate(&mut self, _state: &I) -> TerminationStatus
Used to implement stopping criteria, in particular criteria which are not covered by
(
terminate_internal. Read moreAuto Trait Implementations§
impl<P, F> Freeze for ConjugateGradient<P, F>
impl<P, F> RefUnwindSafe for ConjugateGradient<P, F>where
P: RefUnwindSafe,
F: RefUnwindSafe,
impl<P, F> Send for ConjugateGradient<P, F>
impl<P, F> Sync for ConjugateGradient<P, F>
impl<P, F> Unpin for ConjugateGradient<P, F>
impl<P, F> UnwindSafe for ConjugateGradient<P, F>where
P: UnwindSafe,
F: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.