Symmetric Gauss-Seidel smoother for sparse systems.
More...
#include <smoother.hpp >
SparseGaussSeidel ()
Construct a new Sparse Gauss Seidel object for pre/post smoother in AMG .
void smooth (const Eigen::SparseMatrix< EleType > &A, Eigen::Matrix< EleType, -1, 1 > &u, const Eigen::Matrix< EleType, -1, 1 > &b)
Must implement function that smooths Au = b
.
SmootherBase ()
SmootherBase (size_t n_iters_)
SmootherBase (double tolerance_, size_t compute_error_every_n_iters_, size_t n_iters_)
Construct a new Smoother Base object with iterative solver member data.
void matvecprod (int col, EleType &rsum, EleType &diag, const EleType &z, const Eigen::SparseMatrix< EleType > &A, const Eigen::Matrix< EleType, -1, 1 > &u)
Modified sparse matvec product of Au
for Gauss-Seidel sweeps.
void update (int col, const Eigen::SparseMatrix< EleType > &A, const Eigen::Matrix< EleType, -1, 1 > &b, Eigen::Matrix< EleType, -1, 1 > &u)
Updates a single entry in u
inplace using the definition of a Gauss-Seidel.
void forwardsweep (const Eigen::SparseMatrix< EleType > &A, const Eigen::Matrix< EleType, -1, 1 > &b, Eigen::Matrix< EleType, -1, 1 > &u, const int &ncols)
Gauss-Seidel iteration starting from the first row.
void backwardsweep (const Eigen::SparseMatrix< EleType > &A, const Eigen::Matrix< EleType, -1, 1 > &b, Eigen::Matrix< EleType, -1, 1 > &u, const int &ncols)
Gauss-Seidel iteration starting from the last row.
EleType tolerance {1e-9}
Tolerance below which a smoother is considered to have converged.
size_t compute_error_every_n_iters {100}
Compute the error every n
iterations during smoothing.
size_t n_iters {1}
Maximum number of iterations before smoothing termination.
template<class EleType>
class AMG::SparseGaussSeidel< EleType >
Symmetric Gauss-Seidel smoother for sparse systems.
The forward and backward sweep are not strictly both necessary, it seems like most numerical linear algebra books (E.g., Heath's "Scientific Computing") only propose one sweep as the algorithm. For completeness, however, Ref [2] does assert the justification of the so-called symmetric sweep.
References
[1] : smoother.jl in AlgebraicMultigrid.jl
[2] : Strang2006 MIT 18.086 Lecture: Iterative Methods
[3] : Julia Lang: Dot product as linear combination
Template Parameters
◆ SparseGaussSeidel()
Construct a new Sparse Gauss Seidel object for pre/post smoother in AMG .
◆ backwardsweep()
template<class EleType >
void AMG::SparseGaussSeidel < EleType >::backwardsweep
(
const Eigen::SparseMatrix< EleType > & A ,
const Eigen::Matrix< EleType, -1, 1 > & b ,
Eigen::Matrix< EleType, -1, 1 > & u ,
const int & ncols )
inline private
Gauss-Seidel iteration starting from the last row.
Parameters
A Coefficients matrix for discretized governing equations.
b Right hand side of linear system Au = b
.
u Solution to linear system of equations.
nrows
◆ forwardsweep()
template<class EleType >
void AMG::SparseGaussSeidel < EleType >::forwardsweep
(
const Eigen::SparseMatrix< EleType > & A ,
const Eigen::Matrix< EleType, -1, 1 > & b ,
Eigen::Matrix< EleType, -1, 1 > & u ,
const int & ncols )
inline private
Gauss-Seidel iteration starting from the first row.
Parameters
A Coefficients matrix for discretized governing equations.
b Right hand side of linear system Au = b
.
u Solution to linear system of equations.
nrows
◆ matvecprod()
template<class EleType >
void AMG::SparseGaussSeidel < EleType >::matvecprod
(
int col ,
EleType & rsum ,
EleType & diag ,
const EleType & z ,
const Eigen::SparseMatrix< EleType > & A ,
const Eigen::Matrix< EleType, -1, 1 > & u )
inline private
Modified sparse matvec product of Au
for Gauss-Seidel sweeps.
The results of this operation update rsum
and diag
inplace.
Parameters
col Index of the column for which you desire sparse row indices and values.
rsum Sum representing the matvec product.
diag Value of diagonal for particular column of CSC matrix.
z Zero value
A Coefficients matrix for discretized governing equations.
u Solution to linear system of equations.
◆ smooth()
template<class EleType >
void AMG::SparseGaussSeidel < EleType >::smooth
(
const Eigen::SparseMatrix< EleType > & A ,
Eigen::Matrix< EleType, -1, 1 > & u ,
const Eigen::Matrix< EleType, -1, 1 > & b )
inline virtual
Must implement function that smooths Au = b
.
Parameters
A Coefficients matrix for discretized governing equations. Coeffcients matrix for linear system of equations.
u Solution to linear system of equations.
b Right hand side of linear system Au = b
. Right hand side of linear system of equations.
Implements AMG::SmootherBase< EleType > .
◆ update()
template<class EleType >
void AMG::SparseGaussSeidel < EleType >::update
(
int col ,
const Eigen::SparseMatrix< EleType > & A ,
const Eigen::Matrix< EleType, -1, 1 > & b ,
Eigen::Matrix< EleType, -1, 1 > & u )
inline private
Updates a single entry in u
inplace using the definition of a Gauss-Seidel.
Parameters
col
A Coefficients matrix for discretized governing equations.
b Right hand side of linear system Au = b
.
u Solution to linear system of equations.
The documentation for this class was generated from the following file: