I am facing a problem with a generalized eigenvalues problem using EPSSolve in FreeFEM of the type MASS \Phi = \lambda STIFF \Phi.

EPSSolve seems to diverge . Indeed, I have to find 14 eigenvalues. However the two first eigenvalues are big and negative while all my eigenvalues should be positive.

I compare the values with eigenvalues computed in Python. With Python, all my eigenvalues are positive. Among my 14 eigenvalues, 12 of them are similar with Python and FreeFEM.

By the way, the eigenvectors found with the two method are different.

I attach the code, so that you can reproduce the problem. Problem_EV.zip (9.5 KB)

I think you should look at all the EPSSolve options in the SLEPc manual, and that will help you sort out the problem. My guess is that you need to specify -eps_gen_hermitian since you are solving a generalized eigenvalue problem.

I guess I could dump the matricies that have been read in and first insure that
the FF edp file read them properly or visualize them or just dump them back
out and diff the input and output txt files. I know in one case writing out
a matrix from FF I had to flush the file stream or else last value was dropped.

In phonons anyway you sometimes
see small values with the wrong sign if there is no
restoring force- the materials just falls apart.
In this case, what would large negative eignvalues mean
in your system? If you look at the eigenvectors for the negative ones
what does that suggest about your system?

I did note some of these are nearly degenerate and the solver AFAIK has
no way to pick particular vectors to span the spaces.

Are these the ev’s you got in python? I put your python coefs into
FF ,

type or paste code here
`` ff-mpirun -np 1 FF_COMPUTE_EV.edp | grep lambda
35 : cout << "lambda[" << j << "] = " << ev(j) << " and " << eV(:,j) << endl;
40 : I am facing a problem with a generalized eigenvalues problem using EPSSolve in FreeFEM of the type MASS \Phi = \lambda STIFF \Phi.
lambda[0] = 177623 and 14
lambda[1] = 177622 and 14
lambda[2] = 0.0114293 and 14
lambda[3] = 0.0114082 and 14
lambda[4] = 0.00548286 and 14
lambda[5] = 0.00547999 and 14
lambda[6] = 0.00216465 and 14
lambda[7] = 0.00211984 and 14
lambda[8] = 0.00152226 and 14
lambda[9] = 0.00125395 and 14
lambda[10] = 0.000805858 and 14
lambda[11] = 0.000797636 and 14
lambda[12] = 0.000502732 and 14
lambda[13] = 0.000359993 and 14
marchywka@happy:/home/documents/cpp/proj/freefem/play/junk/Problem_EV`
I went through man solvers same result. Your python coefficients are not the same-
dod you look at the condition number or do SVD in either case? There may be
a sensivitivty problem. The eigenvalues are less than .1 and you have coefficients
as high as 13.
[https://slepc.upv.es/documentation/current/docs/manualpages/EPS/EPSType.html](https://slepc.upv.es/documentation/current/docs/manualpages/EPS/EPSType.html)

What is row 9 in the stiffness matrix? The diagonal element is large
, IIRC 6600, and some of the other terms look like they have similar coefs of opposite
signs. I guess if there is a delicate cancellation that could cause
numerical issues. It probably is of no significance but if you zero out the
terms less than a noise floor, like 1e-6 or so, what do you get?

Since all the solvers I tried gave more or less the same result, it
does not seem to be a quirk of any one of them with the original
FF coefficients

The Stiffness matrix is just a correlation matrix in norm H1. So my problem doesn’t really make physical sense. It only says that some basis functions have more “energy” than others.

I asked around, and the stiffness matrix is at least positive semi-definite (all the eigenvalues should be greater or equal to zero). The fact that everything is defined up to a constant should not lead to negative eigenvalue, but we can have eigenvalues equal to zero which corresponds to rigid body motion.

The Mass matrix is for sure definite positive (all eigenvalues strictly greater than zero).

Consequently, all eigenvalues should be positive.

By the way when I consider the problem in the other way : STIFF \Phi = \lambda MASS \Phi, I find positive eigenvalues, and the same values than with Python.

So, we think that may be, the problem is the way we compute the eigenvalues. Indeed, when computing generalized eigenvalue problem, there is often a factorization that is is done. May be the fact that some eigenvalues of the stiffness matrix is equal to zero (when I compute STIFF \Phi = \lambda \Phi, I find two eigenvalues equal to zero) and some approximations can cause a problem.