# Solve Eigenvalue problem - Segmentation Fault

Hello all,

I am wondering how to solve such eigen value problem with FreeFEM (in which the matrices are not associated with a finite element operator).

In this case the first and second matrices are spare matrices and the Phi_i are FE functions.

When I applied the classical method:
`int l = EigenValue(OP, B, sym=true, sigma=sigma, value=ev, vector=eV, tol=1e-10, maxit=0, ncv=0)` I get a segmentation fault.

Best regards,

Loïc,

It’s not quite clear what you need here, but let me try to help anyways.

First, I’m not sure if this is part of your questions, but you can create (or load) a sparse matrix without using FE functions.

Second, if the Psi are not FE functions, you may need to use `array=` instead of `vector=` when you call `EigenValue`.

Hope that helps!

Hello Chris,

Yes the Psi_i are FE function. Basically they are some basis functions that I have computed on a fine mesh inside my coarse element.

And when I declared my eigenvalue as array, I get

Impossible to cast in <13FEbaseArrayKnIdE>.

Best regards,

Loïc

Can you send your freefem script, because your problem is not clear for me!

BASIS_TEST.zip (803.7 KB)
Dear Frédéric,

Thank you for your help, I have prepared a MWE of my problem.
You can find it in attachment, here:
MWE_EigenValue_Problem.edp (2.4 KB)

Best regards,

Loïc,

The script corrected

1. your FEspace have 2 compote,
2. the number of converged EV is greater the nev.

MWE_EigenValue_Problem.edp (2.5 KB)

Best regards,

Loïc,

Hello all,

With this correction
MWE_EigenValue_Problem_Correct.edp (2.5 KB)
(with the same set of basis functions previously attached), for each element, the FreeFEM code is able to find 3 eigenvalues (whose values are 0 and 48 and 120).

However, when I do the calculation with python using the same matrices, we find 4 eigenvalues : the three found by FreeFEM (0 and 48 and 120) + another one (whose value is 240).

Why FreeFEM does not find this fourth eigenvalue ?

Best regards,

Loïc,

The `EigenValue` function uses ARPACK, which is not designed to compute the complete eigenspectrum of a matrix. It is generally used for computing only a few eigenvalues/eigenvectors from large sparse matrix systems.

If you change the shift to a value closer to 240, you should find that eigenvalue (though in this case you won’t see the zero eigenvalue.)

Hello,

However is there a way to compute more eigenvalues (if we do not know a priori the following eigenvalues) ?

Best regards,

Loïc,

If the matrix is not to big (<1000) you can use lapack!

Thanks !

But I cannot find the same values with the function `dggev` of lapack.

It works fine with the function` EPSSolve` of PETSc. However I wonder if it exists a parameter to compute the eigenvalue from the smallest to the largest ?

Best regards,

Loïc,

-eps_type lapack

is the only choice if you need the full spectrum.