I want to find the eigenvalues and eigenvectors of a 3x3 matrix. My numbers are stored in fixed-point format (16.16 to be exact).
Note that I don't mind much about the performance, but simply implementing an algorithm that does the job.
The code below, when you build it and run it (with libfixmath
library) produces the right eigenvalues but not the correct eigenvectors.
If I understand correctly the algorithm the eigenvectors are the product of all the calculated Qs.
Does anyone know about what might be wrong? (Even correction about the code (writing style etc) anything you can think of, but ofcourse try to center your mind on the eigenvectors! :) :P
The actual loop is like 3 lines...and what it does is this:
eigenvectors = identity matrix
1) QR decomposition A = Q*R
2) Anew = R*Q (multiply the factors in the reverse order, and iterate)
3) eigenvectors = eigenvectors * Q
Thank you!! The code is here