This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Hermitian eigenvalue problem: 'problem_type' = 'hermitian'

0 votes

Hi,

I am trying to figure out how to exploit the hermitian nature of my eigenvalue problem.

Currently, my code contains the lines

eigensolver = SLEPcEigenSolver(A,M)
eigensolver.parameters['spectrum'] = 'smallest real'
eigensolver.parameters['tolerance'] = 1.e-15
#eigensolver.parameters['problem_type'] = 'hermitian'

eigensolver.solve(N) # Where N > 0
r, c, rx, cx = eigensolver.get_eigenpair(0)

which works. But when I uncomment the 4th line, I get an error message "Requested eigenpair (0) has not been computed."

Thanks

asked Nov 17, 2015 by sixtysymbols FEniCS User (2,280 points)

1 Answer

+1 vote
 
Best answer

Hi, "hermitian" type is for eigenvalue problems $A x=\lambda x$ with $A$ hermitian. For your generalized eigenvalue problem $A x=\lambda M x$ the type should be generalized hermitian. The corresponding string is "gen_hermitian", see here.

Here's the minimal working example

from dolfin import *

mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(V)
v = TestFunction(V)

a = inner(grad(u), grad(v))*dx + inner(u, v)*dx
m = inner(u, v)*dx

A, M = PETScMatrix(), PETScMatrix()

assemble(a, A)
assemble(m, M)

eigensolver = SLEPcEigenSolver(A,M)
eigensolver.parameters['spectrum'] = 'smallest real'
eigensolver.parameters['tolerance'] = 1.e-14
eigensolver.parameters['problem_type'] = 'gen_hermitian'

eigensolver.solve(5)

for i in range(eigensolver.get_number_converged()):
    r, c, rx, cx = eigensolver.get_eigenpair(i)
    print "%d:  %g" % (i, r) 
answered Nov 17, 2015 by MiroK FEniCS Expert (80,920 points)
selected Jan 22, 2016 by sixtysymbols
...