Skip to main content
edited body
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38

Bug introduced after 5.0, in or before 8.0 and persisting through 1213.23.


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

I found many cases with this behavior. Why and any remedy?

In the code below, the 104×104 matrix in the minimal example I found is imported from Pastebin because it exceeds the length limit of a post.

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).

Update
As you might have noticed in the comments below, a first guess accusing the Arnoldi algorithm is irrelevant. (And Matlab gives the correct result.)


A bug report has been filed for this in the Wolfram community.

Bug introduced after 5.0, in or before 8.0 and persisting through 12.2.


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

I found many cases with this behavior. Why and any remedy?

In the code below, the 104×104 matrix in the minimal example I found is imported from Pastebin because it exceeds the length limit of a post.

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).

Update
As you might have noticed in the comments below, a first guess accusing the Arnoldi algorithm is irrelevant. (And Matlab gives the correct result.)


A bug report has been filed for this in the Wolfram community.

Bug introduced after 5.0, in or before 8.0 and persisting through 13.3.


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

I found many cases with this behavior. Why and any remedy?

In the code below, the 104×104 matrix in the minimal example I found is imported from Pastebin because it exceeds the length limit of a post.

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).

Update
As you might have noticed in the comments below, a first guess accusing the Arnoldi algorithm is irrelevant. (And Matlab gives the correct result.)


A bug report has been filed for this in the Wolfram community.

edited body
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38

Bug introduced after 5.0, in or before 8.0 and persisting through 12.02.


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

I found many cases with this behavior. Why and any remedy?

In the code below, the 104×104 matrix in the minimal example I found is imported from Pastebin because it exceeds the length limit of a post.

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).

Update
As you might have noticed in the comments below, a first guess accusing the Arnoldi algorithm is irrelevant. (And Matlab gives the correct result.)


A bug report has been filed for this in the Wolfram community.

Bug introduced after 5.0, in or before 8.0 and persisting through 12.0.


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

I found many cases with this behavior. Why and any remedy?

In the code below, the 104×104 matrix in the minimal example I found is imported from Pastebin because it exceeds the length limit of a post.

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).

Update
As you might have noticed in the comments below, a first guess accusing the Arnoldi algorithm is irrelevant. (And Matlab gives the correct result.)


A bug report has been filed for this in the Wolfram community.

Bug introduced after 5.0, in or before 8.0 and persisting through 12.2.


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

I found many cases with this behavior. Why and any remedy?

In the code below, the 104×104 matrix in the minimal example I found is imported from Pastebin because it exceeds the length limit of a post.

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).

Update
As you might have noticed in the comments below, a first guess accusing the Arnoldi algorithm is irrelevant. (And Matlab gives the correct result.)


A bug report has been filed for this in the Wolfram community.

added 28 characters in body
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38

Bug introduced after 5.0, in or before 8.0 and persisting through 12.0.


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

I found many cases with this behavior. Why and any remedy?

In the code below, the 104×104 matrix in the minimal example I found is imported from Pastebin because it exceeds the length limit of a post.

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).

Update
As you might have noticed in the comments below, a first guess accusing the Arnoldi algorithm is irrelevant. (And Matlab gives the correct result.)


A bug report has been filed for this in the Wolfram community.

Bug introduced after 5.0, in or before 8.0.


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

I found many cases with this behavior. Why and any remedy?

In the code below, the 104×104 matrix in the minimal example I found is imported from Pastebin because it exceeds the length limit of a post.

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).

Update
As you might have noticed in the comments below, a first guess accusing the Arnoldi algorithm is irrelevant. (And Matlab gives the correct result.)


A bug report has been filed for this in the Wolfram community.

Bug introduced after 5.0, in or before 8.0 and persisting through 12.0.


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

I found many cases with this behavior. Why and any remedy?

In the code below, the 104×104 matrix in the minimal example I found is imported from Pastebin because it exceeds the length limit of a post.

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).

Update
As you might have noticed in the comments below, a first guess accusing the Arnoldi algorithm is irrelevant. (And Matlab gives the correct result.)


A bug report has been filed for this in the Wolfram community.

added 10 characters in body
Source Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489
Loading
deleted 1 character in body
Source Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489
Loading
added 57 characters in body
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading
appended answer 170699 as supplemental
Source Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751
Loading
edited tags
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading
edited tags
Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading
added 6 characters in body
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading
added 29 characters in body
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading
edited title
Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading
added 135 characters in body
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading
Tweeted twitter.com/StackMma/status/979915229831233536
added 18 characters in body
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading
deleted 81 characters in body
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading
added 123 characters in body
Source Link
Loading
edited title
Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading
edited tags
Link
Loading
Source Link
xiaohuamao
  • 4.8k
  • 19
  • 38
Loading