1
// Copyright (C) 2005-2006 Garth N. Wells.
2
// Licensed under the GNU GPL Version 2.
4
// First added: 2005-08-31
5
// Last changed: 2006-08-21
7
#ifndef __PETSC_EIGENVALUE_SOLVER_H
8
#define __PETSC_EIGENVALUE_SOLVER_H
13
#include <dolfin/Parametrized.h>
18
/// Forward declarations
22
/// This class computes eigenvalues of a matrix. It is
23
/// a wrapper for the eigenvalue solver SLEPc.
25
class PETScEigenvalueSolver: public Parametrized
29
/// Eigensolver methods
33
default_solver, // Default SLEPc solver (use when setting method from command line)
35
lapack, // LAPACK (all values, exact, only for small systems)
40
/// Create eigenvalue solver (use default solver type)
41
PETScEigenvalueSolver();
43
/// Create eigenvalue solver (specify solver type)
44
PETScEigenvalueSolver(Type solver);
47
~PETScEigenvalueSolver();
49
/// Compute all eigenpairs of the matrix A (solve Ax = \lambda x)
50
void solve(const PETScMatrix& A);
52
/// Compute largest n eigenpairs of the matrix A (solve Ax = \lambda x)
53
void solve(const PETScMatrix& A, const uint n);
55
/// Compute all eigenpairs of the generalised problem Ax = \lambda Bx
56
void solve(const PETScMatrix& A, const PETScMatrix& B);
58
/// Compute largest n eigenpairs of the generalised problem Ax = \lambda Bx
59
void solve(const PETScMatrix& A, const PETScMatrix& B, const uint n);
61
/// Get the 0th eigenvalue
62
void getEigenvalue(real& xr, real& xc);
65
void getEigenpair(real& xr, real& xc, PETScVector& r, PETScVector& c);
68
void getEigenvalue(real& xr, real& xc, const int i);
71
void getEigenpair(real& xr, real& xc, PETScVector& r, PETScVector& c, const int i);
75
/// Compute eigenvalues
76
void solve(const PETScMatrix& A, const PETScMatrix* B, const uint n);
78
EPSType getType(const Type type) const;
80
// SLEPc solver pointer