Reference documentation for deal.II version 9.1.0-pre
Classes | Public Types | Public Member Functions | Protected Attributes | Static Private Member Functions | List of all members
ArpackSolver Class Reference

#include <deal.II/lac/arpack_solver.h>

Inheritance diagram for ArpackSolver:
[legend]

Classes

struct  AdditionalData
 

Public Types

using size_type = types::global_dof_index
 

Public Member Functions

SolverControlcontrol () const
 
 ArpackSolver (SolverControl &control, const AdditionalData &data=AdditionalData())
 
template<typename VectorType >
void set_initial_vector (const VectorType &vec)
 
void set_shift (const std::complex< double > sigma)
 
template<typename VectorType , 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=0)
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&) noexcept
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&) noexcept
 
void subscribe (const char *identifier=nullptr) const
 
void unsubscribe (const char *identifier=nullptr) 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

SolverControlsolver_control
 
const AdditionalData additional_data
 
bool initial_vector_provided
 
double sigmar
 
double sigmai
 

Static Private Member Functions

static::ExceptionBase & ArpackExcInvalidNumberofEigenvalues (int arg1, int arg2)
 
static::ExceptionBase & ArpackExcInvalidEigenvectorSize (int arg1, int arg2)
 
static::ExceptionBase & ArpackExcInvalidEigenvectorSizeNonsymmetric (int arg1, int arg2)
 
static::ExceptionBase & ArpackExcInvalidEigenvalueSize (int arg1, int arg2)
 
static::ExceptionBase & ArpackExcInvalidNumberofArnoldiVectors (int arg1, int arg2)
 
static::ExceptionBase & ArpackExcSmallNumberofArnoldiVectors (int arg1, int arg2)
 
static::ExceptionBase & ArpackExcArpackIdo (int arg1)
 
static::ExceptionBase & ArpackExcArpackMode (int arg1)
 
static::ExceptionBase & ArpackExcArpackInfodsaupd (int arg1)
 
static::ExceptionBase & ArpackExcArpackInfodnaupd (int arg1)
 
static::ExceptionBase & ArpackExcArpackInfodseupd (int arg1)
 
static::ExceptionBase & ArpackExcArpackInfodneupd (int arg1)
 
static::ExceptionBase & ArpackExcArpackInfoMaxIt (int arg1)
 
static::ExceptionBase & ArpackExcArpackNoShifts ()
 

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)
 

Detailed Description

Interface for using ARPACK. ARPACK is a collection of Fortran77 subroutines designed to solve large scale eigenvalue problems. Here we interface to the routines dnaupd and dneupd of ARPACK. If the operator is specified to be symmetric we use the symmetric interface dsaupd and dseupd of ARPACK instead. 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 with serial objects in the following way:

system.solve (A, B, OP, lambda, x, size_of_spectrum);

for the generalized eigenvalue problem \(Ax=B\lambda x\), where the variable size_of_spectrum tells ARPACK the number of eigenvector/eigenvalue pairs to solve for. Here, lambda is a vector that will contain the eigenvalues computed, x a vector that will contain the eigenvectors computed, and OP is an inverse operation for the matrix A. Shift and invert transformation around zero is applied.

Through the AdditionalData the user can specify some of the parameters to be set.

For further information on how the ARPACK routines dsaupd, dseupd, dnaupd and dneupd work and also how to set the parameters appropriately please take a look into the ARPACK manual.

Note
Whenever you eliminate degrees of freedom using AffineConstraints, you generate spurious eigenvalues and eigenvectors. If you make sure that the diagonals of eliminated matrix rows are all equal to one, you get a single additional eigenvalue. But beware that some functions in deal.II set these diagonals to rather arbitrary (from the point of view of eigenvalue problems) values. See also step-36 for an example.
Author
Baerbel Janssen, Agnieszka Miedlar, 2010, Guido Kanschat 2015, Joscha Gedicke 2016

Definition at line 169 of file arpack_solver.h.

Member Typedef Documentation

Declare the type for container size.

Definition at line 175 of file arpack_solver.h.

Member Enumeration Documentation

An enum that lists the possible choices for which eigenvalues to compute in the solve() function.

Enumerator
algebraically_largest 

The algebraically largest eigenvalues.

algebraically_smallest 

The algebraically smallest eigenvalues.

largest_magnitude 

The eigenvalue with the largest magnitudes.

smallest_magnitude 

The eigenvalue with the smallest magnitudes.

