numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class to perform conjugate gradient (CG) method [7] for linear operators. More...
#include <num_collect/linear/impl/operator_conjugate_gradient.h>
Public Types | |
using | scalar_type = typename vector_type::Scalar |
Type of scalars. | |
using | vector_type = Vector |
Type of vectors. | |
Public Member Functions | |
operator_conjugate_gradient () | |
Constructor. | |
auto | iterations () -> index_type |
Get the number of iterations. | |
template<base::concepts::invocable< const vector_type &, vector_type & > CoeffFunction> | |
void | solve (CoeffFunction &&coeff_function, const vector_type &rhs, vector_type &solution) |
Solve. | |
auto | tolerance_rate (const scalar_type &val) -> operator_conjugate_gradient & |
Set the rate of tolerances. | |
Public Member Functions inherited from num_collect::logging::logging_mixin | |
logging_mixin (log_tag_view tag) | |
Constructor. | |
template<typename Child > | |
void | configure_child_algorithm_logger_if_exists (Child &child) |
Configure a logger of a child algorithm if exists. | |
auto | logger () const noexcept -> const num_collect::logging::logger & |
Access to the logger. | |
auto | logger () noexcept -> num_collect::logging::logger & |
Access to the logger. | |
Private Attributes | |
index_type | iterations_ {} |
Number of iterations. | |
index_type | max_iterations_ {default_max_iterations} |
Maximum number of iterations. | |
vector_type | residual_ {} |
Residual vector. | |
scalar_type | tolerance_rate_ {default_tolerance_rate} |
Rate of tolerance. | |
Intermidiate variables. | |
vector_type | previous_residual_ {} |
vector_type | p_ {} |
vector_type | coeff_p_ {} |
Static Private Attributes | |
static constexpr index_type | default_max_iterations = 1000 |
Default maximum number of iterations. | |
static constexpr scalar_type | default_tolerance_rate |
Default rate of tolerance. | |
Class to perform conjugate gradient (CG) method [7] for linear operators.
Vector | Type of vectors. |
Definition at line 46 of file operator_conjugate_gradient.h.
using num_collect::linear::impl::operator_conjugate_gradient< Vector >::scalar_type = typename vector_type::Scalar |
Type of scalars.
Definition at line 52 of file operator_conjugate_gradient.h.
using num_collect::linear::impl::operator_conjugate_gradient< Vector >::vector_type = Vector |
Type of vectors.
Definition at line 49 of file operator_conjugate_gradient.h.
|
inline |
Constructor.
Definition at line 57 of file operator_conjugate_gradient.h.
|
inline |
Get the number of iterations.
Definition at line 134 of file operator_conjugate_gradient.h.
|
inline |
Solve.
coeff_function is assumed to have a signature like:
CoeffFunction | Type of the function to multiply coefficient matrix. |
[in] | coeff_function | Function to multiply coefficient matrix. |
[in] | rhs | Right-hand-side vector. |
[in,out] | solution | Solution. (Given vector is used as the initial solution.) |
Definition at line 78 of file operator_conjugate_gradient.h.
|
inline |
Set the rate of tolerances.
[in] | val | Value. |
Definition at line 123 of file operator_conjugate_gradient.h.
|
private |
Intermediate variable.
Definition at line 163 of file operator_conjugate_gradient.h.
|
staticconstexprprivate |
Default maximum number of iterations.
Definition at line 141 of file operator_conjugate_gradient.h.
|
staticconstexprprivate |
Default rate of tolerance.
Definition at line 147 of file operator_conjugate_gradient.h.
|
private |
Number of iterations.
Definition at line 138 of file operator_conjugate_gradient.h.
|
private |
Maximum number of iterations.
Definition at line 144 of file operator_conjugate_gradient.h.
|
private |
Intermediate variable.
Definition at line 162 of file operator_conjugate_gradient.h.
|
private |
Intermediate variable.
Definition at line 161 of file operator_conjugate_gradient.h.
|
private |
Residual vector.
Definition at line 154 of file operator_conjugate_gradient.h.
|
private |
Rate of tolerance.
Definition at line 151 of file operator_conjugate_gradient.h.