Lowest Magnitude Eigenvalues of Large Sparse MatricesShould eigenvalues be ordered?Efficiently find all values of parameter such that any of the eigenvalues of a matrix is equal to 1Computing eigenvectors and eigenvaluesManipulating sparse array elementsCalculate the algebraic multiplicity of known eigenvalues of a large, sparse matrixNegative eigenvalues of a covariance matrixFind Eigenvalues close to a Target for a Generalised Eigenvalue problem of the type Ax=λBx with A and B very sparseEigenvalues of a symbolic 28×28 Hessian matrixfinding eigenenergy/eigenvector pairsImproving speed for calculating eigenvalues of a sequence of large matricesHow to compute eigenvalues of a large symbolic matrix?Quickly creating a sparse array

Are intrusions within a foreign embassy considered an act of war?

How to make all magic-casting innate, but still rare?

「捨ててしまう」why is there two て’s used here?

Are there any individual aliens that have gained superpowers in the Marvel universe?

Why isn't my calculation that we should be able to see the sun well beyond the observable universe valid?

"Correct me if I'm wrong"

Print the new site header

I just entered the USA without passport control at Atlanta airport

Predict the product from the reaction

Teferi's Time Twist and Gideon's Sacrifice

How can a clan of females defend themselves in the ancient world against wandering bands?

Would a 7805 5 V regulator drain a 9 V battery?

Am I legally required to provide a (GPL licensed) source code even after a project is abandoned?

Is there any possible way to get these hearts as Adult Link?

Name for a function whose effect is canceled by another function?

Justifying Affordable Bespoke Spaceships

Unable to import binding 'SforceServiceBinding' with the Summer 19 Tooling API WSDL

Unrecognized IC Package Style

'No arbitrary choices' intuition for natural transformation.

First occurrence in the Sixers sequence

How is the idea of "girlfriend material" naturally expressed in Russian?

Why are there no file insertion syscalls

Can a character learn spells from someone else's spellbook and then sell it?

In the US, can a former president run again?



Lowest Magnitude Eigenvalues of Large Sparse Matrices


Should eigenvalues be ordered?Efficiently find all values of parameter such that any of the eigenvalues of a matrix is equal to 1Computing eigenvectors and eigenvaluesManipulating sparse array elementsCalculate the algebraic multiplicity of known eigenvalues of a large, sparse matrixNegative eigenvalues of a covariance matrixFind Eigenvalues close to a Target for a Generalised Eigenvalue problem of the type Ax=λBx with A and B very sparseEigenvalues of a symbolic 28×28 Hessian matrixfinding eigenenergy/eigenvector pairsImproving speed for calculating eigenvalues of a sequence of large matricesHow to compute eigenvalues of a large symbolic matrix?Quickly creating a sparse array













5












$begingroup$


I am trying to find the first three lowest eigenvalues of large sparse matrices of size range $10^3 - 10^5$. The matrices depend on some parameter $x$, so I first construct the matrices and then use Eigenvalues[Mat(x), 3]. Mathematica however orders the eigenvalues by absolute value so there is no guarantee in finding the lowest eigenvalue by the method above. See figure below



enter image description here



I can find all the eigenvalues, order them, and then find the minimum using the instructions found here but that defeats the point of using sparse matrices or Mathematica altogether. Moreover, the code slows down even more when cycling through all values of $x$. So, can this problem be done in Mathematica?










share|improve this question









New contributor



WikawTirso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$







  • 2




    $begingroup$
    Why not use Eigenvalues[Mat[x], -3]?
    $endgroup$
    – Carl Woll
    Jun 10 at 17:58










  • $begingroup$
    It is not clear what you want. Show on a simple example on a matrix m[x] of low dimension.
    $endgroup$
    – Alex Trounev
    Jun 10 at 18:05










  • $begingroup$
    Duplicate of mathematica.stackexchange.com/q/194807 ?
    $endgroup$
    – Roman
    Jun 10 at 18:11







  • 1




    $begingroup$
    The title is a little misleading. If you asked me for the "lowest magnitude" eigenvalues, I would assume that you wanted the ones closest to zero. Maybe "largest-magnitude negative eigenvalues" would be more accurate?
    $endgroup$
    – Michael Seifert
    Jun 12 at 12:48















5












$begingroup$


I am trying to find the first three lowest eigenvalues of large sparse matrices of size range $10^3 - 10^5$. The matrices depend on some parameter $x$, so I first construct the matrices and then use Eigenvalues[Mat(x), 3]. Mathematica however orders the eigenvalues by absolute value so there is no guarantee in finding the lowest eigenvalue by the method above. See figure below



enter image description here



I can find all the eigenvalues, order them, and then find the minimum using the instructions found here but that defeats the point of using sparse matrices or Mathematica altogether. Moreover, the code slows down even more when cycling through all values of $x$. So, can this problem be done in Mathematica?










share|improve this question









New contributor



WikawTirso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$







  • 2




    $begingroup$
    Why not use Eigenvalues[Mat[x], -3]?
    $endgroup$
    – Carl Woll
    Jun 10 at 17:58










  • $begingroup$
    It is not clear what you want. Show on a simple example on a matrix m[x] of low dimension.
    $endgroup$
    – Alex Trounev
    Jun 10 at 18:05










  • $begingroup$
    Duplicate of mathematica.stackexchange.com/q/194807 ?
    $endgroup$
    – Roman
    Jun 10 at 18:11







  • 1




    $begingroup$
    The title is a little misleading. If you asked me for the "lowest magnitude" eigenvalues, I would assume that you wanted the ones closest to zero. Maybe "largest-magnitude negative eigenvalues" would be more accurate?
    $endgroup$
    – Michael Seifert
    Jun 12 at 12:48













5












5








5





$begingroup$


I am trying to find the first three lowest eigenvalues of large sparse matrices of size range $10^3 - 10^5$. The matrices depend on some parameter $x$, so I first construct the matrices and then use Eigenvalues[Mat(x), 3]. Mathematica however orders the eigenvalues by absolute value so there is no guarantee in finding the lowest eigenvalue by the method above. See figure below



enter image description here



I can find all the eigenvalues, order them, and then find the minimum using the instructions found here but that defeats the point of using sparse matrices or Mathematica altogether. Moreover, the code slows down even more when cycling through all values of $x$. So, can this problem be done in Mathematica?










share|improve this question









New contributor



WikawTirso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$




I am trying to find the first three lowest eigenvalues of large sparse matrices of size range $10^3 - 10^5$. The matrices depend on some parameter $x$, so I first construct the matrices and then use Eigenvalues[Mat(x), 3]. Mathematica however orders the eigenvalues by absolute value so there is no guarantee in finding the lowest eigenvalue by the method above. See figure below



enter image description here



I can find all the eigenvalues, order them, and then find the minimum using the instructions found here but that defeats the point of using sparse matrices or Mathematica altogether. Moreover, the code slows down even more when cycling through all values of $x$. So, can this problem be done in Mathematica?







linear-algebra sorting sparse-arrays eigenvalues






share|improve this question









New contributor



WikawTirso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



WikawTirso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited Jun 12 at 12:56







WikawTirso













New contributor



WikawTirso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked Jun 10 at 17:31









WikawTirsoWikawTirso

283




283




New contributor



WikawTirso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




WikawTirso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









  • 2




    $begingroup$
    Why not use Eigenvalues[Mat[x], -3]?
    $endgroup$
    – Carl Woll
    Jun 10 at 17:58










  • $begingroup$
    It is not clear what you want. Show on a simple example on a matrix m[x] of low dimension.
    $endgroup$
    – Alex Trounev
    Jun 10 at 18:05










  • $begingroup$
    Duplicate of mathematica.stackexchange.com/q/194807 ?
    $endgroup$
    – Roman
    Jun 10 at 18:11







  • 1




    $begingroup$
    The title is a little misleading. If you asked me for the "lowest magnitude" eigenvalues, I would assume that you wanted the ones closest to zero. Maybe "largest-magnitude negative eigenvalues" would be more accurate?
    $endgroup$
    – Michael Seifert
    Jun 12 at 12:48












  • 2




    $begingroup$
    Why not use Eigenvalues[Mat[x], -3]?
    $endgroup$
    – Carl Woll
    Jun 10 at 17:58










  • $begingroup$
    It is not clear what you want. Show on a simple example on a matrix m[x] of low dimension.
    $endgroup$
    – Alex Trounev
    Jun 10 at 18:05










  • $begingroup$
    Duplicate of mathematica.stackexchange.com/q/194807 ?
    $endgroup$
    – Roman
    Jun 10 at 18:11







  • 1




    $begingroup$
    The title is a little misleading. If you asked me for the "lowest magnitude" eigenvalues, I would assume that you wanted the ones closest to zero. Maybe "largest-magnitude negative eigenvalues" would be more accurate?
    $endgroup$
    – Michael Seifert
    Jun 12 at 12:48