largest_real_part 

The eigenvalues with the largest real parts.

smallest_real_part 

The eigenvalues with the smallest real parts.

largest_imaginary_part 

The eigenvalues with the largest imaginary parts.

smallest_imaginary_part 

The eigenvalues with the smallest imaginary parts.

both_ends 

Compute half of the eigenvalues from the high end of the spectrum and the other half from the low end. If the number of requested eigenvectors is odd, then the extra eigenvector comes from the high end of the spectrum.

Definition at line 182 of file arpack_solver.h.

Constructor & Destructor Documentation

ArpackSolver::ArpackSolver ( SolverControl control,
const AdditionalData data = AdditionalData() 
)
inline

Constructor.

Definition at line 489 of file arpack_solver.h.

Member Function Documentation

SolverControl & ArpackSolver::control ( ) const
inline

Access to the object that controls convergence.

Definition at line 879 of file arpack_solver.h.

template<typename VectorType >
void ArpackSolver::set_initial_vector ( const VectorType &  vec)
inline

Set initial vector for building Krylov space.

Definition at line 511 of file arpack_solver.h.

void ArpackSolver::set_shift ( const std::complex< double >  sigma)
inline

Set shift sigma for shift-and-invert spectral transformation.

If this function is not called, the shift is assumed to be zero.

Definition at line 501 of file arpack_solver.h.

template<typename VectorType , typename MatrixType1 , typename MatrixType2 , typename INVERSE >
void ArpackSolver::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 = 0 
)
inline

Solve the generalized eigensprectrum problem \(A x=\lambda B x\) by calling the dsaupd and dseupd or dnaupd and dneupd functions of ARPACK.

The function returns a vector of eigenvalues of length n and a vector of eigenvectors of length n in the symmetric case and of length n+1 in the non-symmetric case. In the symmetric case all eigenvectors are real. In the non-symmetric case complex eigenvalues always occur as complex conjugate pairs. Therefore the eigenvector for an eigenvalue with nonzero complex part is stored by putting the real and the imaginary parts in consecutive real-valued vectors. The eigenvector of the complex conjugate eigenvalue does not need to be stored, since it is just the complex conjugate of the stored eigenvector. Thus, if the last n-th eigenvalue has a nonzero imaginary part, Arpack needs in total n+1 real-valued vectors to store real and imaginary parts of the eigenvectors.

Parameters
AThe operator for which we want to compute eigenvalues. Actually, this parameter is entirely unused.
BThe inner product of the underlying space, typically the mass matrix. For constrained problems, it can be a partial mass matrix, like for instance the velocity mass matrix of a Stokes problem. Only its function vmult() is used.
inverseThis is the possibly shifted inverse that is actually used instead of A. Only its function vmult() is used.
eigenvaluesis a vector of complex numbers in which the eigenvalues are returned.
eigenvectorsis a real vector of eigenvectors, containing the real parts of all eigenvectors and the imaginary parts of the eigenvectors corresponding to complex conjugate eigenvalue pairs. Therefore, its length should be n in the symmetric case and n+1 in the non-symmetric case. In the non-symmetric case the storage scheme leads for example to the following pattern. Suppose that the first two eigenvalues are real and the third and fourth are a complex conjugate pair. Asking for three eigenpairs results in [real(v1),real(v2), real(v3),imag(v3)]. Note that we get the same pattern if we ask for four eigenpairs in this example, since the fourth eigenvector is simply the complex conjugate of the third one.
n_eigenvaluesThe purpose of this parameter is not clear, but it is safe to set it to the size of eigenvalues or greater. Leave it at its default zero, which will be reset to the size of eigenvalues internally.

Definition at line 525 of file arpack_solver.h.

Member Data Documentation

SolverControl& ArpackSolver::solver_control
protected

Reference to the object that controls convergence of the iterative solver.

Definition at line 351 of file arpack_solver.h.

const AdditionalData ArpackSolver::additional_data
protected

Store a copy of the flags for this particular solver.

Definition at line 356 of file arpack_solver.h.

bool ArpackSolver::initial_vector_provided
protected

Store an initial vector

Definition at line 361 of file arpack_solver.h.

double ArpackSolver::sigmar
protected

Real part of the shift

Definition at line 367 of file arpack_solver.h.

double ArpackSolver::sigmai
protected

Imaginary part of the shift

Definition at line 372 of file arpack_solver.h.


The documentation for this class was generated from the following file: