<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>How do I calculate the rank of my A matrix? I couldn't find anything in PETSC documentation. It seems like a mumps functionality, but I cannot get any output regarding null pivots/rank deficiency.</p>
<p><br>
</p>
<p>Sidd</p>
<p>CCNS, WPI</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Jose E. Roman <jroman@dsic.upv.es><br>
<b>Sent:</b> Thursday, September 14, 2017 4:33:01 AM<br>
<b>To:</b> Pandey, Siddhant<br>
<b>Cc:</b> petsc-users@mcs.anl.gov<br>
<b>Subject:</b> Re: [petsc-users] SLEPC - Hermitian matrix gives complex eigenvalues</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText"><br>
> El 14 sept 2017, a las 0:27, Pandey, Siddhant <spandey2@wpi.edu> escribió:<br>
> <br>
> Hello all,<br>
> <br>
> I am diagonalizing a hermitian matrix (MatIsHermitian = 1 up to a tolerance of 1e-15) using krylovschur, with EPS_TARGET_MAGNITUDE = 0, but getting complex eigenvalues. Also, I am getting seemingly spurious eigenvalues of magnitude very close to 0, whose
relative errors are much larger than my set tolerance. Can anyone indicate what might be the cause and possible solutions.<br>
> <br>
> I have attached the files eps_view, A_mat_binary, and B_mat_binary files, which show the settings I have used, and contain the A and B matrices respectively (in binary).<br>
> <br>
> The eigenvalues I get are:<br>
> <br>
> # <br>
> <br>
> Eigenvalue<br>
> — ----------------------------------------------------------------<br>
> 0 0.0000000000000077 + i -0.0000000000000000<br>
> 1 0.0000000000000265 + i -0.0000000000000008<br>
> 2 0.0000000000000340 + i 0.0000000000000002<br>
> 3 0.0000000000000373 + i 0.0000000000000001<br>
> 4 0.0000000000000444 + i -0.0000000000000007<br>
> 5 0.0000000000000448 + i -0.0000000000000017<br>
> 6 0.0000000000000470 + i 0.0000000000000002<br>
> 7 0.0000000000000489 + i 0.0000000000000030<br>
> 8 0.0000000000000548 + i 0.0000000000000006<br>
> 9 0.0000000000000585 + i 0.0000000000000001<br>
> 10 0.0000000000000643 + i 0.0000000000000005<br>
> 11 0.0000000000000714 + i -0.0000000000000008<br>
> 12 0.0000000000000750 + i -0.0000000000000019<br>
> 13 0.0000000000000752 + i 0.0000000000000031<br>
> 14 0.0000000000000769 + i -0.0000000000000002<br>
> 15 0.0000000000000784 + i -0.0000000000000037<br>
> 16 0.0000000000000860 + i 0.0000000000000002<br>
> 17 0.0000000000000880 + i -0.0000000000000004<br>
> 18 0.0000000000000968 + i -0.0000000000000001<br>
> 19 0.0000000000000979 + i 0.0000000000000013<br>
> 20 0.0000000000001045 + i -0.0000000000000001<br>
> 21 0.0000000000001150 + i -0.0000000000000011<br>
> 22 0.0000000000001348 + i -0.0000000000000012<br>
> 23 0.0000000000001446 + i -0.0000000000000019<br>
> 24 0.0000000000001454 + i 0.0000000000000011<br>
> 25 0.0000000000001555 + i 0.0000000000000003<br>
> 26 0.0000000000002513 + i -0.0000000000000009<br>
> 27 5.0908854514230413 + i -0.0022004178122762<br>
> 28 5.2768106039842175 + i 0.1043464906789375<br>
> 29 5.3003883062604187 + i -0.0757735907905433<br>
> 30 11.5143655883932929 + i 0.0049838692042474<br>
> 31 11.8821523259838653 + i -0.1475608751440501<br>
> 32 11.9515216995487101 + i 0.1857395729336506<br>
> 33 12.0909362158339384 + i 0.0049114285397287<br>
> 34 12.0905704159492675 + i -0.1522880348537981<br>
> 35 12.2205398661469111 + i -0.0781999802933937<br>
> 36 12.4807156964720480 + i -0.2850122604907908<br>
> 37 12.6082849940660289 + i 0.0560456679728079<br>
> 38 12.9384278480576125 + i 0.0238826907631012<br>
> 39 17.5230234731441357 + i -0.1824807274488794<br>
> 40 17.5503678395543901 + i 0.1785356473404145<br>
> 41 17.6933953160112409 + i -0.0626631055149425<br>
> 42 19.1692824404480930 + i -0.6351729266691462<br>
> 43 19.4158452684509797 + i 0.3151965488807310<br>
> 44 19.6020750507704591 + i -0.2559887580276014<br>
> 45 19.6443102906562181 + i 1.1005601705485646<br>
> 46 19.7948713379697452 + i 0.1230015140422697<br>
> 47 19.8791098474284347 + i -0.1943322911563744<br>
> 48 20.1268732265661860 + i -0.0340890856219265<br>
> 49 20.1368588182453898 + i 0.2673370459460956<br>
> <br>
> <br>
> Thanks in advance,<br>
> Sidd<br>
> Worcester Polytechnic, U.S.A.<br>
> <A_mat_binary><B_mat_binary><eps_view_pre.txt><br>
<br>
Your B matrix has full rank, but rank(A)=1002. This means your eigenproblem has 27 zero eigenvalues. So no wonder that you get tiny eigenvalues (they are numerically zero in the working precision).<br>
<br>
Since you problem is Hermitian, you should solve it as such, adding -eps_gen_hermitian. Then the accuracy will be a bit better. Still, the relative error for the tiny eigenvalues will be large (division by zero), but you can see that the *absolute* error shows
that the eigenvector is computed correctly. See output below.<br>
<br>
Another thing is that since your A matrix is singular, you should not use target=0, because then the solver will invert matrix A. MUMPS is good at working with singular matrices, but still the error will propagate to the computed eigensolutions. You have to
move away from zero, e.g. target=0.1<br>
<br>
Finally, do not set ncv=1029. By doing this, the built subspace is equal to the whole space of the original problem, so the cost will be even higher than calling LAPACK directly on your matrices. Let SLEPc choose the ncv value.<br>
<br>
Jose<br>
<br>
<br>
$ ./ex7 -f1 ~/tmp/pandey/A_mat_binary -f2 ~/tmp/pandey/B_mat_binary -st_pc_factor_mat_solver_package mumps -st_type sinvert -eps_target 0.1 -eps_nev 50 -eps_error_absolute ::ascii_info_detail<br>
<br>
Generalized eigenproblem stored in file.<br>
<br>
Reading COMPLEX matrices from binary files...<br>
---------------------- --------------------<br>
k ||Ax-kBx||<br>
---------------------- --------------------<br>
0.000000+0.000000i 7.65812e-12<br>
0.000000-0.000000i 2.78585e-12<br>
0.000000-0.000000i 6.30965e-12<br>
0.000000+0.000000i 1.90477e-12<br>
0.000000-0.000000i 4.18541e-12<br>
0.000000+0.000000i 2.90717e-12<br>
0.000000+0.000000i 2.90732e-12<br>
0.000000-0.000000i 6.69097e-12<br>
0.000000+0.000000i 2.01707e-12<br>
0.000000-0.000000i 6.2849e-12<br>
0.000000-0.000000i 6.30369e-12<br>
0.000000-0.000000i 6.79209e-12<br>
0.000000+0.000000i 3.3761e-12<br>
0.000000-0.000000i 6.19772e-12<br>
0.000000+0.000000i 3.87231e-12<br>
0.000000-0.000000i 2.75338e-12<br>
0.000000+0.000000i 9.50872e-12<br>
0.000000-0.000000i 4.59981e-12<br>
0.000000-0.000000i 7.62071e-13<br>
0.000000-0.000000i 7.24146e-12<br>
0.000000+0.000000i 2.98146e-12<br>
0.000000-0.000000i 1.49165e-12<br>
0.000000-0.000000i 1.33641e-12<br>
0.000000-0.000000i 3.02551e-12<br>
0.000000-0.000000i 1.76448e-12<br>
0.000000+0.000000i 2.03659e-12<br>
0.000000-0.000000i 5.71796e-12<br>
5.238680+0.000000i 3.67926e-11<br>
5.238680+0.000000i 3.85213e-11<br>
5.238680+0.000000i 3.3809e-11<br>
12.047661+0.000000i 3.74891e-11<br>
12.047661+0.000000i 3.36437e-11<br>
12.047661+0.000000i 4.68278e-11<br>
12.079279+0.000000i 4.27835e-11<br>
12.079279+0.000000i 7.02149e-11<br>
12.079279-0.000000i 1.14514e-10<br>
12.954275+0.000000i 1.13398e-10<br>
12.954275-0.000000i 1.0298e-10<br>
12.955799-0.000000i 6.2543e-11<br>
17.515033+0.000000i 1.25423e-10<br>
17.515033-0.000000i 6.11696e-11<br>
17.647490+0.000000i 2.56307e-10<br>
19.770424-0.000000i 1.43313e-07<br>
19.770424-0.000000i 4.1167e-11<br>
19.770424-0.000000i 7.67294e-11<br>
19.770424-0.000000i 5.92692e-11<br>
19.770424+0.000000i 7.66231e-11<br>
19.770424+0.000000i 9.85743e-11<br>
20.199838+0.000000i 8.37107e-11<br>
20.199838+0.000000i 3.56701e-11<br>
20.199838-0.000000i 8.82029e-11<br>
20.199838-0.000000i 8.52395e-11<br>
20.199838-0.000000i 8.82165e-11<br>
20.199838-0.000000i 4.32813e-07<br>
24.112262+0.000000i 2.25578e-10<br>
24.112262-0.000000i 1.27094e-10<br>
24.112262+0.000000i 1.14679e-10<br>
24.227579-0.000000i 9.77701e-11<br>
24.227579+0.000000i 1.41993e-10<br>
24.227579-0.000000i 1.84562e-10<br>
29.035473-0.000000i 2.69505e-10<br>
29.035473-0.000000i 1.72167e-10<br>
29.035473-0.000000i 1.87434e-10<br>
29.649484-0.000000i 2.44039e-10<br>
29.649484-0.000000i 3.84759e-10<br>
32.112699+0.000000i 1.35182e-10<br>
32.112699+0.000000i 1.91162e-10<br>
32.112699-0.000000i 3.58118e-10<br>
32.115257+0.000000i 3.58743e-10<br>
32.115257-0.000000i 3.46267e-10<br>
32.115257+0.000000i 4.55903e-10<br>
50.121754+0.000000i 6.04554e-10<br>
50.121754-0.000000i 6.26139e-10<br>
---------------------- --------------------<br>
Number of iterations of the method: 3<br>
Number of linear iterations of the method: 168<br>
Solution method: krylovschur<br>
<br>
Number of requested eigenvalues: 50<br>
Stopping condition: tol=1e-08, maxit=100<br>
Linear eigensolve converged (73 eigenpairs) due to CONVERGED_TOL; iterations 3<br>
---------------------- --------------------<br>
k ||Ax-kBx||/||kx||<br>
---------------------- --------------------<br>
0.000000+0.000000i 31.3252<br>
0.000000-0.000000i 18.2211<br>
0.000000-0.000000i 44.631<br>
0.000000+0.000000i 13.836<br>
0.000000-0.000000i 30.8722<br>
0.000000+0.000000i 26.1132<br>
0.000000+0.000000i 28.6077<br>
0.000000-0.000000i 74.5526<br>
0.000000+0.000000i 23.1291<br>
0.000000-0.000000i 74.0475<br>
0.000000-0.000000i 74.7671<br>
0.000000-0.000000i 90.664<br>
0.000000+0.000000i 45.6476<br>
0.000000-0.000000i 84.4024<br>
0.000000+0.000000i 55.9734<br>
0.000000-0.000000i 42.2662<br>
0.000000+0.000000i 155.367<br>
0.000000-0.000000i 82.083<br>
0.000000-0.000000i 14.409<br>
0.000000-0.000000i 163.883<br>
0.000000+0.000000i 70.2693<br>
0.000000-0.000000i 38.2544<br>
0.000000-0.000000i 35.2561<br>
0.000000-0.000000i 87.8327<br>
0.000000-0.000000i 73.0972<br>
0.000000+0.000000i 102.899<br>
0.000000-0.000000i 841.374<br>
5.238680+0.000000i 7.02326e-12<br>
5.238680+0.000000i 7.35325e-12<br>
5.238680+0.000000i 6.45373e-12<br>
12.047661+0.000000i 3.11174e-12<br>
12.047661+0.000000i 2.79255e-12<br>
12.047661+0.000000i 3.88688e-12<br>
12.079279+0.000000i 3.54189e-12<br>
12.079279+0.000000i 5.81284e-12<br>
12.079279-0.000000i 9.48017e-12<br>
12.954275+0.000000i 8.75372e-12<br>
12.954275-0.000000i 7.94948e-12<br>
12.955799-0.000000i 4.82741e-12<br>
17.515033+0.000000i 7.16088e-12<br>
17.515033-0.000000i 3.49241e-12<br>
17.647490+0.000000i 1.45237e-11<br>
19.770424-0.000000i 7.24883e-09<br>
19.770424-0.000000i 2.08225e-12<br>
19.770424-0.000000i 3.88102e-12<br>
19.770424-0.000000i 2.99787e-12<br>
19.770424+0.000000i 3.87565e-12<br>
19.770424+0.000000i 4.98595e-12<br>
20.199838+0.000000i 4.14413e-12<br>
20.199838+0.000000i 1.76586e-12<br>
20.199838-0.000000i 4.36652e-12<br>
20.199838-0.000000i 4.21981e-12<br>
20.199838-0.000000i 4.36719e-12<br>
20.199838-0.000000i 2.14265e-08<br>
24.112262+0.000000i 9.35532e-12<br>
24.112262-0.000000i 5.27091e-12<br>
24.112262+0.000000i 4.75603e-12<br>
24.227579-0.000000i 4.03549e-12<br>
24.227579+0.000000i 5.8608e-12<br>
24.227579-0.000000i 7.61787e-12<br>
29.035473-0.000000i 9.28191e-12<br>
29.035473-0.000000i 5.92953e-12<br>
29.035473-0.000000i 6.45536e-12<br>
29.649484-0.000000i 8.23079e-12<br>
29.649484-0.000000i 1.29769e-11<br>
32.112699+0.000000i 4.20961e-12<br>
32.112699+0.000000i 5.95285e-12<br>
32.112699-0.000000i 1.11519e-11<br>
32.115257+0.000000i 1.11705e-11<br>
32.115257-0.000000i 1.0782e-11<br>
32.115257+0.000000i 1.41958e-11<br>
50.121754+0.000000i 1.20617e-11<br>
50.121754-0.000000i 1.24924e-11<br>
---------------------- --------------------<br>
<br>
<br>
</div>
</span></font>
</body>
</html>