2




2




$begingroup$
Why not use Eigenvalues[Mat[x], -3]?
$endgroup$
– Carl Woll
Jun 10 at 17:58




$begingroup$
Why not use Eigenvalues[Mat[x], -3]?
$endgroup$
– Carl Woll
Jun 10 at 17:58












$begingroup$
It is not clear what you want. Show on a simple example on a matrix m[x] of low dimension.
$endgroup$
– Alex Trounev
Jun 10 at 18:05




$begingroup$
It is not clear what you want. Show on a simple example on a matrix m[x] of low dimension.
$endgroup$
– Alex Trounev
Jun 10 at 18:05












$begingroup$
Duplicate of mathematica.stackexchange.com/q/194807 ?
$endgroup$
– Roman
Jun 10 at 18:11





$begingroup$
Duplicate of mathematica.stackexchange.com/q/194807 ?
$endgroup$
– Roman
Jun 10 at 18:11





1




1




$begingroup$
The title is a little misleading. If you asked me for the "lowest magnitude" eigenvalues, I would assume that you wanted the ones closest to zero. Maybe "largest-magnitude negative eigenvalues" would be more accurate?
$endgroup$
– Michael Seifert
Jun 12 at 12:48




$begingroup$
The title is a little misleading. If you asked me for the "lowest magnitude" eigenvalues, I would assume that you wanted the ones closest to zero. Maybe "largest-magnitude negative eigenvalues" would be more accurate?
$endgroup$
– Michael Seifert
Jun 12 at 12:48










2 Answers
2






active

oldest

votes


















1












$begingroup$

To calculate the lowest eigenvalues using Mathematica, I always introduce a "shift"
in the following way:



mat1 = mat - IdentityMatrix[Length[mat]]*large


and then add large to the result of Eigenvalues[mat1]. This operation leaves
the eigenvectors unchanged and I do not need to use Arnoldi specifically. Of course,
Arnoldi does a similar shift inside, however I am not sure if that is used correctly in the Mathematica implementation.



Example:



mat=1.,2.,3.,4.;


The eigenvalues are in the order given by Eigenvalues



5.37228, -0.372281.


The procedure above produces for any large enough large:



-0.372281, 5.37228


with the smallest first. Or Eigenvalues[mat1,1]+large just the lowest eigenvalue.






share|improve this answer











$endgroup$












  • $begingroup$
    It worked! I also realize original question was needlessly ambiguous. I get the general idea of the shift but is there a way to systematically guess a value for large? Or alternatively, 'large' compared to what (|large| > 1)? Thanks.
    $endgroup$
    – WikawTirso
    Jun 12 at 13:16










  • $begingroup$
    Well, the idea is to introduce a shift that all eigenvalues of the "shifted" matrix are negative. So you could calculate the largest eigenvalue of the shifted matrix, and if is negative, your shift is fine. if not, shift more.
    $endgroup$
    – Michael Weyrauch
    Jun 12 at 14:16


















7












$begingroup$

Use the Arnoldi method with shift-inversion:



Eigenvalues[A, 3, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0]


gives you the three smallest eigenvalues by absolute value (by magnitude).
See here: Efficiently find all values of parameter such that any of the eigenvalues of a matrix is equal to 1



After comments by @HenrikSchumacher it appears that the same can be achieved with



Eigenvalues[A, -3, Method -> "Arnoldi", "Criteria" -> "Magnitude"]


and there is no need for explicit shift-inversion.



And as @CarlWoll points out, this method is the default method for sparse matrices, so even



Eigenvalues[A, -3]


achieves the same effect. For non-sparse matrices, however, specifying the method can give a large speedup.



update



It now looks like you want the eigenvalues with smallest real part, not those with smallest magnitude. This you can also achieve with the Arnoldi method:



Eigenvalues[M, 3, Method -> "Arnoldi", "Criteria" -> "RealPart"]


gives the three eigenvalues with largest real part. To get the smallest ones, do



