![]() |
|
The GMRES method rewritten for complex matrices. More...
#include <complex_smoother.h>
Public Member Functions | |
ComplexGMRES () | |
Constructor. More... | |
~ComplexGMRES () | |
Empty destructor. More... | |
ComplexGMRES (const ComplexGMRES &)=delete | |
Broken copy constructor. More... | |
void | operator= (const ComplexGMRES &)=delete |
Broken assignment operator. More... | |
void | disable_resolve () |
Overload disable resolve so that it cleans up memory too. More... | |
void | solve (Problem *const &problem_pt, DoubleVector &result) |
void | solve (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
unsigned | iterations () const |
Number of iterations taken. More... | |
void | complex_smoother_setup (Vector< CRDoubleMatrix * > helmholtz_matrix_pt) |
Setup: Pass pointer to the matrix and store in cast form. More... | |
void | complex_smoother_solve (const Vector< DoubleVector > &rhs, Vector< DoubleVector > &solution) |
![]() | |
HelmholtzSmoother () | |
Empty constructor. More... | |
virtual | ~HelmholtzSmoother () |
Virtual empty destructor. More... | |
void | complex_matrix_multiplication (Vector< CRDoubleMatrix * > matrices_pt, const Vector< DoubleVector > &x, Vector< DoubleVector > &soln) |
template<typename MATRIX > | |
void | check_validity_of_solve_helper_inputs (CRDoubleMatrix *const &real_matrix_pt, CRDoubleMatrix *const &imag_matrix_pt, const Vector< DoubleVector > &rhs, Vector< DoubleVector > &solution, const double &n_dof) |
![]() | |
IterativeLinearSolver () | |
IterativeLinearSolver (const IterativeLinearSolver &)=delete | |
Broken copy constructor. More... | |
void | operator= (const IterativeLinearSolver &)=delete |
Broken assignment operator. More... | |
virtual | ~IterativeLinearSolver () |
Destructor (empty) More... | |
Preconditioner *& | preconditioner_pt () |
Access function to preconditioner. More... | |
Preconditioner *const & | preconditioner_pt () const |
Access function to preconditioner (const version) More... | |
double & | tolerance () |
Access to convergence tolerance. More... | |
unsigned & | max_iter () |
Access to max. number of iterations. More... | |
void | enable_doc_convergence_history () |
Enable documentation of the convergence history. More... | |
void | disable_doc_convergence_history () |
Disable documentation of the convergence history. More... | |
void | open_convergence_history_file_stream (const std::string &file_name, const std::string &zone_title="") |
void | close_convergence_history_file_stream () |
Close convergence history output stream. More... | |
double | jacobian_setup_time () const |
double | linear_solver_solution_time () const |
return the time taken to solve the linear system More... | |
virtual double | preconditioner_setup_time () const |
returns the the time taken to setup the preconditioner More... | |
void | enable_setup_preconditioner_before_solve () |
Setup the preconditioner before the solve. More... | |
void | disable_setup_preconditioner_before_solve () |
Don't set up the preconditioner before the solve. More... | |
void | enable_error_after_max_iter () |
Throw an error if we don't converge within max_iter. More... | |
void | disable_error_after_max_iter () |
Don't throw an error if we don't converge within max_iter (default). More... | |
void | enable_iterative_solver_as_preconditioner () |
void | disable_iterative_solver_as_preconditioner () |
![]() | |
LinearSolver () | |
Empty constructor, initialise the member data. More... | |
LinearSolver (const LinearSolver &dummy)=delete | |
Broken copy constructor. More... | |
void | operator= (const LinearSolver &)=delete |
Broken assignment operator. More... | |
virtual | ~LinearSolver () |
Empty virtual destructor. More... | |
void | enable_doc_time () |
Enable documentation of solve times. More... | |
void | disable_doc_time () |
Disable documentation of solve times. More... | |
bool | is_doc_time_enabled () const |
Is documentation of solve times enabled? More... | |
bool | is_resolve_enabled () const |
Boolean flag indicating if resolves are enabled. More... | |
virtual void | enable_resolve () |
virtual void | solve (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
virtual void | solve_transpose (Problem *const &problem_pt, DoubleVector &result) |
virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
virtual void | resolve (const DoubleVector &rhs, DoubleVector &result) |
virtual void | resolve_transpose (const DoubleVector &rhs, DoubleVector &result) |
virtual void | enable_computation_of_gradient () |
void | disable_computation_of_gradient () |
void | reset_gradient () |
void | get_gradient (DoubleVector &gradient) |
function to access the gradient, provided it has been computed More... | |
![]() | |
DistributableLinearAlgebraObject () | |
Default constructor - create a distribution. More... | |
DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const DistributableLinearAlgebraObject &)=delete |
Broken assignment operator. More... | |
virtual | ~DistributableLinearAlgebraObject () |
Destructor. More... | |
LinearAlgebraDistribution * | distribution_pt () const |
access to the LinearAlgebraDistribution More... | |
unsigned | nrow () const |
access function to the number of global rows. More... | |
unsigned | nrow_local () const |
access function for the num of local rows on this processor. More... | |
unsigned | nrow_local (const unsigned &p) const |
access function for the num of local rows on this processor. More... | |
unsigned | first_row () const |
access function for the first row on this processor More... | |
unsigned | first_row (const unsigned &p) const |
access function for the first row on this processor More... | |
bool | distributed () const |
distribution is serial or distributed More... | |
bool | distribution_built () const |
void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
void | build_distribution (const LinearAlgebraDistribution &dist) |
Private Member Functions | |
void | clean_up_memory () |
Cleanup data that's stored for resolve (if any has been stored) More... | |
void | complex_solve_helper (const Vector< DoubleVector > &rhs, Vector< DoubleVector > &solution) |
This is where the actual work is done. More... | |
void | update (const unsigned &k, const Vector< Vector< std::complex< double >>> &hessenberg, const Vector< std::complex< double >> &s, const Vector< Vector< DoubleVector >> &v, Vector< DoubleVector > &x) |
Helper function to update the result vector. More... | |
void | generate_plane_rotation (std::complex< double > &dx, std::complex< double > &dy, std::complex< double > &cs, std::complex< double > &sn) |
void | apply_plane_rotation (std::complex< double > &dx, std::complex< double > &dy, std::complex< double > &cs, std::complex< double > &sn) |
Private Attributes | |
unsigned | Iterations |
Number of iterations taken. More... | |
Vector< CRDoubleMatrix * > | Matrices_storage_pt |
Vector of pointers to the real and imaginary part of the system matrix. More... | |
bool | Resolving |
bool | Matrix_can_be_deleted |
The GMRES method rewritten for complex matrices.
|
inline |
Constructor.
|
inline |
Empty destructor.
References oomph::ComplexGMRES< MATRIX >::clean_up_memory().
|
delete |
Broken copy constructor.
|
inlineprivate |
Helper function: Apply plane rotation. This is done using the update:
\[ \begin{bmatrix} dx \\ dy \end{bmatrix} \leftarrow \begin{bmatrix} \overline{\cos\theta} & \overline{\sin\theta} \\ -\sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix} dx \\ dy \end{bmatrix}. \]
Taken from: Saad Y."Iterative methods for sparse linear systems", p.193.
References conj().
|
inlineprivatevirtual |
Cleanup data that's stored for resolve (if any has been stored)
Reimplemented from oomph::LinearSolver.
References oomph::ComplexGMRES< MATRIX >::Matrices_storage_pt, and oomph::ComplexGMRES< MATRIX >::Matrix_can_be_deleted.
Referenced by oomph::ComplexGMRES< MATRIX >::disable_resolve(), and oomph::ComplexGMRES< MATRIX >::~ComplexGMRES().
|
inlinevirtual |
Setup: Pass pointer to the matrix and store in cast form.
Implements oomph::HelmholtzSmoother.
References oomph::ComplexGMRES< MATRIX >::Matrices_storage_pt, oomph::ComplexGMRES< MATRIX >::Matrix_can_be_deleted, oomph::DistributableLinearAlgebraObject::nrow(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
inlinevirtual |
The smoother_solve function performs fixed number of iterations on the system A*result=rhs. The number of (smoothing) iterations is the same as the max. number of iterations in the underlying IterativeLinearSolver class.
Implements oomph::HelmholtzSmoother.
References oomph::ComplexGMRES< MATRIX >::complex_solve_helper(), BiharmonicTestFunctions1::solution(), and oomph::HelmholtzSmoother::Use_as_smoother.
|
private |
This is where the actual work is done.
References abs(), beta, conj(), hessenberg(), i, Global_Variables::Iterations, j, k, oomph::BlackBoxFDNewtonSolver::Max_iter, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, Eigen::bfloat16_impl::pow(), UniformPSDSelfTest::r, s, BiharmonicTestFunctions1::solution(), sqrt(), oomph::TimingHelpers::timer(), v, and w.
Referenced by oomph::ComplexGMRES< MATRIX >::complex_smoother_solve().
|
inlinevirtual |
Overload disable resolve so that it cleans up memory too.
Reimplemented from oomph::LinearSolver.
References oomph::ComplexGMRES< MATRIX >::clean_up_memory(), and oomph::LinearSolver::disable_resolve().
|
inlineprivate |
Helper function: Generate a plane rotation. This is done by finding the value of \( \cos(\theta) \) (i.e. cs) and the value of \( \sin(\theta) \) (i.e. sn) such that:
\[ \begin{bmatrix} \overline{\cos\theta} & \overline{\sin\theta} \cr -\sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix} dx \\ dy \end{bmatrix} = \begin{bmatrix} r \\ 0 \end{bmatrix}, \]
where \( r=\sqrt{pow(|dx|,2)+pow(|dy|,2)} \). The values of a and b are given by: The values of dx and dy are given by:
\[ \cos\theta&=\dfrac{dx}{\sqrt{|dx|^2+|dy|^2}}, \]
and
\[ \sin\theta&=\dfrac{dy}{\sqrt{|dx|^2+|dy|^2}}. \]
Taken from: Saad Y."Iterative methods for sparse linear systems", p.193. We also check to see that sn is always a real (nonnegative) number. See pp.193-194 for an explanation.
References abs(), boost::multiprecision::fabs(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Eigen::bfloat16_impl::pow(), sqrt(), and oomph::IterativeLinearSolver::tolerance().
|
inlinevirtual |
Number of iterations taken.
Implements oomph::IterativeLinearSolver.
References oomph::ComplexGMRES< MATRIX >::Iterations.
|
delete |
Broken assignment operator.
|
inlinevirtual |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system Call the broken base-class version. If you want this, please implement it
Reimplemented from oomph::LinearSolver.
References oomph::LinearSolver::solve().
|
inlinevirtual |
Solver: Takes pointer to problem and returns the results vector which contains the solution of the linear system defined by the problem's fully assembled Jacobian and residual vector.
Implements oomph::LinearSolver.
References OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::Global_string_for_annotation::string().
|
inlineprivate |
Helper function to update the result vector.
References hessenberg(), i, imag(), j, k, s, v, plotDoE::x, and y.
Referenced by smc.smc::recursiveBayesian().
|
private |
Number of iterations taken.
Referenced by oomph::ComplexGMRES< MATRIX >::iterations().
|
private |
Vector of pointers to the real and imaginary part of the system matrix.
Referenced by oomph::ComplexGMRES< MATRIX >::clean_up_memory(), and oomph::ComplexGMRES< MATRIX >::complex_smoother_setup().
|
private |
Boolean flag to indicate if the real and imaginary system matrices can be deleted
Referenced by oomph::ComplexGMRES< MATRIX >::clean_up_memory(), and oomph::ComplexGMRES< MATRIX >::complex_smoother_setup().
|
private |
Boolean flag to indicate if the solve is done in re-solve mode, bypassing setup of matrix and preconditioner