0001 function [ineg,muv,impar]=spcalc(Gu,p)
0002
0003
0004
0005 [~,MId]=assema(p.points,p.tria,0,1,zeros(p.neq,1));
0006 if(strcmp(p.eigmeth,'eigs'))
0007 if p.eigsstart==1; vs=size(Gu,1); p.evopts.v0=ones(vs,1)/vs; end
0008 [~,mu]=eigs(Gu,MId,p.neig,p.eigref,p.evopts);
0009 muv=mu*ones(1,p.neig)';
0010 else
0011 evalc('[V,muv]=sptarn(Gu,MId,p.eigint(1),p.eigint(2));');
0012 end
0013 mul=length(muv); [ms,ix]=sort(real(muv));
0014 ineg=0; mus=zeros(1,mul); impar=0;
0015 for i=1:mul; mus(i)=muv(ix(i));
0016 if (ms(i)<0) ineg=ineg+1; impar=impar+imag(mus(i)); end
0017 end;
0018 if abs(mus(1))>abs(mus(mul))/2
0019 fprintf('warning: mu-min=%g, mu-max=%g; consider increasing p.neig\n', mus(1),mus(mul));
0020 end
0021 if(impar>10*eps)
0022 fprintf('warning: nonzero sum of imaginary parts of negative evals of Gu.\n');
0023 end
0024 muv=mus;