toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN LU.h helpers.h mclasses.hh so3.h


From: Ethan Eade
Subject: [Toon-members] TooN LU.h helpers.h mclasses.hh so3.h
Date: Wed, 14 Jun 2006 11:46:23 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Ethan Eade <ethaneade>  06/06/14 11:46:23

Modified files:
        .              : LU.h helpers.h mclasses.hh so3.h 

Log message:
        LU: made "info" accessible
        helpers: fixed transformCovariance so that generated code will get used
        mclasses: a couple double* to const double*
        so3.h: removed unused variable

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/LU.h?cvsroot=toon&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/TooN/helpers.h?cvsroot=toon&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/TooN/mclasses.hh?cvsroot=toon&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/TooN/so3.h?cvsroot=toon&r1=1.13&r2=1.14

Patches:
Index: LU.h
===================================================================
RCS file: /cvsroot/toon/TooN/LU.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- LU.h        26 Oct 2005 20:51:44 -0000      1.8
+++ LU.h        14 Jun 2006 11:46:23 -0000      1.9
@@ -45,10 +45,9 @@
     int lda = Size;
     int M = Size;
     int N = Size;
-    int info;
-    dgetrf_(&M,&N,my_lu.get_data_ptr(),&lda,my_IPIV,&info);
-    if(info != 0){
-      std::cerr << "error in LU, INFO was " << info << std::endl;
+    dgetrf_(&M,&N,my_lu.get_data_ptr(),&lda,my_IPIV,&my_info);
+    if(my_info < 0){
+      std::cerr << "error in LU, INFO was " << my_info << std::endl;
     }
   }
 
@@ -146,11 +145,10 @@
     int lda=Size;
     int lwork=-1;
     double size;
-    int info;
-    dgetri_(&N, Inverse.get_data_ptr(), &lda, my_IPIV, &size, &lwork, &info);
+    dgetri_(&N, Inverse.get_data_ptr(), &lda, my_IPIV, &size, &lwork, 
&my_info);
     lwork=int(size);
     double* WORK = new double[lwork];
-    dgetri_(&N, Inverse.get_data_ptr(), &lda, my_IPIV, WORK, &lwork, &info);
+    dgetri_(&N, Inverse.get_data_ptr(), &lda, my_IPIV, WORK, &lwork, &my_info);
     delete [] WORK;
     return Inverse;
   }
@@ -158,9 +156,10 @@
   Matrix<Size,Size,RowMajor>& get_lu(){return my_lu;}
   const Matrix<Size,Size,RowMajor>& get_lu()const {return my_lu;}
 
-
+  int get_info() const { return my_info; }
  private:
   Matrix<Size,Size,RowMajor> my_lu;
+  int my_info;
   int my_IPIV[Size];
 };
   
@@ -191,10 +190,9 @@
     int lda = my_lu.num_cols();
     int M = lda;
     int N = lda;
-    int info;
-    dgetrf_(&M,&N,my_lu.get_data_ptr(),&lda,my_IPIV,&info);
-    if(info != 0){
-      std::cerr << "error in LU, INFO was " << info << std::endl;
+    dgetrf_(&M,&N,my_lu.get_data_ptr(),&lda,my_IPIV,&my_info);
+    if(info < 0){
+      std::cerr << "error in LU, INFO was " << my_info << std::endl;
     }
   }
 
@@ -295,11 +293,10 @@
     int lda=my_lu.num_rows();;
     int lwork=-1;
     double size;
-    int info;
-    dgetri_(&N, Inverse.get_data_ptr(), &lda, my_IPIV, &size, &lwork, &info);
+    dgetri_(&N, Inverse.get_data_ptr(), &lda, my_IPIV, &size, &lwork, 
&my_info);
     lwork=int(size);
     double* WORK = new double[lwork];
-    dgetri_(&N, Inverse.get_data_ptr(), &lda, my_IPIV, WORK, &lwork, &info);
+    dgetri_(&N, Inverse.get_data_ptr(), &lda, my_IPIV, WORK, &lwork, &my_info);
     delete [] WORK;
     return Inverse;
   }
