numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class to solve linear equations using Gauss-Seidel iteration [7]. More...
#include <num_collect/linear/gauss_seidel_iterative_solver.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< gauss_seidel_iterative_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 | |
gauss_seidel_iterative_solver ()=default | |
Constructor. | |
void | compute (const matrix_type &coeff) |
Prepare to solve. | |
auto | iterations () const noexcept -> index_type |
Get the number of iterations. | |
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< gauss_seidel_iterative_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) -> gauss_seidel_iterative_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) -> gauss_seidel_iterative_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< gauss_seidel_iterative_solver< Matrix >, Right > |
Solve a linear equation. | |
auto | solve_with_guess (const Right &right, const Solution &solution) const -> Eigen::SolveWithGuess< gauss_seidel_iterative_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) -> gauss_seidel_iterative_solver< Matrix > & |
Set the tolerance of rate of residual. | |
Private Member Functions | |
template<base::concepts::dense_vector_of< scalar_type > Right, base::concepts::dense_vector_of< scalar_type > Solution> | |
void | iterate (const matrix_type &coeff_ref, const Right &right, Solution &solution) const |
Iterate once. | |
Private Attributes | |
vector_type | diag_ {} |
Diagonal coefficients. | |
vector_type | inv_diag_ {} |
Inverse of diagonal coefficients. | |
index_type | iterations_ {} |
Number of iterations. | |
scalar_type | residual_ {} |
Last residual. | |
scalar_type | residual_rate_ {} |
Rate of last residual. | |
Additional Inherited Members | |
Protected Types inherited from num_collect::linear::iterative_solver_base< gauss_seidel_iterative_solver< Matrix > > | |
using | Base |
Base class. | |
Protected Member Functions inherited from num_collect::linear::iterative_solver_base< gauss_seidel_iterative_solver< Matrix > > | |
auto | coeff () const noexcept -> const matrix_type & |
Get the coefficient matrix. | |
Class to solve linear equations using Gauss-Seidel iteration [7].
Matrix | Type of the matrix. |
Definition at line 64 of file gauss_seidel_iterative_solver.h.
using num_collect::linear::gauss_seidel_iterative_solver< Matrix >::base_type |
Type of the base class.
Definition at line 72 of file gauss_seidel_iterative_solver.h.
using num_collect::linear::gauss_seidel_iterative_solver< Matrix >::vector_type = Eigen::VectorX<scalar_type> |
Type of vectors.
Definition at line 85 of file gauss_seidel_iterative_solver.h.
|
inline |
Prepare to solve.
[in] | coeff | Coefficient matrix. |
Definition at line 97 of file gauss_seidel_iterative_solver.h.
|
inlineprivate |
Iterate once.
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 176 of file gauss_seidel_iterative_solver.h.
|
inlinenodiscardnoexcept |
Get the number of iterations.
Definition at line 149 of file gauss_seidel_iterative_solver.h.
|
inlinenodiscardnoexcept |
Get the rate of the last residual.
Definition at line 160 of file gauss_seidel_iterative_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 116 of file gauss_seidel_iterative_solver.h.
|
private |
Diagonal coefficients.
Definition at line 204 of file gauss_seidel_iterative_solver.h.
|
private |
Inverse of diagonal coefficients.
Definition at line 207 of file gauss_seidel_iterative_solver.h.
|
mutableprivate |
Number of iterations.
Definition at line 195 of file gauss_seidel_iterative_solver.h.
|
mutableprivate |
Last residual.
Definition at line 198 of file gauss_seidel_iterative_solver.h.
|
mutableprivate |
Rate of last residual.
Definition at line 201 of file gauss_seidel_iterative_solver.h.