Reference documentation for deal.II version 9.2.0
|
#include <deal.II/lac/parpack_solver.h>
Classes | |
struct | AdditionalData |
Public Member Functions | |
SolverControl & | control () const |
PArpackSolver (SolverControl &control, const MPI_Comm &mpi_communicator, const AdditionalData &data=AdditionalData()) | |
void | reinit (const IndexSet &locally_owned_dofs) |
void | reinit (const IndexSet &locally_owned_dofs, const std::vector< IndexSet > &partitioning) |
void | reinit (const VectorType &distributed_vector) |
void | set_initial_vector (const VectorType &vec) |
void | set_shift (const std::complex< double > sigma) |
template<typename MatrixType1 , typename MatrixType2 , typename INVERSE > | |
void | solve (const MatrixType1 &A, const MatrixType2 &B, const INVERSE &inverse, std::vector< std::complex< double >> &eigenvalues, std::vector< VectorType > &eigenvectors, const unsigned int n_eigenvalues) |
template<typename MatrixType1 , typename MatrixType2 , typename INVERSE > | |
void | solve (const MatrixType1 &A, const MatrixType2 &B, const INVERSE &inverse, std::vector< std::complex< double >> &eigenvalues, std::vector< VectorType * > &eigenvectors, const unsigned int n_eigenvalues) |
std::size_t | memory_consumption () const |
Public Member Functions inherited from Subscriptor | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
Subscriptor (Subscriptor &&) noexcept | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
Subscriptor & | operator= (Subscriptor &&) noexcept |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
template<typename StreamType > | |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Protected Attributes | |
SolverControl & | solver_control |
const AdditionalData | additional_data |
MPI_Comm | mpi_communicator |
MPI_Fint | mpi_communicator_fortran |
int | lworkl |
std::vector< double > | workl |
std::vector< double > | workd |
int | nloc |
int | ncv |
int | ldv |
std::vector< double > | v |
bool | initial_vector_provided |
std::vector< double > | resid |
int | ldz |
std::vector< double > | z |
int | lworkev |
std::vector< double > | workev |
std::vector< int > | select |
VectorType | src |
VectorType | dst |
VectorType | tmp |
std::vector< types::global_dof_index > | local_indices |
double | sigmar |
double | sigmai |
Private Member Functions | |
void | internal_reinit (const IndexSet &locally_owned_dofs) |
Static Private Member Functions | |
static ::ExceptionBase & | PArpackExcConvergedEigenvectors (int arg1, int arg2) |
static ::ExceptionBase & | PArpackExcInvalidNumberofEigenvalues (int arg1, int arg2) |
static ::ExceptionBase & | PArpackExcInvalidEigenvectorSize (int arg1, int arg2) |
static ::ExceptionBase & | PArpackExcInvalidEigenvectorSizeNonsymmetric (int arg1, int arg2) |
static ::ExceptionBase & | PArpackExcInvalidEigenvalueSize (int arg1, int arg2) |
static ::ExceptionBase & | PArpackExcInvalidNumberofArnoldiVectors (int arg1, int arg2) |
static ::ExceptionBase & | PArpackExcSmallNumberofArnoldiVectors (int arg1, int arg2) |
static ::ExceptionBase & | PArpackExcIdo (int arg1) |
static ::ExceptionBase & | PArpackExcMode (int arg1) |
static ::ExceptionBase & | PArpackExcInfoPdnaupd (int arg1) |
static ::ExceptionBase & | PArpackExcInfoPdneupd (int arg1) |
static ::ExceptionBase & | PArpackExcInfoMaxIt (int arg1) |
static ::ExceptionBase & | PArpackExcNoShifts (int arg1) |
Additional Inherited Members | |
Static Public Member Functions inherited from Subscriptor | |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
Interface for using PARPACK. PARPACK is a collection of Fortran77 subroutines designed to solve large scale eigenvalue problems. Here we interface to the routines pdneupd
, pdseupd
, pdnaupd
, pdsaupd
of PARPACK. The package is designed to compute a few eigenvalues and corresponding eigenvectors of a general n by n matrix A. It is most appropriate for large sparse matrices A.
In this class we make use of the method applied to the generalized eigenspectrum problem \((A-\lambda B)x=0\), for \(x\neq0\); where \(A\) is a system matrix, \(B\) is a mass matrix, and \(\lambda, x\) are a set of eigenvalues and eigenvectors respectively.
The ArpackSolver can be used in application codes in the following way:
for the generalized eigenvalue problem \(Ax=B\lambda x\), where the variable size_of_spectrum
tells PARPACK the number of eigenvector/eigenvalue pairs to solve for. Here, lambda
is a vector that will contain the eigenvalues computed, x
a vector of objects of type V
that will contain the eigenvectors computed.
Currently, only three modes of (P)Arpack are implemented. In mode 3 (default), OP
is an inverse operation for the matrix A - sigma * B
, where sigma
is a shift value, set to zero by default. Whereas in mode 2, OP
is an inverse of M
. Finally, mode 1 corresponds to standard eigenvalue problem without spectral transformation \(Ax=\lambda x\). The mode can be specified via AdditionalData object. Note that for shift-and-invert (mode=3), the sought eigenpairs are those after the spectral transformation is applied.
The OP
can be specified by using a LinearOperator:
The class is intended to be used with MPI and can work on arbitrary vector and matrix distributed classes. Both symmetric and non-symmetric A
are supported.
For further information on how the PARPACK routines pdneupd
, pdseupd
, pdnaupd
, pdsaupd
work and also how to set the parameters appropriately please take a look into the PARPACK manual.
Definition at line 213 of file parpack_solver.h.
using PArpackSolver< VectorType >::size_type = types::global_dof_index |
Declare the type for container size.
Definition at line 219 of file parpack_solver.h.
enum PArpackSolver::WhichEigenvalues |
An enum that lists the possible choices for which eigenvalues to compute in the solve() function. Note, that this corresponds to the problem after shift-and-invert (the only currently supported spectral transformation) is applied.
A particular choice is limited based on symmetric or non-symmetric matrix A
considered.
Definition at line 230 of file parpack_solver.h.
PArpackSolver< VectorType >::PArpackSolver | ( | SolverControl & | control, |
const MPI_Comm & | mpi_communicator, | ||
const AdditionalData & | data = AdditionalData() |
||
) |
Constructor.
Definition at line 642 of file parpack_solver.h.
SolverControl & PArpackSolver< VectorType >::control |
Access to the object that controls convergence.
Definition at line 1161 of file parpack_solver.h.
void PArpackSolver< VectorType >::reinit | ( | const IndexSet & | locally_owned_dofs | ) |
Initialize internal variables.
Definition at line 728 of file parpack_solver.h.
void PArpackSolver< VectorType >::reinit | ( | const IndexSet & | locally_owned_dofs, |
const std::vector< IndexSet > & | partitioning | ||
) |
Initialize internal variables when working with BlockVectors. locally_owned_dofs
is used to set the dimension of the problem, whereas partitioning
is used for calling the reinit of the deal.II blockvectors used.
Definition at line 756 of file parpack_solver.h.
void PArpackSolver< VectorType >::reinit | ( | const VectorType & | distributed_vector | ) |
Initialize internal variables from the input distributed_vector
.
Definition at line 742 of file parpack_solver.h.
void PArpackSolver< VectorType >::set_initial_vector | ( | const VectorType & | vec | ) |
Set initial vector for building Krylov space.
Definition at line 674 of file parpack_solver.h.
void PArpackSolver< VectorType >::set_shift | ( | const std::complex< double > | sigma | ) |
Set shift sigma
for shift-and-invert spectral transformation.
If this function is not called, the shift is assumed to be zero.
mode=3
(see the general documentation of this class for a definition of what the different modes are). Definition at line 664 of file parpack_solver.h.
void PArpackSolver< VectorType >::solve | ( | const MatrixType1 & | A, |
const MatrixType2 & | B, | ||
const INVERSE & | inverse, | ||
std::vector< std::complex< double >> & | eigenvalues, | ||
std::vector< VectorType > & | eigenvectors, | ||
const unsigned int | n_eigenvalues | ||
) |
Solve the generalized eigensprectrum problem \(A x=\lambda B x\) by calling the pd(n/s)eupd
and pd(n/s)aupd
functions of PARPACK.
In mode=3
, inverse
should correspond to \([A-\sigma B]^{-1}\), whereas in mode=2
it should represent \(B^{-1}\). For mode=1
both B
and inverse
are ignored.
Definition at line 772 of file parpack_solver.h.
void PArpackSolver< VectorType >::solve | ( | const MatrixType1 & | A, |
const MatrixType2 & | B, | ||
const INVERSE & | inverse, | ||
std::vector< std::complex< double >> & | eigenvalues, | ||
std::vector< VectorType * > & | eigenvectors, | ||
const unsigned int | n_eigenvalues | ||
) |
Same as above but takes eigenvectors as pointers.
Definition at line 790 of file parpack_solver.h.
std::size_t PArpackSolver< VectorType >::memory_consumption |
Return the memory consumption of this class in bytes.
Definition at line 591 of file parpack_solver.h.
|
private |
Initialize internal variables which depend on locally_owned_dofs
.
This function is called inside the reinit() functions
Definition at line 688 of file parpack_solver.h.
|
protected |
Reference to the object that controls convergence of the iterative solver.
Definition at line 383 of file parpack_solver.h.
|
protected |
Store a copy of the flags for this particular solver.
Definition at line 388 of file parpack_solver.h.
|
protected |
C++ MPI communicator.
Definition at line 395 of file parpack_solver.h.
|
protected |
Fortran MPI communicator.
Definition at line 400 of file parpack_solver.h.
|
protected |
Length of the work array workl.
Definition at line 407 of file parpack_solver.h.
|
protected |
Double precision work array of length lworkl
Definition at line 412 of file parpack_solver.h.
|
protected |
Double precision work array of length 3*N
Definition at line 417 of file parpack_solver.h.
|
protected |
Number of local degrees of freedom.
Definition at line 422 of file parpack_solver.h.
|
protected |
Number of Arnoldi basis vectors specified in additional_data
Definition at line 427 of file parpack_solver.h.
|
protected |
The leading dimension of the array v
Definition at line 433 of file parpack_solver.h.
|
protected |
Double precision vector of size ldv by NCV. Will contains the final set of Arnoldi basis vectors.
Definition at line 439 of file parpack_solver.h.
|
protected |
An auxiliary flag which is set to true when initial vector is provided.
Definition at line 444 of file parpack_solver.h.
|
protected |
The initial residual vector, possibly from a previous run. On output, it contains the final residual vector.
Definition at line 450 of file parpack_solver.h.
|
protected |
The leading dimension of the array Z equal to nloc.
Definition at line 455 of file parpack_solver.h.
|
protected |
A vector of minimum size of nloc by NEV+1. Z contains the B-orthonormal Ritz vectors of the eigensystem A*z = lambda*B*z corresponding to the Ritz value approximations.
Definition at line 462 of file parpack_solver.h.
|
protected |
The size of the workev array.
Definition at line 467 of file parpack_solver.h.
|
protected |
Double precision work array of dimension 3* NCV.
Definition at line 472 of file parpack_solver.h.
|
protected |
A vector of dimension NCV.
Definition at line 477 of file parpack_solver.h.
|
protected |
Temporary vectors used between Arpack and deal.II
Definition at line 482 of file parpack_solver.h.
|
protected |
Definition at line 482 of file parpack_solver.h.
|
protected |
Definition at line 482 of file parpack_solver.h.
|
protected |
Indices of local degrees of freedom.
Definition at line 487 of file parpack_solver.h.
|
protected |
Real part of the shift
Definition at line 492 of file parpack_solver.h.
|
protected |
Imaginary part of the shift
Definition at line 497 of file parpack_solver.h.