problem with hqr
Behrooz
08-25-2004, 09:04 AM
Hi!
I have a problem using the subroutine "hqr", which
does not converge for many of the non-symmetric
matrices that I have tested. When it converges, it
does not provide the same eigenvalues as given
by the function "eig" in Matlab. I am using the subroutines
"balanc" and "elmhes" before calling "hqr". I have tried
the suggestions on this subject, mentioned earlier on the
forum, but cannot make it work. Am I missing something or is there a bug in hqr?
Best regards,
Behrooz
gaspari
08-25-2004, 02:24 PM
Dear Behrooz,
I have just compiled the eigensystem routines. Just to try the library and
understand the problem feel free to send me an example of a matrix that
does not converge and and example of a matrix with "bad" results.
Regards
Massimo (gaspari@tin.it)
Behrooz
08-26-2004, 01:06 AM
Dear Massimo,
One of the matrix for which hqr fails to converge is the following
mm(0,0) = -0.97072968742681;
mm(0,1) = -0.08574600326797;
mm(0,2) = -0.04846210038345;
mm(0,3) = 0.00082156756735;
mm(1,0) = -0.01593227859116;
mm(1,1) = 0.85308989870915;
mm(1,2) = 0.02013942549429;
mm(1,3) = -0.28141215563030;
mm(2,0) = 0.02352419325318;
mm(2,1) = -0.02031737172438;
mm(2,2) = -1.04045026127541;
mm(2,3) = -0.03635820155421;
mm(3,0) = -0.02338065775240;
mm(3,1) = 0.92310055776023;
mm(3,2) = -0.08885585385721;
mm(3,3) = 0.84135108544337;
where mm(i,j) , (0<=i<=3 and 0<=j<=3) is the i:th row and j:the coloumn of the matrix mm. I would be grateful if you could test this matrix and let me know if it works.
Best regards,
Behrooz
gaspari
08-27-2004, 09:51 AM
Dear Behrooz,
Hopefully you have already solved the issue..anyway I investigated
the eigenvalue problem with both Numerical Recipes routines an
using Matlab.
Using NR I tested single and double precision with and without
the balanc() function.
No problem found, everything seem working well.
I have attached a file eigen.txt with Matlab results, a simple C code
(single precision) and NR results too.
Hope this helps.
Bye
Massimo (gaspari@tin.it)
(If you are not able to open the attachment, feel free to e-mail me)
Behrooz
08-30-2004, 09:23 AM
Dear Massimo,
Thank you for your help. I implemented the C version of
hqr and it works just fine. However, I have still problem
with the C++ version. I suspect this to be due to problems
with the matrix class that I have been developing myself
and using in my C++ programs.
Best regards,
Behrooz
dionusos
12-19-2005, 03:17 AM
I typed the subroutine of hqr in c++ version. But there's a problem when I run it.
I succeeded in compiling it, with not a single piece of error or warning. But when I wrote a simple program to test hqr, it was interrupted and said "3340 segmentation fault".
I checked it many times, but still have no idea what's the matter. The following is the subroutine I typed.
Would anyone send me a well-running copy and let me check what's wrong?
Any hints are welcome.
Best regards
Dionusos
[Edited to remove listing of NR code. Sorry, fellows, it's not allowed to post NR routines.]