numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class to solve linear equations using symmetric successive over-relaxation using threads [7]. More...
#include <num_collect/linear/parallel_symmetric_successive_over_relaxation.h>
Public Types | |
using | base_type |
Type of the base class. | |
using | vector_type = Eigen::VectorX<scalar_type> |
Type of vectors. | |
Public Types inherited from num_collect::linear::iterative_solver_base< parallel_symmetric_successive_over_relaxation< 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 | |
parallel_symmetric_successive_over_relaxation () | |
Constructor. | |
void | compute (const matrix_type &coeff) |
Prepare to solve. | |
auto | iterations () const noexcept -> index_type |
Get the number of iterations. | |
auto | relaxation_coeff (const scalar_type &val) -> parallel_symmetric_successive_over_relaxation & |
Set the relaxation coefficient. | |
auto | residual_rate () const noexcept -> scalar_type |
Get the rate of the last residual. | |
auto | run_parallel (bool val) -> parallel_symmetric_successive_over_relaxation & |
Set whether to run in parallel. | |
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< parallel_symmetric_successive_over_relaxation< 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) -> parallel_symmetric_successive_over_relaxation< 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) -> parallel_symmetric_successive_over_relaxation< 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< parallel_symmetric_successive_over_relaxation< Matrix >, Right > |
Solve a linear equation. | |
auto | solve_with_guess (const Right &right, const Solution &solution) const -> Eigen::SolveWithGuess< parallel_symmetric_successive_over_relaxation< 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) -> parallel_symmetric_successive_over_relaxation< 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 Member Functions | |
template<base::concepts::dense_vector_of< scalar_type > Right, base::concepts::dense_vector_of< scalar_type > Solution> | |
void | iterate_no_parallel (const matrix_type &coeff_ref, const Right &right, Solution &solution) const |
Iterate once in single thread. | |
template<base::concepts::dense_vector_of< scalar_type > Right, base::concepts::dense_vector_of< scalar_type > Solution> | |
void | iterate_parallel (const matrix_type &coeff_ref, const Right &right, Solution &solution) const |
Iterate once in parallel. | |
template<base::concepts::dense_vector_of< scalar_type > Right, base::concepts::dense_vector_of< scalar_type > Solution> | |
void | process_row_backward (const matrix_type &coeff_ref, const Right &right, Solution &solution, index_type i, index_type end_row, const scalar_type &prev_sol_coeff) const |
Process a row in the backward update. | |
template<base::concepts::dense_vector_of< scalar_type > Right, base::concepts::dense_vector_of< scalar_type > Solution> | |
auto | process_row_forward (const matrix_type &coeff_ref, const Right &right, Solution &solution, index_type i, index_type start_row, const scalar_type &prev_sol_coeff) const -> scalar_type |
Process a row in the forward update. | |
Private Attributes | |
vector_type | diag_ {} |
Diagonal coefficients. | |
vector_type | intermidiate_solution_ {} |
Intermidiate solution vector. | |
vector_type | inv_diag_ {} |
Inverse of diagonal coefficients. | |
index_type | iterations_ {} |
Number of iterations. | |
scalar_type | relaxation_coeff_ {static_cast<scalar_type>(1)} |
Relaxation coefficient. | |
scalar_type | residual_ {} |
Last residual. | |
scalar_type | residual_rate_ {} |
Rate of last residual. | |
bool | run_parallel_ {true} |
Whether to run in parallel. | |
Additional Inherited Members | |
Protected Types inherited from num_collect::linear::iterative_solver_base< parallel_symmetric_successive_over_relaxation< Matrix > > | |
using | Base |
Base class. | |
Protected Member Functions inherited from num_collect::linear::iterative_solver_base< parallel_symmetric_successive_over_relaxation< Matrix > > | |
auto | coeff () const noexcept -> const matrix_type & |
Get the coefficient matrix. | |
Class to solve linear equations using symmetric successive over-relaxation using threads [7].
Matrix | Type of the matrix. |
Definition at line 72 of file parallel_symmetric_successive_over_relaxation.h.
using num_collect::linear::parallel_symmetric_successive_over_relaxation< Matrix >::base_type |
Type of the base class.
Definition at line 82 of file parallel_symmetric_successive_over_relaxation.h.
using num_collect::linear::parallel_symmetric_successive_over_relaxation< Matrix >::vector_type = Eigen::VectorX<scalar_type> |
Type of vectors.
Definition at line 95 of file parallel_symmetric_successive_over_relaxation.h.
|
inline |
Constructor.
Definition at line 100 of file parallel_symmetric_successive_over_relaxation.h.
|
inline |
Prepare to solve.
[in] | coeff | Coefficient matrix. |
Definition at line 109 of file parallel_symmetric_successive_over_relaxation.h.
|
inlineprivate |
Iterate once in single thread.
Right | Type of the right-hand-side vector. |
Solution | Type of the solution vector. |
[in] | coeff_ref | Coefficient matrix. |
[in] | right | Right-hand-side vector. |
[in,out] | solution | Solution vector. |
Definition at line 284 of file parallel_symmetric_successive_over_relaxation.h.
|
inlineprivate |
Iterate once in parallel.
Right | Type of the right-hand-side vector. |
Solution | Type of the solution vector. |
[in] | coeff_ref | Coefficient matrix. |
[in] | right | Right-hand-side vector. |
[in,out] | solution | Solution vector. |
Definition at line 229 of file parallel_symmetric_successive_over_relaxation.h.
|
inlinenodiscardnoexcept |
Get the number of iterations.
Definition at line 173 of file parallel_symmetric_successive_over_relaxation.h.
|
inlineprivate |
Process a row in the backward update.
Right | Type of the right-hand-side vector. |
Solution | Type of the solution vector. |
[in] | coeff_ref | Coefficient matrix. |
[in] | right | Right-hand-side vector. |
[in,out] | solution | Solution vector. |
[in] | i | Index of the row. |
[in] | end_row | Index of the pat-the-last row in this thread. |
[in] | prev_sol_coeff | Coefficient for the previous solution. |
Definition at line 353 of file parallel_symmetric_successive_over_relaxation.h.
|
inlineprivate |
Process a row in the forward update.
Right | Type of the right-hand-side vector. |
Solution | Type of the solution vector. |
[in] | coeff_ref | Coefficient matrix. |
[in] | right | Right-hand-side vector. |
[in,out] | solution | Solution vector. |
[in] | i | Index of the row. |
[in] | start_row | Index of the first row in this thread. |
[in] | prev_sol_coeff | Coefficient for the previous solution. |
Definition at line 319 of file parallel_symmetric_successive_over_relaxation.h.
|
inline |
Set the relaxation coefficient.
[in] | val | Relaxation coefficient. |
Definition at line 194 of file parallel_symmetric_successive_over_relaxation.h.
|
inlinenodiscardnoexcept |
Get the rate of the last residual.
Definition at line 184 of file parallel_symmetric_successive_over_relaxation.h.
|
inline |
Set whether to run in parallel.
[in] | val | Whether to run in parallel. |
Definition at line 211 of file parallel_symmetric_successive_over_relaxation.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 131 of file parallel_symmetric_successive_over_relaxation.h.
|
private |
Diagonal coefficients.
Definition at line 386 of file parallel_symmetric_successive_over_relaxation.h.
|
mutableprivate |
Intermidiate solution vector.
Definition at line 392 of file parallel_symmetric_successive_over_relaxation.h.
|
private |
Inverse of diagonal coefficients.
Definition at line 389 of file parallel_symmetric_successive_over_relaxation.h.
|
mutableprivate |
Number of iterations.
Definition at line 374 of file parallel_symmetric_successive_over_relaxation.h.
|
private |
Relaxation coefficient.
Definition at line 383 of file parallel_symmetric_successive_over_relaxation.h.
|
mutableprivate |
Last residual.
Definition at line 377 of file parallel_symmetric_successive_over_relaxation.h.
|
mutableprivate |
Rate of last residual.
Definition at line 380 of file parallel_symmetric_successive_over_relaxation.h.
|
private |
Whether to run in parallel.
Definition at line 371 of file parallel_symmetric_successive_over_relaxation.h.