-Eigenvalues[-M, 3, Method -> "Arnoldi", "Criteria" -> "RealPart"]


The trick is that M and -M have the same eigenvalues (up to sign) and eigenvectors.



Of course this trick also works with the other methods presented above.






share|improve this answer











$endgroup$












  • $begingroup$
    Reading this, I realized once more that Mathematica's implementation of Arnoldi's method is really inconsistent: Both Eigenvalues[A, 1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] and Eigenvalues[A, -1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] return the same.
    $endgroup$
    – Henrik Schumacher
    Jun 10 at 21:30










  • $begingroup$
    @HenrikSchumacher I would report this to Wolfram support. This problem only happens with the Shift option.
    $endgroup$
    – Roman
    Jun 10 at 21:43











  • $begingroup$
    I have reported it already ([CASE:4270162]), but it cannot harm to build up some peer pressure. =)
    $endgroup$
    – Henrik Schumacher
    Jun 10 at 21:49






  • 1




    $begingroup$
    I believe Eigenvalues with the default method already uses the "Arnoldi" method when the input matrix is sparse and only a limited set of eigenvalues is requested. So, for sparse matrices, Eigenvalues[A, -1], Eigenvalues[A, -1, Method->"Arnoldi"] and Eigenvalues[A, -1, Method->"Arnoldi", "Criteria"->"Magnitude"] should all be equivalent.
    $endgroup$
    – Carl Woll
    Jun 10 at 22:08










  • $begingroup$
    @CarlWoll I think you're right.
    $endgroup$
    – Roman
    Jun 10 at 22:21











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






WikawTirso is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f200074%2flowest-magnitude-eigenvalues-of-large-sparse-matrices%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1












$begingroup$

To calculate the lowest eigenvalues using Mathematica, I always introduce a "shift"
in the following way:



mat1 = mat - IdentityMatrix[Length[mat]]*large


and then add large to the result of Eigenvalues[mat1]. This operation leaves
the eigenvectors unchanged and I do not need to use Arnoldi specifically. Of course,
Arnoldi does a similar shift inside, however I am not sure if that is used correctly in the Mathematica implementation.



Example:



mat=1.,2.,3.,4.;


The eigenvalues are in the order given by Eigenvalues



5.37228, -0.372281.


The procedure above produces for any large enough large:



-0.372281, 5.37228


with the smallest first. Or Eigenvalues[mat1,1]+large just the lowest eigenvalue.






share|improve this answer











$endgroup$












  • $begingroup$
    It worked! I also realize original question was needlessly ambiguous. I get the general idea of the shift but is there a way to systematically guess a value for large? Or alternatively, 'large' compared to what (|large| > 1)? Thanks.
    $endgroup$
    – WikawTirso
    Jun 12 at 13:16










  • $begingroup$
    Well, the idea is to introduce a shift that all eigenvalues of the "shifted" matrix are negative. So you could calculate the largest eigenvalue of the shifted matrix, and if is negative, your shift is fine. if not, shift more.
    $endgroup$
    – Michael Weyrauch
    Jun 12 at 14:16















1












$begingroup$

To calculate the lowest eigenvalues using Mathematica, I always introduce a "shift"
in the following way:



mat1 = mat - IdentityMatrix[Length[mat]]*large


and then add large to the result of Eigenvalues[mat1]. This operation leaves
the eigenvectors unchanged and I do not need to use Arnoldi specifically. Of course,
Arnoldi does a similar shift inside, however I am not sure if that is used correctly in the Mathematica implementation.



Example:



mat=1.,2.,3.,4.;


The eigenvalues are in the order given by Eigenvalues



5.37228, -0.372281.


The procedure above produces for any large enough large:



-0.372281, 5.37228


with the smallest first. Or Eigenvalues[mat1,1]+large just the lowest eigenvalue.






share|improve this answer











$endgroup$












  • $begingroup$
    It worked! I also realize original question was needlessly ambiguous. I get the general idea of the shift but is there a way to systematically guess a value for large? Or alternatively, 'large' compared to what (|large| > 1)? Thanks.
    $endgroup$
    – WikawTirso
    Jun 12 at 13:16










  • $begingroup$
    Well, the idea is to introduce a shift that all eigenvalues of the "shifted" matrix are negative. So you could calculate the largest eigenvalue of the shifted matrix, and if is negative, your shift is fine. if not, shift more.
    $endgroup$
    – Michael Weyrauch
    Jun 12 at 14:16













1












1








1





$begingroup$

To calculate the lowest eigenvalues using Mathematica, I always introduce a "shift"
in the following way:



mat1 = mat - IdentityMatrix[Length[mat]]*large


and then add large to the result of Eigenvalues[mat1]. This operation leaves
the eigenvectors unchanged and I do not need to use Arnoldi specifically. Of course,
Arnoldi does a similar shift inside, however I am not sure if that is used correctly in the Mathematica implementation.



Example:



mat=1.,2.,3.,4.;


The eigenvalues are in the order given by Eigenvalues



5.37228, -0.372281.


The procedure above produces for any large enough large:



-0.372281, 5.37228


with the smallest first. Or Eigenvalues[mat1,1]+large just the lowest eigenvalue.






share|improve this answer











$endgroup$



To calculate the lowest eigenvalues using Mathematica, I always introduce a "shift"
in the following way:



mat1 = mat - IdentityMatrix[Length[mat]]*large


and then add large to the result of Eigenvalues[mat1]. This operation leaves
the eigenvectors unchanged and I do not need to use Arnoldi specifically. Of course,
Arnoldi does a similar shift inside, however I am not sure if that is used correctly in the Mathematica implementation.



Example:



mat=1.,2.,3.,4.;


The eigenvalues are in the order given by Eigenvalues



5.37228, -0.372281.


The procedure above produces for any large enough large:



-0.372281, 5.37228


with the smallest first. Or Eigenvalues[mat1,1]+large just the lowest eigenvalue.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jun 12 at 19:42

























answered Jun 12 at 12:10









Michael WeyrauchMichael Weyrauch

34628




34628











  • $begingroup$
    It worked! I also realize original question was needlessly ambiguous. I get the general idea of the shift but is there a way to systematically guess a value for large? Or alternatively, 'large' compared to what (|large| > 1)? Thanks.
    $endgroup$
    – WikawTirso
    Jun 12 at 13:16










  • $begingroup$
    Well, the idea is to introduce a shift that all eigenvalues of the "shifted" matrix are negative. So you could calculate the largest eigenvalue of the shifted matrix, and if is negative, your shift is fine. if not, shift more.
    $endgroup$
    – Michael Weyrauch
    Jun 12 at 14:16
















  • $begingroup$
    It worked! I also realize original question was needlessly ambiguous. I get the general idea of the shift but is there a way to systematically guess a value for large? Or alternatively, 'large' compared to what (|large| > 1)? Thanks.
    $endgroup$
    – WikawTirso
    Jun 12 at 13:16










  • $begingroup$
    Well, the idea is to introduce a shift that all eigenvalues of the "shifted" matrix are negative. So you could calculate the largest eigenvalue of the shifted matrix, and if is negative, your shift is fine. if not, shift more.
    $endgroup$
    – Michael Weyrauch
    Jun 12 at 14:16















$begingroup$
It worked! I also realize original question was needlessly ambiguous. I get the general idea of the shift but is there a way to systematically guess a value for large? Or alternatively, 'large' compared to what (|large| > 1)? Thanks.
$endgroup$
– WikawTirso
Jun 12 at 13:16




$begingroup$
It worked! I also realize original question was needlessly ambiguous. I get the general idea of the shift but is there a way to systematically guess a value for large? Or alternatively, 'large' compared to what (|large| > 1)? Thanks.
$endgroup$
– WikawTirso
Jun 12 at 13:16












$begingroup$
Well, the idea is to introduce a shift that all eigenvalues of the "shifted" matrix are negative. So you could calculate the largest eigenvalue of the shifted matrix, and if is negative, your shift is fine. if not, shift more.
$endgroup$
– Michael Weyrauch
Jun 12 at 14:16




$begingroup$
Well, the idea is to introduce a shift that all eigenvalues of the "shifted" matrix are negative. So you could calculate the largest eigenvalue of the shifted matrix, and if is negative, your shift is fine. if not, shift more.
$endgroup$
– Michael Weyrauch
Jun 12 at 14:16











7












$begingroup$

Use the Arnoldi method with shift-inversion:



Eigenvalues[A, 3, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0]


gives you the three smallest eigenvalues by absolute value (by magnitude).
See here: Efficiently find all values of parameter such that any of the eigenvalues of a matrix is equal to 1



After comments by @HenrikSchumacher it appears that the same can be achieved with



Eigenvalues[A, -3, Method -> "Arnoldi", "Criteria" -> "Magnitude"]


and there is no need for explicit shift-inversion.



And as @CarlWoll points out, this method is the default method for sparse matrices, so even



Eigenvalues[A, -3]


achieves the same effect. For non-sparse matrices, however, specifying the method can give a large speedup.



update



It now looks like you want the eigenvalues with smallest real part, not those with smallest magnitude. This you can also achieve with the Arnoldi method:



Eigenvalues[M, 3, Method -> "Arnoldi", "Criteria" -> "RealPart"]


gives the three eigenvalues with largest real part. To get the smallest ones, do



-Eigenvalues[-M, 3, Method -> "Arnoldi", "Criteria" -> "RealPart"]


The trick is that M and -M have the same eigenvalues (up to sign) and eigenvectors.



Of course this trick also works with the other methods presented above.






share|improve this answer











$endgroup$












  • $begingroup$
    Reading this, I realized once more that Mathematica's implementation of Arnoldi's method is really inconsistent: Both Eigenvalues[A, 1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] and Eigenvalues[A, -1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] return the same.
    $endgroup$
    – Henrik Schumacher
    Jun 10 at 21:30










  • $begingroup$
    @HenrikSchumacher I would report this to Wolfram support. This problem only happens with the Shift option.
    $endgroup$
    – Roman
    Jun 10 at 21:43











  • $begingroup$
    I have reported it already ([CASE:4270162]), but it cannot harm to build up some peer pressure. =)
    $endgroup$
    – Henrik Schumacher
    Jun 10 at 21:49






  • 1




    $begingroup$
    I believe Eigenvalues with the default method already uses the "Arnoldi" method when the input matrix is sparse and only a limited set of eigenvalues is requested. So, for sparse matrices, Eigenvalues[A, -1], Eigenvalues[A, -1, Method->"Arnoldi"] and Eigenvalues[A, -1, Method->"Arnoldi", "Criteria"->"Magnitude"] should all be equivalent.
    $endgroup$
    – Carl Woll
    Jun 10 at 22:08










  • $begingroup$
    @CarlWoll I think you're right.
    $endgroup$
    – Roman
    Jun 10 at 22:21















7












$begingroup$

Use the Arnoldi method with shift-inversion:



Eigenvalues[A, 3, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0]


gives you the three smallest eigenvalues by absolute value (by magnitude).
See here: Efficiently find all values of parameter such that any of the eigenvalues of a matrix is equal to 1



After comments by @HenrikSchumacher it appears that the same can be achieved with



Eigenvalues[A, -3, Method -> "Arnoldi", "Criteria" -> "Magnitude"]


and there is no need for explicit shift-inversion.



And as @CarlWoll points out, this method is the default method for sparse matrices, so even



Eigenvalues[A, -3]


achieves the same effect. For non-sparse matrices, however, specifying the method can give a large speedup.



update



It now looks like you want the eigenvalues with smallest real part, not those with smallest magnitude. This you can also achieve with the Arnoldi method:



Eigenvalues[M, 3, Method -> "Arnoldi", "Criteria" -> "RealPart"]


gives the three eigenvalues with largest real part. To get the smallest ones, do



-Eigenvalues[-M, 3, Method -> "Arnoldi", "Criteria" -> "RealPart"]


The trick is that M and -M have the same eigenvalues (up to sign) and eigenvectors.



Of course this trick also works with the other methods presented above.






share|improve this answer











$endgroup$












  • $begingroup$
    Reading this, I realized once more that Mathematica's implementation of Arnoldi's method is really inconsistent: Both Eigenvalues[A, 1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] and Eigenvalues[A, -1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] return the same.
    $endgroup$
    – Henrik Schumacher
    Jun 10 at 21:30










  • $begingroup$
    @HenrikSchumacher I would report this to Wolfram support. This problem only happens with the Shift option.
    $endgroup$
    – Roman
    Jun 10 at 21:43











  • $begingroup$
    I have reported it already ([CASE:4270162]), but it cannot harm to build up some peer pressure. =)
    $endgroup$
    – Henrik Schumacher
    Jun 10 at 21:49






  • 1




    $begingroup$
    I believe Eigenvalues with the default method already uses the "Arnoldi" method when the input matrix is sparse and only a limited set of eigenvalues is requested. So, for sparse matrices, Eigenvalues[A, -1], Eigenvalues[A, -1, Method->"Arnoldi"] and Eigenvalues[A, -1, Method->"Arnoldi", "Criteria"->"Magnitude"] should all be equivalent.
    $endgroup$
    – Carl Woll
    Jun 10 at 22:08










  • $begingroup$
    @CarlWoll I think you're right.
    $endgroup$
    – Roman
    Jun 10 at 22:21













7












7








7





$begingroup$

Use the Arnoldi method with shift-inversion:



Eigenvalues[A, 3, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0]


gives you the three smallest eigenvalues by absolute value (by magnitude).
See here: Efficiently find all values of parameter such that any of the eigenvalues of a matrix is equal to 1



After comments by @HenrikSchumacher it appears that the same can be achieved with



Eigenvalues[A, -3, Method -> "Arnoldi", "Criteria" -> "Magnitude"]


and there is no need for explicit shift-inversion.



And as @CarlWoll points out, this method is the default method for sparse matrices, so even



Eigenvalues[A, -3]


achieves the same effect. For non-sparse matrices, however, specifying the method can give a large speedup.



update



It now looks like you want the eigenvalues with smallest real part, not those with smallest magnitude. This you can also achieve with the Arnoldi method:



Eigenvalues[M, 3, Method -> "Arnoldi", "Criteria" -> "RealPart"]


gives the three eigenvalues with largest real part. To get the smallest ones, do



-Eigenvalues[-M, 3, Method -> "Arnoldi", "Criteria" -> "RealPart"]


The trick is that M and -M have the same eigenvalues (up to sign) and eigenvectors.



Of course this trick also works with the other methods presented above.






share|improve this answer











$endgroup$



Use the Arnoldi method with shift-inversion:



Eigenvalues[A, 3, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0]


gives you the three smallest eigenvalues by absolute value (by magnitude).
See here: Efficiently find all values of parameter such that any of the eigenvalues of a matrix is equal to 1



After comments by @HenrikSchumacher it appears that the same can be achieved with



Eigenvalues[A, -3, Method -> "Arnoldi", "Criteria" -> "Magnitude"]


and there is no need for explicit shift-inversion.



And as @CarlWoll points out, this method is the default method for sparse matrices, so even



Eigenvalues[A, -3]


achieves the same effect. For non-sparse matrices, however, specifying the method can give a large speedup.



update



It now looks like you want the eigenvalues with smallest real part, not those with smallest magnitude. This you can also achieve with the Arnoldi method:



Eigenvalues[M, 3, Method -> "Arnoldi", "Criteria" -> "RealPart"]


gives the three eigenvalues with largest real part. To get the smallest ones, do



-Eigenvalues[-M, 3, Method -> "Arnoldi", "Criteria" -> "RealPart"]


The trick is that M and -M have the same eigenvalues (up to sign) and eigenvectors.



Of course this trick also works with the other methods presented above.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jun 12 at 12:31

























answered Jun 10 at 18:06









RomanRoman

11.4k11944




11.4k11944











  • $begingroup$
    Reading this, I realized once more that Mathematica's implementation of Arnoldi's method is really inconsistent: Both Eigenvalues[A, 1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] and Eigenvalues[A, -1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] return the same.
    $endgroup$
    – Henrik Schumacher
    Jun 10 at 21:30










  • $begingroup$
    @HenrikSchumacher I would report this to Wolfram support. This problem only happens with the Shift option.
    $endgroup$
    – Roman
    Jun 10 at 21:43











  • $begingroup$
    I have reported it already ([CASE:4270162]), but it cannot harm to build up some peer pressure. =)
    $endgroup$
    – Henrik Schumacher
    Jun 10 at 21:49






  • 1




    $begingroup$
    I believe Eigenvalues with the default method already uses the "Arnoldi" method when the input matrix is sparse and only a limited set of eigenvalues is requested. So, for sparse matrices, Eigenvalues[A, -1], Eigenvalues[A, -1, Method->"Arnoldi"] and Eigenvalues[A, -1, Method->"Arnoldi", "Criteria"->"Magnitude"] should all be equivalent.
    $endgroup$
    – Carl Woll
    Jun 10 at 22:08










  • $begingroup$
    @CarlWoll I think you're right.
    $endgroup$
    – Roman
    Jun 10 at 22:21
















  • $begingroup$
    Reading this, I realized once more that Mathematica's implementation of Arnoldi's method is really inconsistent: Both Eigenvalues[A, 1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] and Eigenvalues[A, -1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] return the same.
    $endgroup$
    – Henrik Schumacher
    Jun 10 at 21:30










  • $begingroup$
    @HenrikSchumacher I would report this to Wolfram support. This problem only happens with the Shift option.
    $endgroup$
    – Roman
    Jun 10 at 21:43











  • $begingroup$
    I have reported it already ([CASE:4270162]), but it cannot harm to build up some peer pressure. =)
    $endgroup$
    – Henrik Schumacher
    Jun 10 at 21:49






  • 1




    $begingroup$
    I believe Eigenvalues with the default method already uses the "Arnoldi" method when the input matrix is sparse and only a limited set of eigenvalues is requested. So, for sparse matrices, Eigenvalues[A, -1], Eigenvalues[A, -1, Method->"Arnoldi"] and Eigenvalues[A, -1, Method->"Arnoldi", "Criteria"->"Magnitude"] should all be equivalent.
    $endgroup$
    – Carl Woll
    Jun 10 at 22:08










  • $begingroup$
    @CarlWoll I think you're right.
    $endgroup$
    – Roman
    Jun 10 at 22:21















$begingroup$
Reading this, I realized once more that Mathematica's implementation of Arnoldi's method is really inconsistent: Both Eigenvalues[A, 1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] and Eigenvalues[A, -1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] return the same.
$endgroup$
– Henrik Schumacher
Jun 10 at 21:30




$begingroup$
Reading this, I realized once more that Mathematica's implementation of Arnoldi's method is really inconsistent: Both Eigenvalues[A, 1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] and Eigenvalues[A, -1, Method -> "Arnoldi", "Criteria" -> "Magnitude", "Shift" -> 0] return the same.
$endgroup$
– Henrik Schumacher
Jun 10 at 21:30












$begingroup$
@HenrikSchumacher I would report this to Wolfram support. This problem only happens with the Shift option.
$endgroup$
– Roman
Jun 10 at 21:43





$begingroup$
@HenrikSchumacher I would report this to Wolfram support. This problem only happens with the Shift option.
$endgroup$
– Roman
Jun 10 at 21:43













$begingroup$
I have reported it already ([CASE:4270162]), but it cannot harm to build up some peer pressure. =)
$endgroup$
– Henrik Schumacher
Jun 10 at 21:49




$begingroup$
I have reported it already ([CASE:4270162]), but it cannot harm to build up some peer pressure. =)
$endgroup$
– Henrik Schumacher
Jun 10 at 21:49




1




1




$begingroup$
I believe Eigenvalues with the default method already uses the "Arnoldi" method when the input matrix is sparse and only a limited set of eigenvalues is requested. So, for sparse matrices, Eigenvalues[A, -1], Eigenvalues[A, -1, Method->"Arnoldi"] and Eigenvalues[A, -1, Method->"Arnoldi", "Criteria"->"Magnitude"] should all be equivalent.
$endgroup$
– Carl Woll
Jun 10 at 22:08




$begingroup$
I believe Eigenvalues with the default method already uses the "Arnoldi" method when the input matrix is sparse and only a limited set of eigenvalues is requested. So, for sparse matrices, Eigenvalues[A, -1], Eigenvalues[A, -1, Method->"Arnoldi"] and Eigenvalues[A, -1, Method->"Arnoldi", "Criteria"->"Magnitude"] should all be equivalent.
$endgroup$
– Carl Woll
Jun 10 at 22:08












$begingroup$
@CarlWoll I think you're right.
$endgroup$
– Roman
Jun 10 at 22:21




$begingroup$
@CarlWoll I think you're right.
$endgroup$
– Roman
Jun 10 at 22:21










WikawTirso is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















WikawTirso is a new contributor. Be nice, and check out our Code of Conduct.












WikawTirso is a new contributor. Be nice, and check out our Code of Conduct.











WikawTirso is a new contributor. Be nice, and check out our Code of Conduct.














Thanks for contributing an answer to Mathematica Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f200074%2flowest-magnitude-eigenvalues-of-large-sparse-matrices%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?