Numerical Recipes Forum  

Go Back   Numerical Recipes Forum > Obsolete Editions Forum > Methods: Chapters 2, 11, and 18

Reply
 
Thread Tools Display Modes
  #1  
Old 03-04-2008, 10:26 AM
jbd jbd is offline
Registered User
 
Join Date: Mar 2008
Posts: 1
choldc - finding inverse of Cholesky decomposition

Hello

I need to find L-1 from the Cholesky decompostion
A = L . Ltranspose
and have implemented choldc from nr2 in C with additional lines to find inverse as given in chapter 2.9.

I have calculated L(L-1) as a test and do not get the identity matrix, I was just wondering whether anyone else had encountered this problem... or could point out if I'm being stupid and missing something?

Thanks
jbd
Reply With Quote
  #2  
Old 03-04-2008, 05:31 PM
davekw7x davekw7x is offline
Registered User
 
Join Date: Jan 2008
Posts: 453
Quote:
Originally Posted by jbd View Post
... or could point out ...
Is it a multiple-choice test?

But seriously, what did you use as a test case? How did you get all of the elements of the calculated matrix L and L-inverse from the return values of choldc? How close did the answer come to expected?

Using choldc (single precision floating point) from nr2 C, here is some output from a matrix used as a test case in xcholdc, where I have added the stuff that I think you are asking about:

Code:
Original matrix:
   100.000000      15.000000       0.010000  
    15.000000       2.300000       0.010000  
     0.010000       0.010000       1.000000  

After choldc, diagonal elements of L and L-Transpose are in [p]:
    10.000000
     0.223607
     0.999277

Upper of [a] contains the upper of the original matrix.
Below main diagonal of [a] is below main diagonal of L:
   100.000000      15.000000       0.010000  
     1.500000       2.300000       0.010000  
     0.001000       0.038013       1.000000  

Extracting L and L-Transpose from [p] and lower [a]:
L: 
    10.000000       0.000000       0.000000  
     1.500000       0.223607       0.000000  
     0.001000       0.038013       0.999277  
L-Transpose: 
    10.000000       1.500000       0.001000  
     0.000000       0.223607       0.038013  
     0.000000       0.000000       0.999277  

Product of L and L-Transpose should be equal to original:
   100.000000      15.000000       0.010000  
    15.000000       2.300000       0.010000  
     0.010000       0.010000       1.000000  

Inverse of L from code at end of section 2.9:
     0.100000       0.000000       0.000000  
    -0.670821       4.472138       0.000000  
     0.025418      -0.170123       1.000724  


Product of L and Inverse of L:
     1.000000       0.000000       0.000000  
     0.000000       1.000000       0.000000  
     0.000000       0.000000       1.000000
Regards,

Dave
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:02 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.