I am trying to solve an eigenvalue problem in which the matricx is real, but I expect complex eigenvalues. When I run PETSc with real, I see in the convergence history that SLEPc indeed calculates real eigenvalues. However, EPSSolve only accepts a real vector/FE variable for the eigenvalues and eigenvectors in its argument. Is this the current implementation of the FreeFEM-PETSc interface, or is there something more fundamental behind this related to the separation of the separation of the real and complex versions of PETSc?
Thanks for the reply. If I understand correctly, the complex eigenvalues/eigenvector could accessed, but it would require modification of FreeFem-sources/plugin/mpi/SLEPc-code.hpp at master · FreeFem/FreeFem-sources · GitHub. If I understand correctly, in the current implementation whether the complex part is requested depends on whether real or complex PETSc is requrested. I looked into the source code, and I think I could try modifying the interface to extract the complex part of the eigenvalues; however, for the eigenvectors, the corresponding code seems very spooky and I do not think I can do it.
If I would check all the corresponding FreeFEM examples, and implement the extraction of the eigenvalues, would you consider implementing the extraction of the complex part of the eigenvalues?
I don’t understand the problem, the complex eigenpairs are already split in both real and imaginary part. I’m not sure of what you need or what is not working.
complex[int] EigenVAL(0); // array to store eigenvalues
int k = EPSSolve
(DistA, // matrix OP = A − sigma*B
DistB, //
values = EigenVAL, // Array to store the EigenValues
vectors = EigenVEC, // Array to store the FEM-EigenFunctions
sparams = ssparams, // Parameters for the distributed EigenValue solver
deflation = space
);
then, I get an error that values cannot be cast - I assume - to be a real vector. The same applies for the eigenvectors.
I want to us real PETSc/SLEPc to solve a problem with real matrices, and find its complex eigenvalues and eigenvectors. I do not want to use complex PETSc/SLEPc since it would mean an increased memory and computational effort.
I want to us real PETSc/SLEPc to solve a problem with real matrices, and find its complex eigenvalues and eigenvectors
As written in the SLEPc documentation, these complex eigenmodes are stored as real eigenmodes, with first the real part, then the imaginary part. Again, I don’t understand the issue, sorry.
Yes, I understand that. But there is no way to access complex eigenvalues through the current FreeFEM interface with load "PETSc" and not load "PETSc-complex" if I understand correctly.
Yes, that is what I meant. I think valuesi and arrayi would be more a convenient way to access them. But as I told you previously - even if I think I could implement valuesi in the SLEPc-FreeFEM interface, I do not think I could make arrayi work.