numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::ode::impl::bicgstab< Vector > Class Template Reference

Class to solve linear equations using BiCGstab [7]. More...

#include <num_collect/ode/impl/bicgstab.h>

+ Inheritance diagram for num_collect::ode::impl::bicgstab< Vector >:
+ Collaboration diagram for num_collect::ode::impl::bicgstab< Vector >:

Public Types

using matrix_type = Eigen::MatrixX<scalar_type>
 Type of matrices.
 
using scalar_type = typename vector_type::Scalar
 Type of scalars.
 
using vector_type = Vector
 Type of vectors.
 

Public Member Functions

 bicgstab ()
 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 tolerances (const error_tolerances< vector_type > &val) -> bicgstab &
 Set the error 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 Member Functions

template<base::concepts::invocable< const vector_type &, vector_type & > CoeffFunction>
void initialize (CoeffFunction &&coeff_function, const vector_type &rhs, const vector_type &solution)
 Initialize.
 

Private Attributes

index_type iterations_ {}
 Number of iterations.
 
index_type max_iterations_ {default_max_iterations}
 Maximum number of iterations.
 
vector_type residual_ {}
 Residual.
 
scalar_type tolerance_rate_ {default_tolerance_rate}
 Rate of tolerance in this solver.
 
error_tolerances< vector_typetolerances_ {}
 Tolerances.
 
Intermediate variables as in notation of \cite Golub2013.
vector_type r0_ {}
 
vector_type p_ {}
 
scalar_type rho_ {}
 
vector_type ap_ {}
 
vector_type as_ {}
 

Static Private Attributes

static constexpr index_type default_max_iterations = 1000
 Default maximum number of iterations.
 
static constexpr auto default_tolerance_rate
 Default rate of tolerance in this solver.
 

Detailed Description

template<base::concepts::real_scalar_dense_vector Vector>
class num_collect::ode::impl::bicgstab< Vector >

Class to solve linear equations using BiCGstab [7].

Template Parameters
VectorType of vectors.

Definition at line 48 of file bicgstab.h.

Member Typedef Documentation

◆ matrix_type

template<base::concepts::real_scalar_dense_vector Vector>
using num_collect::ode::impl::bicgstab< Vector >::matrix_type = Eigen::MatrixX<scalar_type>

Type of matrices.

Definition at line 57 of file bicgstab.h.

◆ scalar_type

template<base::concepts::real_scalar_dense_vector Vector>
using num_collect::ode::impl::bicgstab< Vector >::scalar_type = typename vector_type::Scalar

Type of scalars.

Definition at line 54 of file bicgstab.h.

◆ vector_type

template<base::concepts::real_scalar_dense_vector Vector>
using num_collect::ode::impl::bicgstab< Vector >::vector_type = Vector

Type of vectors.

Definition at line 51 of file bicgstab.h.

Constructor & Destructor Documentation

◆ bicgstab()

template<base::concepts::real_scalar_dense_vector Vector>
num_collect::ode::impl::bicgstab< Vector >::bicgstab ( )
inline

Constructor.

Definition at line 60 of file bicgstab.h.

Member Function Documentation

◆ initialize()

template<base::concepts::real_scalar_dense_vector Vector>
template<base::concepts::invocable< const vector_type &, vector_type & > CoeffFunction>
void num_collect::ode::impl::bicgstab< Vector >::initialize ( CoeffFunction && coeff_function,
const vector_type & rhs,
const vector_type & solution )
inlineprivate

Initialize.

Template Parameters
CoeffFunctionType of the function to multiply coefficient matrix.
Parameters
[in]coeff_functionFunction to multiply coefficient matrix.
[in]rhsRight-hand-side vector.
[in]solutionSolution. (Given vector is used as the initial solution.)

Definition at line 166 of file bicgstab.h.

◆ iterations()

template<base::concepts::real_scalar_dense_vector Vector>
auto num_collect::ode::impl::bicgstab< Vector >::iterations ( ) -> index_type
inline

Get the number of iterations.

Returns
Number of iterations.

Definition at line 151 of file bicgstab.h.

◆ solve()

