toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] TooN Cholesky.h


From: Tom Drummond
Subject: [Toon-members] TooN Cholesky.h
Date: Thu, 09 Apr 2009 06:03:04 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Tom Drummond <twd20>    09/04/09 06:03:04

Modified files:
        .              : Cholesky.h 

Log message:
        implemented Ethan's trick of caching values in upper half to save a 
multiplication

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/Cholesky.h?cvsroot=toon&r1=1.23&r2=1.24

Patches:
Index: Cholesky.h
===================================================================
RCS file: /cvsroot/toon/TooN/Cholesky.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- Cholesky.h  8 Apr 2009 04:18:56 -0000       1.23
+++ Cholesky.h  9 Apr 2009 06:03:04 -0000       1.24
@@ -60,13 +60,16 @@
                                // correct for the parts of cholesky already 
computed
                                Precision val = my_cholesky(row,col);
                                for(int col2=0; col2<col; col2++){
-                                       
val-=my_cholesky(col,col2)*my_cholesky(row,col2)*my_cholesky(col2,col2);
+                                       // 
val-=my_cholesky(col,col2)*my_cholesky(row,col2)*my_cholesky(col2,col2);
+                                       
val-=my_cholesky(col2,col)*my_cholesky(row,col2);
                                }
                                if(row==col){
                                        // this is the diagonal element so 
don't divide
                                        my_cholesky(row,col)=val;
                                        inv_diag=1/val;
                                } else {
+                                       // cache the value without division in 
the upper half
+                                       my_cholesky(col,row)=val;
                                        // divide my the diagonal element for 
all others
                                        my_cholesky(row,col)=val*inv_diag;
                                }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]