From d91b61007d3f979bb753cd299f4133d7b8dade24 Mon Sep 17 00:00:00 2001
From: Jonathan Youett <youett@mi.fu-berlin.de>
Date: Mon, 24 Oct 2011 10:34:19 +0000
Subject: [PATCH] bugfixes in cayleyInv

[[Imported from SVN: r8010]]
---
 dune/gfe/rotation.hh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dune/gfe/rotation.hh b/dune/gfe/rotation.hh
index 9f89f6ac..52214eaa 100644
--- a/dune/gfe/rotation.hh
+++ b/dune/gfe/rotation.hh
@@ -474,13 +474,13 @@ public:
         // compute the trace of the rotation matrix
         double trace = -q[0]*q[0] -q[1]*q[1] -q[2]*q[2]+3*q[3]*q[3];  
         
-        if ( (trace+1)>1e-6 && (trace+1)<-1e-6) { // if this term doesn't vanish we can use a direct formula
+        if ( (trace+1)>1e-6 || (trace+1)<-1e-6) { // if this term doesn't vanish we can use a direct formula
              
             q.matrix(mat);
             Dune::FieldMatrix<T,3,3> matT;
             Rotation<3,T>(q.inverse()).matrix(matT);
             mat -= matT;
-            mat *= 1/(1+trace);
+            mat *= 2/(1+trace);
         }
         else { // use the formula that involves the computation of an inverse
             Dune::FieldMatrix<T,3,3> inv;
-- 
GitLab