# Complex matrix for EPSSolve

Hi,

I’m trying to convert a complex matrix AA into a matrix named dA via this method :

``````    matrix<complex> AA = a(Vh,Vh,solver = sparsesolver);
matrix<complex> BB = b(Vh,Vh,solver = sparsesolver);

Mat<complex> dA(AA);
Mat<complex> dB(BB);

real[int] nevEPS(nev);
Vh[int] [eVEPS,eWEPS](nev);

int epsK = EPSSolve(dA, dB, vectors = eVEPS, values = nevEPS, sparams =" -eps_largest_real " + 100
+ " -eps_type krylovschur" + " -eps_target 0" + " -st_type sinvert");
``````

I’ve got the following error :
Mat dA(AA) error operator ←
<
N5PETSc14DistributedCSRIN5HPDDM7SchwarzISt7complexIdEEEEE>

<14Matrice_CreuseISt7complexIdEE>

and a giant list of choices.

This method worked well for a non-complex case. My goal is to compute the eigenvalues and eigenmodes with EPSSolve. How can I make it worked ?

Thanks in advance for those who will take time to help me.

`real[int] nevEPS(nev);` should be `complex[int] nevEPS(nev);`, and the same for the eigenvectors.

Thanks for your quick answer but my problem is about the line

Mat dA(AA)

It makes the error mention above. I will edit my original post.

Please copy/paste a runable code. If you have an issue with the following snippet, then the issue likely comes from your installation.

``````load "PETSc-complex"
matrix<complex> AA = eye(10, 10);
matrix<complex> BB = eye(10, 10);

Mat<complex> dA(AA);
Mat<complex> dB(BB);
``````

Thanks, I only had loaded “PETSc”, and with “PETSc-complex” it works.