toon-members
[Top][All Lists]

 From: Gerhard Reitmayr Subject: [Toon-members] TooN determinant.h functions/fadbad.h Date: Thu, 21 Apr 2011 12:14:16 +0000

```CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Gerhard Reitmayr <gerhard>      11/04/21 12:14:16

Modified files:
.              : determinant.h

Log message:

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/determinant.h?cvsroot=toon&r1=1.5&r2=1.6

Patches:
Index: determinant.h
===================================================================
RCS file: /cvsroot/toon/TooN/determinant.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- determinant.h       7 Apr 2010 14:48:07 -0000       1.5
+++ determinant.h       21 Apr 2011 12:14:15 -0000      1.6
@@ -85,7 +85,7 @@
Precision maxval = abs(A[i][i]);

for (int ii=i+1; ii<size; ++ii) {
-                               double v =  abs(A[ii][i]);
+                               Precision v =  abs(A[ii][i]);
if (v > maxval) {
maxval = v;
argmax = ii;
@@ -111,7 +111,7 @@
for (int u=i+1; u<size; ++u) {
//Do not multiply out the usual 1/pivot term
//to avoid division. It causes poor scaling.
-                               double factor = A[u][i]/pivot;
+                               Precision factor = A[u][i]/pivot;

for (int j=i+1; j<size; ++j)
A[u][j] = A[u][j] - factor * A[i][j];

===================================================================
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
@@ -45,6 +45,11 @@
return out << val.val();
}

+template <typename P>
+inline F<P> abs( const F<P> & val ){
+    return (val.val() < 0) ? -val : val;
+}
+
}

namespace TooN {
@@ -54,12 +59,20 @@
static const int value = numeric_limits<C>::is_specialized; ///<Is C a
field?
};

+template <int N, typename T, typename A>
+    Vector<N,T> result(v.size());
+    for(int i = 0; i < result.size(); ++i)
+        result[i] = v[i].val();
+    return result;
+}
+
template <int N>
& val, const int start = 0, const int size = N ){
using std::min;
-       for(int i = start; i < min(size, start+N); ++i)
-               result[i].diff(i,size);
+       for(int i = 0, d = start; i < val.size() && d < size; ++i, ++d)
+               result[i].diff(d,size);
return result;
}

@@ -88,40 +101,40 @@
return result;
}

0, 0));
0, 0), start, size);
}

0, 0, 0, 0, 0));
0, 0, 0, 0, 0), start, size);
}

start, size));
}

-       r.diff(0,1) = 1.0;
+       r.diff(start,size) = 1.0;
}

start = 0, int size = 3 ){
+       return make_fad_so3(start, size) * r;
}

start = 0, int size = 6 ){
+       return make_fad_se3(start, size) * t;
}

start = 0, int size = 1 ){
+       return make_fad_so2(start, size) * r;
}