Message Boards Message Boards

GROUPS:

[✓] Get right eigenvalues from a sparse matrix?

Posted 8 months ago
684 Views
|
1 Reply
|
0 Total Likes
|

I notice in the following example that wrong smallest 2 eigenvalues are resulted if calculating from a sparse matrix. But it gives correct result if we

  • calculate the smallest 3,4,... eigenvalues from the sparse matrix
  • calculate any smallest eigenvalues from the corresponding normal matrix

And Matlab always gives the correct result. Why is this and any remedy? Is it a bug?

In the code below, the 104×104 matrix in the minimal example I found is imported from Pastebin.

Import["https://pastebin.com/raw/PpDfY3EQ", "Package"];
mysparsemat = mymat;
mymat = Normal[mysparsemat];
m = 2;
Reverse@First[Eigensystem[mymat, -m]]
Reverse@First[Eigensystem[mysparsemat, -m]]
m = 4;
Reverse@First[Eigensystem[mymat, -m]]
Reverse@First[Eigensystem[mysparsemat, -m]]

The result of the above code is

{-0.712477 + 1.02863*10^-16 I, 0.712477 + 1.46577*10^-16 I}

{0.712477 - 1.44294*10^-11 I, 0.712656 - 2.12258*10^-11 I}

{-0.712477 + 1.02863*10^-16 I, 0.712477 + 1.46577*10^-16 I, 
-0.712656 - 1.05578*10^-16 I, 0.712656 + 6.49144*10^-16 I}

{-0.712477 - 5.10777*10^-10 I, 0.712477 - 5.44863*10^-12 I, 
 0.712656 + 3.10198*10^-11 I, -0.712656 + 3.64677*10^-10 I}

So the resultant wrong 2nd smallest eigenvalue is actually the correct 3rd or 4th smallest eigenvalue. (The eigenvalues should be real and doubly degenerate in absolute value as expected from the original problem's nature).

Link to MSE post on same topic. A bug report has been filed for this.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract