29 #ifndef OOMPH_EIGEN_SOLVER_HEADER
30 #define OOMPH_EIGEN_SOLVER_HEADER
34 #include <oomph-lib-config.h>
51 class DoubleMatrixBase;
89 Vector<std::complex<double>>& eigenvalue,
91 const bool& do_adjoint_problem =
false) = 0;
108 Vector<std::complex<double>>& eigenvalue,
111 const bool& do_adjoint_problem =
false)
126 unsigned n = alpha.size();
127 eigenvalue.resize(n);
128 for (
unsigned i = 0;
i < n;
i++)
130 eigenvalue[
i] = alpha[
i] / beta[
i];
148 Vector<std::complex<double>>& alpha,
152 const bool& do_adjoint_problem =
false) = 0;
237 Vector<std::complex<double>>& eigenvalue,
239 const bool& do_adjoint_problem =
false);
256 Vector<std::complex<double>>& alpha,
260 const bool& do_adjoint_problem =
false)
262 oomph_info <<
"Broken, but then don't we want arpack to go anyway?\n";
343 Vector<std::complex<double>>& eigenvalue,
345 const bool& do_adjoint_problem =
false);
361 Vector<std::complex<double>>& alpha,
365 const bool& do_adjoint_problem =
false);
373 Vector<std::complex<double>>& eigenvalue,
396 Vector<std::complex<double>>& alpha,
405 std::ostringstream error_stream;
406 error_stream <<
"Failure in LAPACK_DGGEV(...).\n"
407 <<
"info = " << info << std::endl;
409 <<
"Diagnostics below are from \n\n"
410 <<
"http://www.netlib.org/lapack/explore-html/d9/d8e/"
411 "group__double_g_eeigen_ga4f59e87e670a755b41cbdd7e97f36bea.html"
415 error_stream << -info <<
"-th input arg had an illegal value\n";
419 error_stream <<
"The QZ iteration failed. No eigenvectors have been\n"
420 <<
"calculated, but ALPHAR(j), ALPHAI(j), and BETA(j)\n"
421 <<
"should be correct for j=INFO+1,...,N, where \n"
422 <<
"info = " << info <<
" and N = " << n << std::endl;
424 else if (info == (n + 1))
426 error_stream <<
"QZ iteration failed in DHGEQZ.\n";
428 else if (info == (n + 2))
430 error_stream <<
"error return from DTGEVC.\n";
433 <<
"Aborting here; if you know how to proceed then\n"
434 <<
"then implement ability to catch this error and continue\n";
437 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
444 std::ostringstream error_stream;
445 error_stream <<
"Failure in LAPACK_ZGGEV(...).\n"
446 <<
"info = " << info << std::endl;
447 error_stream <<
"Diagnostics below are from \n\n"
448 <<
"http://www.netlib.org/lapack/explore-html/"
449 <<
"db/d55/group__complex16_g_eeigen_ga79fcce20c"
450 <<
"617429ccf985e6f123a6171.html" << std::endl;
453 error_stream << -info <<
"-th input arg had an illegal value\n";
457 error_stream <<
"The QZ iteration failed. No eigenvectors have been\n"
458 <<
"calculated, but ALPHAR(j), ALPHAI(j), and BETA(j)\n"
459 <<
"should be correct for j=INFO+1,...,N, where \n"
460 <<
"info = " << info <<
" and N = " << n << std::endl;
462 else if (info == (n + 1))
464 error_stream <<
"QZ iteration failed in ZHGEQZ.\n";
466 else if (info == (n + 2))
468 error_stream <<
"error return from ZTGEVC.\n";
471 <<
"Aborting here; if you know how to proceed then\n"
472 <<
"then implement ability to catch this error and continue\n";
475 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
Class for the ARPACK eigensolver.
ARPACK(const ARPACK &)
Empty copy constructor.
void get_eigenvalues_right_of_shift()
Set the desired eigenvalues to be right of the shift.
int Spectrum
Integer to set whether the real, imaginary or magnitude is required to be small or large.
int NArnoldi
Number of Arnoldi vectors to compute.
void track_eigenvalue_imaginary_part()
Set the imaginary part fo the quantity of interest.
LinearSolver *const & linear_solver_pt() const
Return a pointer to the linear solver object (const version)
const int & narnoldi() const
Access function for the number of Arnoldi vectors (const version)
void solve_eigenproblem_legacy(Problem *const &problem_pt, const int &n_eval, Vector< std::complex< double >> &eigenvalue, Vector< DoubleVector > &eigenvector, const bool &do_adjoint_problem=false)
Solve the eigen problem.
int & narnoldi()
Access function for the number of Arnoldi vectors.
void get_eigenvalues_left_of_shift()
Set the desired eigenvalues to be left of the shift.
LinearSolver * Linear_solver_pt
Pointer to a linear solver.
virtual ~ARPACK()
Destructor, delete the linear solver.
void solve_eigenproblem(Problem *const &problem_pt, const int &n_eval, Vector< std::complex< double >> &alpha, Vector< double > &beta, Vector< DoubleVector > &eigenvector_real, Vector< DoubleVector > &eigenvector_imag, const bool &do_adjoint_problem=false)
Solve the real eigenproblem that is assembled by elements in a mesh in a Problem object....
void track_eigenvalue_magnitude()
Set the magnitude to be the quantity of interest.
void enable_compute_eigenvectors()
Set to enable the computation of the eigenvectors (default)
LinearSolver *& linear_solver_pt()
Return a pointer to the linear solver object.
bool Small
Boolean to set which part of the spectrum left (default) or right of the shifted value.
void track_eigenvalue_real_part()
Set the real part to be the quantity of interest (default)
LinearSolver * Default_linear_solver_pt
Pointer to a default linear solver.
void disable_compute_eigenvectors()
Set to disable the computation of the eigenvectors.
bool Compute_eigenvectors
Boolean to indicate whether or not to compute the eigenvectors.
Abstract base class for matrices of complex doubles – adds abstract interfaces for solving,...
Base class for any linear algebra object that is distributable. Just contains storage for the LinearA...
Base class for all EigenProblem solves. This simply defines standard interfaces so that different sol...
virtual ~EigenSolver()
Empty destructor.
EigenSolver(const EigenSolver &)
Empty copy constructor.
EigenSolver()
Empty constructor.
void set_shift(const double &shift_value)
Set the value of the (real) shift.
virtual void solve_eigenproblem(Problem *const &problem_pt, const int &n_eval, Vector< std::complex< double >> &alpha, Vector< double > &beta, Vector< DoubleVector > &eigenvector_real, Vector< DoubleVector > &eigenvector_imag, const bool &do_adjoint_problem=false)=0
Solve the real eigenproblem that is assembled by elements in a mesh in a Problem object....
double Sigma_real
Double value that represents the real part of the shift in shifted eigensolvers.
virtual void solve_eigenproblem(Problem *const &problem_pt, const int &n_eval, Vector< std::complex< double >> &eigenvalue, Vector< DoubleVector > &eigenvector_real, Vector< DoubleVector > &eigenvector_imag, const bool &do_adjoint_problem=false)
Solve the real eigenproblem that is assembled by elements in a mesh in a Problem object....
const double & get_shift() const
Return the value of the (real) shift (const version)
virtual void solve_eigenproblem_legacy(Problem *const &problem_pt, const int &n_eval, Vector< std::complex< double >> &eigenvalue, Vector< DoubleVector > &eigenvector, const bool &do_adjoint_problem=false)=0
Eigensolver. This takes a pointer to a problem and returns a vector of complex numbers representing t...
Class for the LAPACK QZ eigensolver.
void ZGGEV_error(const int &info, const int &n)
Provide diagonstic for ZGGEV error return.
void solve_eigenproblem_helper(Problem *const &problem_pt, const int &n_eval, Vector< std::complex< double >> &alpha, Vector< double > &beta, Vector< DoubleVector > &eigenvector)
Helper function called from legacy and updated version from "raw" lapack code.
void find_eigenvalues(const ComplexMatrixBase &A, const ComplexMatrixBase &M, Vector< std::complex< double >> &eigenvalue, Vector< Vector< std::complex< double >>> &eigenvector)
Find the eigenvalues of a complex generalised eigenvalue problem specified by . Note: the (real) shif...
double tolerance_for_ccness_check() const
Access to tolerance for checking complex conjugateness of eigenvalues (const version)
void operator=(const LAPACK_QZ &)=delete
Broken assignment operator.
void solve_eigenproblem(Problem *const &problem_pt, const int &n_eval, Vector< std::complex< double >> &alpha, Vector< double > &beta, Vector< DoubleVector > &eigenvector_real, Vector< DoubleVector > &eigenvector_imag, const bool &do_adjoint_problem=false)
Solve the real eigenproblem that is assembled by elements in a mesh in a Problem object....
void DGGEV_error(const int &info, const int &n)
Provide diagonstic for DGGEV error return.
double Tolerance_for_ccness_check
Tolerance for checking complex conjugateness of eigenvalues.
virtual ~LAPACK_QZ()
Empty desctructor.
void solve_eigenproblem_legacy(Problem *const &problem_pt, const int &n_eval, Vector< std::complex< double >> &eigenvalue, Vector< DoubleVector > &eigenvector, const bool &do_adjoint_problem=false)
Use LAPACK QZ to solve the real eigenproblem that is assembled by elements in a mesh in a Problem obj...
LAPACK_QZ()
Empty constructor.
LAPACK_QZ(const LAPACK_QZ &)=delete
Broken copy constructor.
double & tolerance_for_ccness_check()
Access to tolerance for checking complex conjugateness of eigenvalues.
Base class for all linear solvers. This merely defines standard interfaces for linear solvers,...
An OomphLibError object which should be thrown when an run-time error is encountered....
////////////////////////////////////////////////////////////////// //////////////////////////////////...
A slight extension to the standard template vector class so that we can include "graceful" array rang...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...