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

Class to solve linear equations using generalized minimal residual (GMRES) [7]. More...

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

+ Inheritance diagram for num_collect::ode::impl::gmres< Vector >:
+ Collaboration diagram for num_collect::ode::impl::gmres< 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

auto max_subspace_dim (index_type val) -> gmres &
 Set the maximum number of dimensions of subspace.
 
template<typename CoeffFunction >
void solve (CoeffFunction &&coeff_function, const vector_type &rhs, vector_type &solution)
 Solve.
 

Private Attributes

matrix_type basis_ {}
 Basis of subspace.
 
matrix_type hessenberg_ {}
 Hessenberg matrix.
 
index_type max_subspace_dim_ {default_max_subspace_dim}
 Maximum number of dimensions of subspace.
 
Eigen::ColPivHouseholderQR< matrix_typeqr_ {}
 QR decomposition.
 
vector_type residual_ {}
 Residual.
 
Eigen::VectorX< scalar_typetemp_rhs_ {}
 Temporary vector for solving internal equation.
 
Eigen::VectorX< scalar_typetemp_sol_ {}
 Temporary vector for solving internal equation.
 

Static Private Attributes

static constexpr index_type default_max_subspace_dim = 2
 Default maximum number of dimensions of subspace.
 

Detailed Description

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

Class to solve linear equations using generalized minimal residual (GMRES) [7].

Template Parameters
VectorType of vectors.

Definition at line 45 of file gmres.h.

Member Typedef Documentation

◆ matrix_type

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

Type of matrices.

Definition at line 54 of file gmres.h.

◆ scalar_type

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

Type of scalars.

Definition at line 51 of file gmres.h.

◆ vector_type

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

Type of vectors.

Definition at line 48 of file gmres.h.

Member Function Documentation

◆ max_subspace_dim()

template<base::concepts::real_scalar_dense_vector Vector>
auto num_collect::ode::impl::gmres< Vector >::max_subspace_dim ( index_type val) -> gmres&
inline

Set the maximum number of dimensions of subspace.

Parameters
[in]valValue.
Returns
This.

Definition at line 122 of file gmres.h.

◆ solve()

template<base::concepts::real_scalar_dense_vector Vector>
template<typename CoeffFunction >
void num_collect::ode::impl::gmres< 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 73 of file gmres.h.

Member Data Documentation

◆ basis_

template<base::concepts::real_scalar_dense_vector Vector>
matrix_type num_collect::ode::impl::gmres< Vector >::basis_ {}
private

Basis of subspace.

Definition at line 141 of file gmres.h.

◆ default_max_subspace_dim

template<base::concepts::real_scalar_dense_vector Vector>
index_type num_collect::ode::impl::gmres< Vector >::default_max_subspace_dim = 2
staticconstexprprivate

Default maximum number of dimensions of subspace.

Definition at line 132 of file gmres.h.

◆ hessenberg_

template<base::concepts::real_scalar_dense_vector Vector>
matrix_type num_collect::ode::impl::gmres< Vector >::hessenberg_ {}
private

Hessenberg matrix.

Definition at line 144 of file gmres.h.

◆ max_subspace_dim_

template<base::concepts::real_scalar_dense_vector Vector>
index_type num_collect::ode::impl::gmres< Vector >::max_subspace_dim_ {default_max_subspace_dim}
private

Maximum number of dimensions of subspace.

Definition at line 135 of file gmres.h.

◆ qr_

template<base::concepts::real_scalar_dense_vector Vector>
Eigen::ColPivHouseholderQR<matrix_type> num_collect::ode::impl::gmres< Vector >::qr_ {}
private

QR decomposition.

Definition at line 153 of file gmres.h.

◆ residual_

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

Residual.

Definition at line 138 of file gmres.h.

◆ temp_rhs_

template<base::concepts::real_scalar_dense_vector Vector>
Eigen::VectorX<scalar_type> num_collect::ode::impl::gmres< Vector >::temp_rhs_ {}
private

Temporary vector for solving internal equation.

Definition at line 147 of file gmres.h.

◆ temp_sol_

template<base::concepts::real_scalar_dense_vector Vector>
Eigen::VectorX<scalar_type> num_collect::ode::impl::gmres< Vector >::temp_sol_ {}
private

Temporary vector for solving internal equation.

Definition at line 150 of file gmres.h.


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