numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class to solve linear equations using algebraic multigrid method [24]. More...
#include <num_collect/linear/algebraic_multigrid_solver.h>
Classes | |
struct | final_layer_data |
Struct of internal data for the final layer. More... | |
struct | first_layer_data |
Struct of internal data for the first layer. More... | |
struct | intermidiate_layer_data |
Struct of internal data for the intermidiate layers. More... | |
Public Types | |
using | base_type = iterative_solver_base<algebraic_multigrid_solver<Matrix>> |
Type of the base class. | |
using | this_type = algebraic_multigrid_solver<Matrix> |
Type of this class. | |
Public Types inherited from num_collect::linear::iterative_solver_base< algebraic_multigrid_solver< Matrix > > | |
enum | |
using | matrix_type |
Type of matrices. | |
using | MatrixType |
Type of matrices. (For Eigen library.) | |
using | real_scalar_type |
Type of real scalars. | |
using | RealScalar |
Type of real scalars. (For Eigen library.) | |
using | Scalar |
Type of scalars. (For Eigen library.) | |
using | scalar_type |
Type of scalars. | |
using | storage_index_type |
Type of indices in storages. | |
using | StorageIndex |
Type of indices in storages. (For Eigen library.) | |
Public Member Functions | |
algebraic_multigrid_solver () | |
Constructor. | |
void | compute (const matrix_type &coeff) |
Prepare to solve. | |
auto | iterations () const noexcept -> index_type |
Get the number of iterations. | |
auto | maximum_directly_solved_matrix_size (index_type value) -> algebraic_multigrid_solver & |
Set the maximum size of matrices to solve directly. | |
auto | residual_rate () const noexcept -> scalar_type |
Get the rate of the last residual. | |
template<base::concepts::dense_vector_of< scalar_type > Right, base::concepts::dense_vector_of< scalar_type > Solution> | |
void | solve_vector_in_place (const Right &right, Solution &solution) const |
Iterate repeatedly until stop criterion is satisfied for a vector. | |
Public Member Functions inherited from num_collect::linear::iterative_solver_base< algebraic_multigrid_solver< Matrix > > | |
iterative_solver_base () | |
Constructor. | |
void | _solve_impl (const Right &right, Solution &solution) const |
Internal function to solve for a right-hand-side vector. | |
void | _solve_with_guess_impl (const Right &right, Solution &solution) const |
Internal function to solve for a right-hand-side vector. | |
auto | cols () const noexcept -> Eigen::Index |
Get the number of columns. | |
auto | compute (const matrix_type &coeff) -> algebraic_multigrid_solver< Matrix > & |
Initialize this solver using a coefficient matrix. | |
auto | max_iterations () const noexcept -> index_type |
Get the maximum number of iterations. | |
auto | max_iterations (index_type val) -> algebraic_multigrid_solver< Matrix > & |
Set the maximum number of iterations. | |
auto | rows () const noexcept -> Eigen::Index |
Get the number of rows. | |
auto | solve (const Right &right) const -> Eigen::Solve< algebraic_multigrid_solver< Matrix >, Right > |
Solve a linear equation. | |
auto | solve_with_guess (const Right &right, const Solution &solution) const -> Eigen::SolveWithGuess< algebraic_multigrid_solver< Matrix >, Right, Solution > |
Solve a linear equation with a guess of the solution. | |
auto | tolerance () const noexcept -> real_scalar_type |
Get the tolerance of rate of residual. | |
auto | tolerance (const real_scalar_type &val) -> algebraic_multigrid_solver< Matrix > & |
Set the tolerance of rate of residual. | |
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 Types | |
using | dense_matrix_type = Eigen::MatrixX<scalar_type> |
Type of the dense matrix used in this algorithm. | |
using | dense_vector_type = Eigen::VectorX<scalar_type> |
Type of the dense vector used in this algorithm. | |
Private Member Functions | |
void | compute_prolongation_matrix (matrix_type &prolongation_matrix, const matrix_type &coeff_matrix) |
Compute prolongation matrix from a coefficient matrix. | |
template<base::concepts::dense_vector_of< scalar_type > Right, base::concepts::dense_vector_of< scalar_type > Solution> | |
void | iterate (const Right &right, Solution &solution) const |
Iterate once. | |
Private Attributes | |
final_layer_data | final_layer_ {} |
Data of the final layer. | |
first_layer_data | first_layer_ {} |
Data of the first layer. | |
std::deque< intermidiate_layer_data > | intermidiate_layers_ {} |
Data of the intermidiate layers. | |
index_type | iterations_ {} |
Number of iterations. | |
index_type | maximum_directly_solved_matrix_size_ |
Maximum size of matrices to solve directly. | |
std::vector< dense_vector_type > | residual_buffers_ {} |
Buffers of residuals in layers except for the first layer. | |
std::vector< dense_vector_type > | solution_buffers_ {} |
Buffers of solutions in layers except for the first layer. | |
real_scalar_type | strong_coeff_rate_threshold_ |
Threshold of the rate of coefficients to determine strong connections. | |
Static Private Attributes | |
static constexpr index_type | default_maximum_directly_solved_matrix_size |
Default value of the maximum size of matrices to solve directly. | |
static constexpr auto | default_strong_coeff_rate_threshold |
Default value of the threshold of the rate of coefficients to determine strong connections. | |
Additional Inherited Members | |
Protected Types inherited from num_collect::linear::iterative_solver_base< algebraic_multigrid_solver< Matrix > > | |
using | Base |
Base class. | |
Protected Member Functions inherited from num_collect::linear::iterative_solver_base< algebraic_multigrid_solver< Matrix > > | |
auto | coeff () const noexcept -> const matrix_type & |
Get the coefficient matrix. | |
Class to solve linear equations using algebraic multigrid method [24].
Matrix | Type of the matrix. |
Definition at line 77 of file algebraic_multigrid_solver.h.
using num_collect::linear::algebraic_multigrid_solver< Matrix >::base_type = iterative_solver_base<algebraic_multigrid_solver<Matrix>> |
Type of the base class.
Definition at line 88 of file algebraic_multigrid_solver.h.
|
private |
Type of the dense matrix used in this algorithm.
Definition at line 311 of file algebraic_multigrid_solver.h.
|
private |
Type of the dense vector used in this algorithm.
Definition at line 314 of file algebraic_multigrid_solver.h.
using num_collect::linear::algebraic_multigrid_solver< Matrix >::this_type = algebraic_multigrid_solver<Matrix> |
Type of this class.
Definition at line 85 of file algebraic_multigrid_solver.h.
|
inline |
Constructor.
Definition at line 102 of file algebraic_multigrid_solver.h.
|
inline |
Prepare to solve.
[in] | coeff | Coefficient matrix. |
Definition at line 110 of file algebraic_multigrid_solver.h.
|
inlineprivate |
Compute prolongation matrix from a coefficient matrix.
[out] | prolongation_matrix | Prolongation matrix. |
[in] | coeff_matrix | Coefficient matrix. |
Definition at line 297 of file algebraic_multigrid_solver.h.
|
inlineprivate |
Iterate once.
Right | Type of the right-hand-side vector. |
Solution | Type of the solution vector. |
[in] | right | Right-hand-side vector. |
[in,out] | solution | Solution vector. |
Definition at line 253 of file algebraic_multigrid_solver.h.
|
inlinenodiscardnoexcept |
Get the number of iterations.
Definition at line 227 of file algebraic_multigrid_solver.h.
|
inline |
Set the maximum size of matrices to solve directly.
[in] | value | Value. |
Definition at line 213 of file algebraic_multigrid_solver.h.
|
inlinenodiscardnoexcept |
Get the rate of the last residual.
Definition at line 238 of file algebraic_multigrid_solver.h.
|
inline |
Iterate repeatedly until stop criterion is satisfied for a vector.
Right | Type of the right-hand-side vector. |
Solution | Type of the solution vector. |
[in] | right | Right-hand-side vector. |
[in,out] | solution | Solution vector. |
Definition at line 177 of file algebraic_multigrid_solver.h.
|
staticconstexprprivate |
Default value of the maximum size of matrices to solve directly.
Definition at line 378 of file algebraic_multigrid_solver.h.
|
staticconstexprprivate |
Default value of the threshold of the rate of coefficients to determine strong connections.
Definition at line 370 of file algebraic_multigrid_solver.h.
|
private |
Data of the final layer.
Definition at line 358 of file algebraic_multigrid_solver.h.
|
private |
Data of the first layer.
Definition at line 347 of file algebraic_multigrid_solver.h.
|
private |
Data of the intermidiate layers.
Definition at line 355 of file algebraic_multigrid_solver.h.
|
mutableprivate |
Number of iterations.
Definition at line 367 of file algebraic_multigrid_solver.h.
|
private |
Maximum size of matrices to solve directly.
Definition at line 382 of file algebraic_multigrid_solver.h.
|
mutableprivate |
Buffers of residuals in layers except for the first layer.
Definition at line 361 of file algebraic_multigrid_solver.h.
|
mutableprivate |
Buffers of solutions in layers except for the first layer.
Definition at line 364 of file algebraic_multigrid_solver.h.
|
private |
Threshold of the rate of coefficients to determine strong connections.
Definition at line 374 of file algebraic_multigrid_solver.h.