template<base::concepts::real_scalar_dense_vector Vector>
template<base::concepts::invocable< const vector_type &, vector_type & > CoeffFunction>
void num_collect::ode::impl::bicgstab< Vector >::solve ( CoeffFunction && coeff_function,
const vector_type & rhs,
vector_type & solution )
inline

Solve.

coeff_function is assumed to have a signature like:

void coeff_function(const variable_type& target, variable_type& result);
Template Parameters
CoeffFunctionType of the function to multiply coefficient matrix.
Parameters
[in]coeff_functionFunction to multiply coefficient matrix.
[in]rhsRight-hand-side vector.
[in,out]solutionSolution. (Given vector is used as the initial solution.)

Definition at line 80 of file bicgstab.h.

◆ tolerances()

template<base::concepts::real_scalar_dense_vector Vector>
auto num_collect::ode::impl::bicgstab< Vector >::tolerances ( const error_tolerances< vector_type > & val) -> bicgstab&
inline

Set the error tolerances.

Parameters
[in]valValue.
Returns
This.

Definition at line 141 of file bicgstab.h.

Member Data Documentation

◆ ap_

template<base::concepts::real_scalar_dense_vector Vector>
vector_type num_collect::ode::impl::bicgstab< Vector >::ap_ {}
private

Intermediate variable.

Definition at line 205 of file bicgstab.h.

◆ as_

template<base::concepts::real_scalar_dense_vector Vector>
vector_type num_collect::ode::impl::bicgstab< Vector >::as_ {}
private

Intermediate variable.

Definition at line 206 of file bicgstab.h.

◆ default_max_iterations

template<base::concepts::real_scalar_dense_vector Vector>
index_type num_collect::ode::impl::bicgstab< Vector >::default_max_iterations = 1000
staticconstexprprivate

Default maximum number of iterations.

Definition at line 179 of file bicgstab.h.

◆ default_tolerance_rate

template<base::concepts::real_scalar_dense_vector Vector>
auto num_collect::ode::impl::bicgstab< Vector >::default_tolerance_rate
staticconstexprprivate
Initial value:
=
static_cast<scalar_type>(1e-2)
typename vector_type::Scalar scalar_type
Type of scalars.
Definition bicgstab.h:54

Default rate of tolerance in this solver.

Definition at line 188 of file bicgstab.h.

◆ iterations_

template<base::concepts::real_scalar_dense_vector Vector>
index_type num_collect::ode::impl::bicgstab< Vector >::iterations_ {}
private

Number of iterations.

Definition at line 176 of file bicgstab.h.

◆ max_iterations_

template<base::concepts::real_scalar_dense_vector Vector>
index_type num_collect::ode::impl::bicgstab< Vector >::max_iterations_ {default_max_iterations}
private

Maximum number of iterations.

Definition at line 182 of file bicgstab.h.

◆ p_

template<base::concepts::real_scalar_dense_vector Vector>
vector_type num_collect::ode::impl::bicgstab< Vector >::p_ {}
private

Intermediate variable.

Definition at line 203 of file bicgstab.h.

◆ r0_

template<base::concepts::real_scalar_dense_vector Vector>
vector_type num_collect::ode::impl::bicgstab< Vector >::r0_ {}
private

Intermediate variable.

Definition at line 202 of file bicgstab.h.

◆ residual_

template<base::concepts::real_scalar_dense_vector Vector>
vector_type num_collect::ode::impl::bicgstab< Vector >::residual_ {}
private

Residual.

Definition at line 195 of file bicgstab.h.

◆ rho_

template<base::concepts::real_scalar_dense_vector Vector>
scalar_type num_collect::ode::impl::bicgstab< Vector >::rho_ {}
private

Intermediate variable.

Definition at line 204 of file bicgstab.h.

◆ tolerance_rate_

template<base::concepts::real_scalar_dense_vector Vector>
scalar_type num_collect::ode::impl::bicgstab< Vector >::tolerance_rate_ {default_tolerance_rate}
private

Rate of tolerance in this solver.

Definition at line 192 of file bicgstab.h.

◆ tolerances_

template<base::concepts::real_scalar_dense_vector Vector>
error_tolerances<vector_type> num_collect::ode::impl::bicgstab< Vector >::tolerances_ {}
private

Tolerances.

Definition at line 185 of file bicgstab.h.


The documentation for this class was generated from the following file: