Hi,
I'm doing a project for computers class in C#.
In that project I need to calculate the eigenvalues and eigenvectors of a square matrix.
Does someone have an algorithm for that?
Yuval Lewi
Printable View
Hi,
I'm doing a project for computers class in C#.
In that project I need to calculate the eigenvalues and eigenvectors of a square matrix.
Does someone have an algorithm for that?
Yuval Lewi
Does this help? http://en.wikipedia.org/wiki/Eigenva...d_eigenvectors
I recommend the QR algorithm: http://en.wikipedia.org/wiki/QR_algorithm
Calculating eigenvalues programatically is a bit mathematically complicated though, so ... hang on to your hat.
To be honest, if you don't HAVE to write your own algorithm to do it, I would try to find some good numerical software that can do it (you can even find some libraries with C# wrappers).
Good luck!
Hate to bring up such an old post, but in case it should be useful to those searching the archive: The Math.NET Numerics package (see http://numerics.mathdotnet.com/) has an eigensolver that is relatively easy to call and use. However, I seem to think it was taking a long time on very large sparse matrices (compared to the Octave [Matlab clone] eigensolver on the same matrix). However, for moderate-size dense (or sparse) matrices, it worked just fine. I haven't been able to find C# code that was good for large, sparse matrices. Presumably, such a thing would be a port of ARPACK, but I have had no luck finding a library like that.