toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN Cholesky.h Lapack_Cholesky.h


From: Gerhard Reitmayr
Subject: [Toon-members] TooN Cholesky.h Lapack_Cholesky.h
Date: Tue, 13 Sep 2011 13:00:52 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Gerhard Reitmayr <gerhard>      11/09/13 13:00:52

Modified files:
        .              : Cholesky.h Lapack_Cholesky.h 

Log message:
        have Cholesky and Lapack_Cholesky report when they encounter a singular 
matrix. rank() will return either the dimension of the matrix (full rank) or 
the first 0 encountered on the diagonal

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/Cholesky.h?cvsroot=toon&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/TooN/Lapack_Cholesky.h?cvsroot=toon&r1=1.8&r2=1.9

Patches:
Index: Cholesky.h
===================================================================
RCS file: /cvsroot/toon/TooN/Cholesky.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- Cholesky.h  9 Jun 2011 14:21:58 -0000       1.39
+++ Cholesky.h  13 Sep 2011 13:00:49 -0000      1.40
@@ -108,6 +108,10 @@
                                if(row==col){
                                        // this is the diagonal element so 
don't divide
                                        my_cholesky(row,col)=val;
+                                       if(val == 0){
+                                               my_rank = row;
+                                               return;
+                                       }
                                        inv_diag=1/val;
                                } else {
                                        // cache the value without division in 
the upper half
@@ -117,7 +121,9 @@
                                }
                        }
                }
+               my_rank = size;
        }
+
        public:
 
        /// Compute x = A^-1*v
@@ -249,8 +255,11 @@
                return m;
        }
 
+       int rank() const { return my_rank; }
+
 private:
        Matrix<Size,Size,Precision> my_cholesky;
+       int my_rank;
 };
 
 

Index: Lapack_Cholesky.h
===================================================================
RCS file: /cvsroot/toon/TooN/Lapack_Cholesky.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- Lapack_Cholesky.h   23 Dec 2010 23:50:39 -0000      1.8
+++ Lapack_Cholesky.h   13 Sep 2011 13:00:50 -0000      1.9
@@ -111,6 +111,8 @@
                assert(info >= 0);
                if (info > 0) {
                        my_rank = info-1;
+               } else {
+                   my_rank = N;
                }
        }
 



reply via email to

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