toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN Makefile.in so3.h regressions/so3.cc regre...


From: Edward Rosten
Subject: [Toon-members] TooN Makefile.in so3.h regressions/so3.cc regre...
Date: Mon, 18 Jan 2010 15:24:12 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        10/01/18 15:24:12

Modified files:
        .              : Makefile.in so3.h 
Added files:
        regressions    : so3.cc so3.txt 

Log message:
        Fix const correctness for so3::exp of slices of const vectors, and
        probably everything else.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/regressions/so3.cc?cvsroot=toon&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/TooN/regressions/so3.txt?cvsroot=toon&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/TooN/Makefile.in?cvsroot=toon&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/TooN/so3.h?cvsroot=toon&r1=1.41&r2=1.42

Patches:
Index: Makefile.in
===================================================================
RCS file: /cvsroot/toon/TooN/Makefile.in,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- Makefile.in 18 Jan 2010 12:16:17 -0000      1.22
+++ Makefile.in 18 Jan 2010 15:24:12 -0000      1.23
@@ -36,7 +36,7 @@
        doxygen 
 
 
-TESTS=lu slice vector_resize gauss_jordan eigen-sqrt determinant chol_toon 
chol_lapack simplex sym_eigen fill
+TESTS=lu slice vector_resize gauss_jordan eigen-sqrt determinant chol_toon 
chol_lapack simplex sym_eigen fill so3
 
 
 TEST_RESULT=$(TESTS:%=regressions/%.result)
@@ -62,7 +62,7 @@
 #Build a test executable from a test program. On compile error,
 #create an execuaable which decalres the error.
 regressions/%.test: regressions/%.cc
-       $(CXX) -g -ggdb -I. $< -o $@ -llapack -DTOON_CHECK_BOUNDS 
-DTOON_INITIALIZE_SNAN -I .. -I .  ||\
+       $(CXX) -g -ggdb $< -o $@ -llapack -DTOON_CHECK_BOUNDS 
-DTOON_INITIALIZE_SNAN -I ..  ||\
        { \
          echo "echo 'Compile error!'" > $@ ; \
          chmod +x $@; \

Index: so3.h
===================================================================
RCS file: /cvsroot/toon/TooN/so3.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- so3.h       31 Oct 2009 11:32:10 -0000      1.41
+++ so3.h       18 Jan 2010 15:24:12 -0000      1.42
@@ -111,7 +111,7 @@
        
        /// Exponentiate a vector in the Lie algebra to generate a new SO3.
        /// See the Detailed Description for details of this vector.
-       template<int S, typename A> inline static SO3 exp(const 
Vector<S,Precision,A>& vect);
+       template<int S, typename VP, typename A> inline static SO3 exp(const 
Vector<S,VP,A>& vect);
        
        /// Take the logarithm of the matrix, generating the corresponding 
vector in the Lie Algebra.
        /// See the Detailed Description for details of this vector.
@@ -199,12 +199,12 @@
 ///@param B \f$\frac{1 - \cos \theta}{\theta^2}\f$
 ///@param R Matrix to hold the return value.
 ///@relates SO3
-template <typename Precision, typename VA, typename MA>
-inline void rodrigues_so3_exp(const Vector<3,Precision, VA>& w, const 
Precision A, const Precision B, Matrix<3,3,Precision,MA>& R){
+template <typename Precision, typename VP, typename VA, typename MA>
+inline void rodrigues_so3_exp(const Vector<3,VP, VA>& w, const Precision A, 
const Precision B, Matrix<3,3,Precision,MA>& R){
        {
-               const Precision wx2 = w[0]*w[0];
-               const Precision wy2 = w[1]*w[1];
-               const Precision wz2 = w[2]*w[2];
+               const Precision wx2 = (Precision)w[0]*w[0];
+               const Precision wy2 = (Precision)w[1]*w[1];
+               const Precision wz2 = (Precision)w[2]*w[2];
        
                R[0][0] = 1.0 - B*(wy2 + wz2);
                R[1][1] = 1.0 - B*(wx2 + wz2);
@@ -233,8 +233,8 @@
 ///Perform the exponential of the matrix \f$ \sum_i w_iG_i\f$
 ///@param w Weightings of the generator matrices.
 template <typename Precision>
-template<int S, typename VA>
-inline SO3<Precision> SO3<Precision>::exp(const Vector<S,Precision,VA>& w){
+template<int S, typename VP, typename VA>
+inline SO3<Precision> SO3<Precision>::exp(const Vector<S,VP,VA>& w){
        using std::sqrt;
        using std::sin;
        using std::cos;

Index: regressions/so3.cc
===================================================================
RCS file: regressions/so3.cc
diff -N regressions/so3.cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ regressions/so3.cc  18 Jan 2010 15:24:12 -0000      1.1
@@ -0,0 +1,19 @@
+#include <TooN/so3.h>
+#include <cmath>
+
+using namespace TooN;
+using namespace std;
+
+int main()
+{
+       Vector<3> v = makeVector(M_PI, 0, 0);
+
+       cout << SO3<>::exp(v);
+
+       const Vector<3>& u(v);
+
+       cout << SO3<>::exp(u);
+
+       cout << SO3<>::exp(u.as_slice());
+
+}

Index: regressions/so3.txt
===================================================================
RCS file: regressions/so3.txt
diff -N regressions/so3.txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ regressions/so3.txt 18 Jan 2010 15:24:12 -0000      1.1
@@ -0,0 +1,12 @@
+#< t 1e-15
+1  0  0
+0 -1  0
+0  0 -1
+
+1  0  0
+0 -1  0
+0  0 -1
+
+1  0  0
+0 -1  0
+0  0 -1




reply via email to

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