load "lapack" // laplace with matrix verbosity=1; int nn=5; mesh Th=square(nn,nn,[2*pi*x,2*pi*y]); fespace Vh(Th,P2); Vh u1,u2; Vh ur,ui; int n=u1.n; complex[int] Bu1(n),Bu2(n); complex[int] Au1(n),Au2(n); real sigma=0.0; complex nu=1.0+1i; varf op(u1,u2)= int2d(Th)( nu*(dx(u1)*dx(u2) + dy(u1)*dy(u2)) + (dx(u1)+dy(u1))*u2 - sigma* u1*u2 ) //+ on(1,2,3,4,u1=0) ; varf a(u1,u2)= int2d(Th)( nu*(dx(u1)*dx(u2) + dy(u1)*dy(u2)) + (dx(u1)+dy(u1))*u2 ) //+ on(1,2,3,4,u1=0) ; varf b(u1,u2) = int2d(Th)( u1*u2 + 1i*u1*dx(u2) ); matrix OP=op(Vh,Vh,solver=sparsesolver); matrix A=a(Vh,Vh,solver=sparsesolver); matrix B=b(Vh,Vh,solver=sparsesolver); int nev=10; complex[int] ev(nev); // to store eigenvalues Vh[int] eV(nev); // to store eigenvectors //int k=EigenValue(OP,B,sigma=sigma,value=ev,vector=eV,tol=1e-10,maxit=0,ncv=0); // the default driver is number 4 (M positive definite Hermitian) int k=EigenValue(OP,B,sigma=sigma,value=ev,vector=eV,tol=1e-10,maxit=0,ncv=0,driver=2); // driver 2 works when M is arbitrary (non Hermitian) k=min(k,nev); // some time the number of converged eigen value // can be greater than nev; for (int kk=0;kk1e-5) // cout << "BUG ::: zero == " <