![]() |
SOPT
Sparse OPTimisation
|
Solves $Ax = b$ for $x$, given $A$ and $b$. More...
#include <conjugate_gradient.h>
Classes | |
| struct | Diagnostic |
| Values indicating how the algorithm ran. More... | |
| struct | DiagnosticAndResult |
| Values indicating how the algorithm ran and its result;. More... | |
Public Member Functions | |
| ConjugateGradient (t_uint itermax=std::numeric_limits< t_uint >::max(), t_real tolerance=1e-8) | |
| Creates conjugate gradient operator. More... | |
| virtual | ~ConjugateGradient () |
| template<typename VECTOR , typename T1 , typename T2 > | |
| Diagnostic | operator() (VECTOR &x, Eigen::MatrixBase< T1 > const &A, Eigen::MatrixBase< T2 > const &b) const |
| Computes $x$ for $Ax=b$. More... | |
| template<typename VECTOR , typename T1 , typename T2 > | |
| std::enable_if< not std::is_base_of< Eigen::EigenBase< T1 >, T1 >::value, Diagnostic >::type | operator() (VECTOR &x, T1 const &A, Eigen::MatrixBase< T2 > const &b) const |
| Computes $x$ for $Ax=b$. More... | |
| template<typename T0 , typename A_TYPE > | |
| DiagnosticAndResult< typename T0::Scalar > | operator() (A_TYPE const &A, Eigen::MatrixBase< T0 > const &b) const |
| Computes $x$ for $Ax=b$. More... | |
| t_uint | itermax () const |
| Maximum number of iterations. More... | |
| void | itermax (t_uint const &itermax) |
| Sets maximum number of iterations. More... | |
| t_real | tolerance () const |
| Tolerance criteria. More... | |
| void | tolerance (t_real const &tolerance) |
| Sets tolerance criteria. More... | |
Solves $Ax = b$ for $x$, given $A$ and $b$.
Definition at line 14 of file conjugate_gradient.h.
|
inline |
Creates conjugate gradient operator.
| [in] | itermax | Maximum number of iterations. 0 means algorithm breaks only if convergence is reached. |
| [in] | tolerance | Convergence criteria |
Definition at line 39 of file conjugate_gradient.h.
|
inlinevirtual |
Definition at line 41 of file conjugate_gradient.h.
|
inline |
Maximum number of iterations.
0 means algorithm breaks only if convergence is reached.
Definition at line 75 of file conjugate_gradient.h.
|
inline |
Sets maximum number of iterations.
0 means algorithm breaks only if convergence is reached.
Definition at line 78 of file conjugate_gradient.h.
References itermax().
Referenced by itermax().
|
inline |
Computes $x$ for $Ax=b$.
Specialisation where x is constructed during call and returned. And x is a matrix rather than an array.
Definition at line 65 of file conjugate_gradient.h.
References b, and sopt::ConjugateGradient::DiagnosticAndResult< T >::result.
|
inline |
Computes $x$ for $Ax=b$.
Specialization that converts A from a matrix to a functor. This convertion is only so we write the conjugate-gradient algorithm only once for A as a matrix and A as a functor. A as a functor means A can be a complex operation, e.g. an FFT or two.
Definition at line 49 of file conjugate_gradient.h.
References b.
|
inline |
Computes $x$ for $Ax=b$.
Specialisation where A is a functor and b and x are matrix-like objects. This is the innermost specialization.
Definition at line 58 of file conjugate_gradient.h.
References b.
|
inline |
Tolerance criteria.
Definition at line 80 of file conjugate_gradient.h.
Referenced by main(), and tolerance().
|
inline |
Sets tolerance criteria.
Definition at line 82 of file conjugate_gradient.h.
References tolerance().