Struct argmin::solver::conjugategradient::ConjugateGradient
source · [−]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
sourceimpl<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
sourceimpl<P: Clone, F: Clone> Clone for ConjugateGradient<P, F>
impl<P: Clone, F: Clone> Clone for ConjugateGradient<P, F>
sourcefn clone(&self) -> ConjugateGradient<P, F>
fn clone(&self) -> ConjugateGradient<P, F>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'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>,
sourcefn 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
sourceimpl<P, F> Serialize for ConjugateGradient<P, F> where
P: Serialize,
F: Serialize,
impl<P, F> Serialize for ConjugateGradient<P, F> where
P: Serialize,
F: Serialize,
sourceimpl<P, O, F> Solver<O, IterState<P, (), (), (), F>> for ConjugateGradient<P, F> where
O: Operator<Param = P, Output = P>,
P: Clone + SerializeAlias + ArgminDot<P, F> + ArgminSub<P, P> + ArgminScaledAdd<P, F, P> + ArgminConj + ArgminMul<F, P>,
F: ArgminFloat + ArgminNorm<F>,
impl<P, O, F> Solver<O, IterState<P, (), (), (), F>> for ConjugateGradient<P, F> where
O: Operator<Param = P, Output = P>,
P: Clone + SerializeAlias + ArgminDot<P, F> + ArgminSub<P, P> + ArgminScaledAdd<P, F, P> + ArgminConj + ArgminMul<F, P>,
F: ArgminFloat + ArgminNorm<F>,
sourcefn next_iter(
&mut self,
problem: &mut Problem<O>,
state: IterState<P, (), (), (), F>
) -> Result<(IterState<P, (), (), (), F>, Option<KV>), Error>
fn next_iter(
&mut self,
problem: &mut Problem<O>,
state: IterState<P, (), (), (), F>
) -> Result<(IterState<P, (), (), (), F>, Option<KV>), Error>
Perform one iteration of CG algorithm
sourcefn init(
&mut self,
problem: &mut Problem<O>,
state: IterState<P, (), (), (), F>
) -> Result<(IterState<P, (), (), (), F>, Option<KV>), Error>
fn init(
&mut self,
problem: &mut Problem<O>,
state: IterState<P, (), (), (), F>
) -> Result<(IterState<P, (), (), (), F>, Option<KV>), Error>
Initializes the algorithm. Read more
sourcefn terminate_internal(&mut self, state: &I) -> TerminationReason
fn terminate_internal(&mut self, state: &I) -> TerminationReason
Checks whether basic termination reasons apply. Read more
sourcefn terminate(&mut self, _state: &I) -> TerminationReason
fn terminate(&mut self, _state: &I) -> TerminationReason
Used to implement stopping criteria, in particular criteria which are not covered by
(terminate_internal
. Read more
Auto Trait Implementations
impl<P, F> RefUnwindSafe for ConjugateGradient<P, F> where
F: RefUnwindSafe,
P: RefUnwindSafe,
impl<P, F> Send for ConjugateGradient<P, F> where
F: Send,
P: Send,
impl<P, F> Sync for ConjugateGradient<P, F> where
F: Sync,
P: Sync,
impl<P, F> Unpin for ConjugateGradient<P, F> where
F: Unpin,
P: Unpin,
impl<P, F> UnwindSafe for ConjugateGradient<P, F> where
F: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more