![]() |
Reference documentation for deal.II version 8.1.0
|
#include <slepc_solver.h>
Classes | |
struct | SolverData |
Public Member Functions | |
SolverBase (SolverControl &cn, const MPI_Comm &mpi_communicator) | |
virtual | ~SolverBase () |
template<typename OutputVector > | |
void | solve (const PETScWrappers::MatrixBase &A, std::vector< PetscScalar > &eigenvalues, std::vector< OutputVector > &eigenvectors, const unsigned int n_eigenpairs=1) |
template<typename OutputVector > | |
void | solve (const PETScWrappers::MatrixBase &A, const PETScWrappers::MatrixBase &B, std::vector< PetscScalar > &eigenvalues, std::vector< OutputVector > &eigenvectors, const unsigned int n_eigenpairs=1) |
template<typename OutputVector > | |
void | solve (const PETScWrappers::MatrixBase &A, const PETScWrappers::MatrixBase &B, std::vector< double > &real_eigenvalues, std::vector< double > &imag_eigenvalues, std::vector< OutputVector > &real_eigenvectors, std::vector< OutputVector > &imag_eigenvectors, const unsigned int n_eigenpairs=1) |
void | set_initial_vector (const PETScWrappers::VectorBase &this_initial_vector) |
void | set_transformation (SLEPcWrappers::TransformationBase &this_transformation) |
void | set_target_eigenvalue (const PetscScalar &this_target) |
void | set_which_eigenpairs (EPSWhich set_which) |
void | set_problem_type (EPSProblemType set_problem) |
void | get_solver_state (const SolverControl::State state) |
DeclException0 (ExcSLEPcWrappersUsageError) | |
DeclException1 (ExcSLEPcError, int,<< " An error with error number "<< arg1<< " occurred while calling a SLEPc function") | |
DeclException2 (ExcSLEPcEigenvectorConvergenceMismatchError, int, int,<< " The number of converged eigenvectors is "<< arg1<< " but "<< arg2<< " were requested. ") | |
SolverControl & | control () const |
Protected Member Functions | |
virtual void | set_solver_type (EPS &eps) const =0 |
void | reset () |
EPS * | get_eps () |
void | solve (const unsigned int n_eigenpairs, unsigned int *n_converged) |
void | get_eigenpair (const unsigned int index, PetscScalar &eigenvalues, PETScWrappers::VectorBase &eigenvectors) |
void | get_eigenpair (const unsigned int index, double &real_eigenvalues, double &imag_eigenvalues, PETScWrappers::VectorBase &real_eigenvectors, PETScWrappers::VectorBase &imag_eigenvectors) |
void | set_matrices (const PETScWrappers::MatrixBase &A) |
void | set_matrices (const PETScWrappers::MatrixBase &A, const PETScWrappers::MatrixBase &B) |
Protected Attributes | |
SolverControl & | solver_control |
const MPI_Comm | mpi_communicator |
PetscScalar | target_eigenvalue |
EPSWhich | set_which |
EPSProblemType | set_problem |
Static Private Member Functions | |
static int | convergence_test (EPS eps, PetscScalar real_eigenvalue, PetscScalar imag_eigenvalue, PetscReal residual_norm, PetscReal *estimated_error, void *solver_control) |
Private Attributes | |
const PETScWrappers::MatrixBase * | opA |
const PETScWrappers::MatrixBase * | opB |
const PETScWrappers::VectorBase * | initial_vector |
SLEPcWrappers::TransformationBase * | transformation |
std_cxx1x::shared_ptr< SolverData > | solver_data |
Base class for solver classes using the SLEPc solvers. Since solvers in SLEPc are selected based on flags passed to a generic solver object, basically all the actual solver calls happen in this class, and derived classes simply set the right flags to select one solver or another, or to set certain parameters for individual solvers.
Definition at line 119 of file slepc_solver.h.
SLEPcWrappers::SolverBase::SolverBase | ( | SolverControl & | cn, |
const MPI_Comm & | mpi_communicator | ||
) |
Constructor. Takes the MPI communicator over which parallel computations are to happen.
|
virtual |
Destructor.
void SLEPcWrappers::SolverBase::solve | ( | const PETScWrappers::MatrixBase & | A, |
std::vector< PetscScalar > & | eigenvalues, | ||
std::vector< OutputVector > & | eigenvectors, | ||
const unsigned int | n_eigenpairs = 1 |
||
) |
Composite method that solves the eigensystem . The eigenvector sent in has to have at least one element that we can use as a template when resizing, since we do not know the parameters of the specific vector class used (i.e. local_dofs for MPI vectors). However, while copying eigenvectors, at least twice the memory size of
eigenvectors
is being used (and can be more). To avoid doing this, the fairly standard calling sequence executed here is used: Initialise; Set up matrices for solving; Actually solve the system; Gather the solution(s); and reset.
This is declared here to make it possible to take a std::vector of different PETScWrappers vector types
Definition at line 750 of file slepc_solver.h.
void SLEPcWrappers::SolverBase::solve | ( | const PETScWrappers::MatrixBase & | A, |
const PETScWrappers::MatrixBase & | B, | ||
std::vector< PetscScalar > & | eigenvalues, | ||
std::vector< OutputVector > & | eigenvectors, | ||
const unsigned int | n_eigenpairs = 1 |
||
) |
Same as above, but here a composite method for solving the system , for real matrices, vectors, and values
.
Definition at line 781 of file slepc_solver.h.
void SLEPcWrappers::SolverBase::solve | ( | const PETScWrappers::MatrixBase & | A, |
const PETScWrappers::MatrixBase & | B, | ||
std::vector< double > & | real_eigenvalues, | ||
std::vector< double > & | imag_eigenvalues, | ||
std::vector< OutputVector > & | real_eigenvectors, | ||
std::vector< OutputVector > & | imag_eigenvectors, | ||
const unsigned int | n_eigenpairs = 1 |
||
) |
Same as above, but here a composite method for solving the system with real matrices
and imaginary eigenpairs
.
Definition at line 818 of file slepc_solver.h.
void SLEPcWrappers::SolverBase::set_initial_vector | ( | const PETScWrappers::VectorBase & | this_initial_vector | ) |
Set the initial vector for the solver.
void SLEPcWrappers::SolverBase::set_transformation | ( | SLEPcWrappers::TransformationBase & | this_transformation | ) |
Set the spectral transformation to be used.
void SLEPcWrappers::SolverBase::set_target_eigenvalue | ( | const PetscScalar & | this_target | ) |
Set target eigenvalues in the spectrum to be computed. By default, no target is set.
void SLEPcWrappers::SolverBase::set_which_eigenpairs | ( | EPSWhich | set_which | ) |
Indicate which part of the spectrum is to be computed. By default largest magnitude eigenvalues are computed.
void SLEPcWrappers::SolverBase::set_problem_type | ( | EPSProblemType | set_problem | ) |
Specify the type of the eigenspectrum problem. This can be used to exploit known symmetries of the matrices that make up the standard/generalized eigenspectrum problem. By default a non-Hermitian problem is assumed.
void SLEPcWrappers::SolverBase::get_solver_state | ( | const SolverControl::State | state | ) |
Take the information provided from SLEPc and checks it against deal.II's own SolverControl objects to see if convergence has been reached.
SLEPcWrappers::SolverBase::DeclException0 | ( | ExcSLEPcWrappersUsageError | ) |
Exception. Standard exception.
SLEPcWrappers::SolverBase::DeclException1 | ( | ExcSLEPcError | , |
int | , | ||
<< " An error with error number "<< arg1<< " occurred while calling a SLEPc function" | |||
) |
Exception. SLEPc error with error number.
SLEPcWrappers::SolverBase::DeclException2 | ( | ExcSLEPcEigenvectorConvergenceMismatchError | , |
int | , | ||
int | , | ||
<< " The number of converged eigenvectors is "<< arg1<< " but "<< arg2<< " were requested. " | |||
) |
Exception. Convergence failure on the number of eigenvectors.
SolverControl& SLEPcWrappers::SolverBase::control | ( | ) | const |
Access to the object that controls convergence.
|
protectedpure virtual |
Function that takes an Eigenvalue Problem Solver context object, and sets the type of solver that is requested by the derived class.
Implemented in SLEPcWrappers::SolverLAPACK, SLEPcWrappers::SolverJacobiDavidson, SLEPcWrappers::SolverGeneralizedDavidson, SLEPcWrappers::SolverPower, SLEPcWrappers::SolverLanczos, SLEPcWrappers::SolverArnoldi, and SLEPcWrappers::SolverKrylovSchur.
|
protected |
Reset the solver, and return memory for eigenvectors
|
protected |
Retrieve the SLEPc solver object that is internally used.
|
protected |
Solve the linear system for n_eigenpairs
eigenstates. Parameter n_converged
contains the actual number of eigenstates that have converged; this can be both fewer or more than n_eigenpairs, depending on the SLEPc eigensolver used.
|
protected |
Access the real parts of solutions for a solved eigenvector problem, pair index solutions, .
|
protected |
Access the real and imaginary parts of solutions for a solved eigenvector problem, pair index solutions, .
|
protected |
Initialize solver for the linear system . (Note: this is required before calling solve ())
|
protected |
Same as above, but here initialize solver for the linear system .
|
staticprivate |
A function that can be used in SLEPc as a callback to check on convergence.
|
protected |
Reference to the object that controls convergence of the iterative solver.
Definition at line 269 of file slepc_solver.h.
|
protected |
Copy of the MPI communicator object to be used for the solver.
Definition at line 274 of file slepc_solver.h.
|
protected |
Target eigenvalue to solve for.
Definition at line 345 of file slepc_solver.h.
|
protected |
Which portion of the spectrum to solve from.
Definition at line 350 of file slepc_solver.h.
|
protected |
Set the eigenspectrum problem type.
Definition at line 355 of file slepc_solver.h.
|
private |
The matrix of the generalized eigenvalue problem
, or the standard eigenvalue problem
.
Definition at line 364 of file slepc_solver.h.
|
private |
The matrix of the generalized eigenvalue problem
.
Definition at line 370 of file slepc_solver.h.
|
private |
An initial vector used to "feed" some SLEPc solvers.
Definition at line 375 of file slepc_solver.h.
|
private |
Pointer to an an object that describes transformations that can be applied to the eigenvalue problem.
Definition at line 381 of file slepc_solver.h.
|
private |
Pointer to the SolverData
object.
Definition at line 428 of file slepc_solver.h.