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.
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 ?
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.)
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 ?