Slepc ESPSetDeflationSpace function

I am solving an eigenvalue problem and looking for information at SLEPc manual I have seen the function EPSSetDeflationSpace. I think it is not implemented in the SLEPc plugin. It would be possible to add?

Thanks,
Ernesto

Yes, it’s possible to add that. Is there a specific reason you’d want to use this routine?

I am computing Neumann-Laplace eigenvalues on some sets, and I would like to avoid the computation of the zero eigenvalue, as I think it is possible to do it with that function.

OK, so you basically want to provide a constant function, associated to the zero eigenvalue, as the deflation space? I’m trying to understand the best I can what you’d like to do, so that the solution I come up with satisfies your needs.

I think that the same arguments as the EPSSetDeflationSpace are the best option.

This is not really answering my question. What kind of deflation space do you want to provide?

Just FYI, it will not be possible to match the SLEPc interface, because there is no EPS type in the FreeFEM language, only Mat. What I currently have in mind is something like PetscScalar[int,int] space(n, m); EPSSolve(A, B, deflation = space);, which will internally call EPSSetDeflationSpace before EPSSolve.

Is that space(n,m) a set of vectors? In that case, I think that is the best option.

Yes, exactly, for your Neumann problem, I think it would read:

real[int, int] space(A.n, 1);
space(:, 0) = 1; // constant function
EPSSolve(A, B, deflation = space);

This is now implemented, cf. the modified example laplace-2d-SLEPc.edp. You can of course supply a deflation space of dimension greater than 1. It must be supplied in PETSc numbering.

Dear @prj ,

Is it possible to use the deflation option with PEPSolve somehow? As far as I understand PEPSolve uses EPSSolve internally, but I am not sure whether the deflation space can be set using PEPSolve or not; and if the answer is yes, how is it possible.

I’m not sure it’s currently possible. Do you have a use case in mind?

What I would like to do is solve the same polynomial eigenvalue problem with three different shifts, so I calculate the eigenvalues in an area of the complex plane where the relevant solutions lie.

I thought that with the deflation option, I can be more efficient by avoiding the calculation of duplicate eigenvalues, e.g., after the first shift, I can decrease the number of requested eigenvalues and also the dimension of the Krylov subspace. Furthermore, I could also avoid searching and removing eigenvalues that are calculated multiple times.

I suppose I could linearize my quadratic eigenvalue problem with the companion-matrix method, and use EPSSolve, but I have a feeling that it is not worth the effort - it is better if I just remove the duplicate eigenvalues manually.