@@ -307,9 +304,12 @@
   Matrix<-1,-1,RowMajor>& get_lu(){return my_lu;}
   const Matrix<-1,-1,RowMajor>& get_lu()const {return my_lu;}
 
+  int get_info() const { return my_info; }
+
 
  private:
   Matrix<-1,-1,RowMajor> my_lu;
+  int my_info;
   int* my_IPIV;
 };
 

Index: helpers.h
===================================================================
RCS file: /cvsroot/toon/TooN/helpers.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- helpers.h   5 Jun 2006 17:54:36 -0000       1.12
+++ helpers.h   14 Jun 2006 11:46:23 -0000      1.13
@@ -239,8 +239,9 @@
   }
 }
 
-template <int R, int N, class Accessor1, class Accessor2> Matrix<R,R> 
transformCovariance(const FixedMatrix<R,N,Accessor1>& A, const 
FixedMatrix<N,N,Accessor2>& B)
-{
+ namespace util {
+     template <int R, int N, class Accessor1, class Accessor2> Matrix<R,R> 
transformCovariance(const FixedMatrix<R,N,Accessor1>& A, const 
FixedMatrix<N,N,Accessor2>& B)
+     {
     Matrix<R> M;
     for (int i=0; i<R; i++) {
        double sum = 0;
@@ -262,7 +263,13 @@
        }
     }
     return M;
-}
+     }
+ }
+
+ template <int R, int N, class Accessor1, class Accessor2> inline Matrix<R,R> 
transformCovariance(const FixedMatrix<R,N,Accessor1>& A, const 
FixedMatrix<N,N,Accessor2>& B)
+ {
+     return util::transformCovariance(A,B);
+ }
 
 #ifndef TOON_NO_NAMESPACE
 }

Index: mclasses.hh
===================================================================
RCS file: /cvsroot/toon/TooN/mclasses.hh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- mclasses.hh 27 Mar 2006 14:24:08 -0000      1.8
+++ mclasses.hh 14 Jun 2006 11:46:23 -0000      1.9
@@ -28,8 +28,8 @@
   inline Matrix(){}
 
   // construction from 1 and 2 dimensional c-style arrays
-  inline Matrix(double d[Rows*Cols]){*this = 
(reinterpret_cast<FixedMatrix<Rows,Cols,FixedMAccessor<Rows,Cols,RowMajor,Stack<Rows*Cols>
 > >&>(*d));}
-  inline Matrix(double d[Rows][Cols]){*this = 
(reinterpret_cast<FixedMatrix<Rows,Cols,FixedMAccessor<Rows,Cols,RowMajor,Stack<Rows*Cols>
 > >&>(*d));}
+  inline Matrix(const double d[Rows*Cols]){*this = (reinterpret_cast<const 
FixedMatrix<Rows,Cols,FixedMAccessor<Rows,Cols,RowMajor,Stack<Rows*Cols> > 
>&>(*d));}
+  inline Matrix(const double d[Rows][Cols]){*this = (reinterpret_cast<const 
FixedMatrix<Rows,Cols,FixedMAccessor<Rows,Cols,RowMajor,Stack<Rows*Cols> > 
>&>(*d));}
 
   // construction from a fixed Matrix
   template <class Accessor>
@@ -76,7 +76,7 @@
     delete[] this->my_values;}
 
   // construction from a double*
-  inline Matrix(int num_rows, int num_cols, double* data){
+  inline Matrix(int num_rows, int num_cols, const double* data){
     this->my_num_rows=num_rows;
     this->my_num_cols = num_cols;
     this->my_values = new double[num_rows*num_cols];

Index: so3.h
===================================================================
RCS file: /cvsroot/toon/TooN/so3.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- so3.h       13 Jun 2006 14:26:00 -0000      1.13
+++ so3.h       14 Jun 2006 11:46:23 -0000      1.14
@@ -235,7 +235,6 @@
   if (trace > -0.95) {
       double sin_angle_abs = sqrt(result*result);
       if (sin_angle_abs > 0.00001) {
-         double tost=1;
          double angle;
          if(sin_angle_abs > 1.0) {
              sin_angle_abs = 1.0;




reply via email to

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