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, 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> RefUnwindSafe for ConjugateGradient<P, F>where
F: RefUnwindSafe,
P: 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
F: UnwindSafe,
P: 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