From 880a15f4d2e214b98d1b5bd75ef0aa9d5c472203 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Fri, 1 Apr 2011 12:58:03 +0000
Subject: [PATCH] Further simplification after it occurred to me that P_q (q
 \otimes p) = 0

[[Imported from SVN: r7051]]
---
 dune/gfe/unitvector.hh | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/dune/gfe/unitvector.hh b/dune/gfe/unitvector.hh
index ca57b78b..33bf719f 100644
--- a/dune/gfe/unitvector.hh
+++ b/dune/gfe/unitvector.hh
@@ -172,19 +172,15 @@ public:
         A *= secondDerivativeOfArcCosSquared(sp);
 
         // Compute matrix B (see notes)
-        Dune::FieldMatrix<double,N,N> B;
+        Dune::FieldMatrix<double,N,N> Pq;
         for (int i=0; i<N; i++)
             for (int j=0; j<N; j++)
-                B[i][j] = (i==j)*sp + p.data_[i]*q.data_[j];
+                Pq[i][j] = (i==j) - q.data_[i]*q.data_[j];
 
         // Bring it all together
-        Dune::FieldMatrix<double,N,N> result = A;
-        result.axpy(-1*derivativeOfArcCosSquared(sp), B);
-
-        for (int i=0; i<N; i++)
-            result[i] = q.projectOntoTangentSpace(result[i]);
+        A.axpy(-1*derivativeOfArcCosSquared(sp)*sp, Pq);
 
-        return result;
+        return A;
     }
 
     /** \brief Compute the mixed second derivate \partial d^2 / \partial da db
-- 
GitLab