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§
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 copy 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, 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 + ArgminL2Norm<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 + ArgminL2Norm<F>,
source§fn 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
source§fn 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
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 more