From 050d4303bdc391e2dba2f595193728a58b8886be Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Mon, 11 Jul 2011 12:34:06 +0000
Subject: [PATCH] Move matrix-matrix multiplication methods into a separate
 file

[[Imported from SVN: r7547]]
---
 dune/gfe/Makefile.am                |  1 +
 dune/gfe/linearalgebra.hh           | 39 +++++++++++++++++++++++++++++
 dune/gfe/localgeodesicfefunction.hh | 34 +------------------------
 3 files changed, 41 insertions(+), 33 deletions(-)
 create mode 100644 dune/gfe/linearalgebra.hh

diff --git a/dune/gfe/Makefile.am b/dune/gfe/Makefile.am
index 448e15dd..0bc5d923 100644
--- a/dune/gfe/Makefile.am
+++ b/dune/gfe/Makefile.am
@@ -11,6 +11,7 @@ srcinclude_HEADERS = averagedistanceassembler.hh \
                      geodesicfeassembler.hh \
                      geodesicfefunctionadaptor.hh \
                      harmonicenergystiffness.hh \
+                     linearalgebra.hh \
                      localgeodesicfefunction.hh \
                      localgeodesicfestiffness.hh \
                      maxnormtrustregion.hh \
diff --git a/dune/gfe/linearalgebra.hh b/dune/gfe/linearalgebra.hh
new file mode 100644
index 00000000..04f464fa
--- /dev/null
+++ b/dune/gfe/linearalgebra.hh
@@ -0,0 +1,39 @@
+#ifndef LINEAR_ALGEBRA_HH
+#define LINEAR_ALGEBRA_HH
+
+#include <dune/common/fmatrix.hh>
+
+//! calculates ret = A * B
+template< class K, int m, int n, int p >
+Dune::FieldMatrix< K, m, p > operator* ( const Dune::FieldMatrix< K, m, n > &A, const Dune::FieldMatrix< K, n, p > &B)
+{
+    typedef typename Dune::FieldMatrix< K, m, p > :: size_type size_type;
+    Dune::FieldMatrix< K, m, p > ret;
+        
+    for( size_type i = 0; i < m; ++i ) {
+        
+        for( size_type j = 0; j < p; ++j ) {
+            ret[ i ][ j ] = K( 0 );
+            for( size_type k = 0; k < n; ++k )
+                ret[ i ][ j ] += A[ i ][ k ] * B[ k ][ j ];
+        }
+    }
+    return ret;
+}
+
+//! calculates ret = A - B
+template< class K, int m, int n>
+Dune::FieldMatrix<K,m,n> operator- ( const Dune::FieldMatrix<K, m, n> &A, const Dune::FieldMatrix<K,m,n> &B)
+{
+    typedef typename Dune::FieldMatrix<K,m,n> :: size_type size_type;
+    Dune::FieldMatrix<K,m,n> ret;
+        
+    for( size_type i = 0; i < m; ++i )
+        for( size_type j = 0; j < n; ++j )
+            ret[i][j] = A[i][j] - B[i][j];
+
+    return ret;
+}
+
+
+#endif
diff --git a/dune/gfe/localgeodesicfefunction.hh b/dune/gfe/localgeodesicfefunction.hh
index 74765c7a..eeb2f42c 100644
--- a/dune/gfe/localgeodesicfefunction.hh
+++ b/dune/gfe/localgeodesicfefunction.hh
@@ -10,39 +10,7 @@
 #include <dune/gfe/targetspacertrsolver.hh>
 
 #include <dune/gfe/tensor3.hh>
-
-//! calculates ret = A * B
-template< class K, int m, int n, int p >
-Dune::FieldMatrix< K, m, p > operator* ( const Dune::FieldMatrix< K, m, n > &A, const Dune::FieldMatrix< K, n, p > &B)
-{
-    typedef typename Dune::FieldMatrix< K, m, p > :: size_type size_type;
-    Dune::FieldMatrix< K, m, p > ret;
-        
-    for( size_type i = 0; i < m; ++i ) {
-        
-        for( size_type j = 0; j < p; ++j ) {
-            ret[ i ][ j ] = K( 0 );
-            for( size_type k = 0; k < n; ++k )
-                ret[ i ][ j ] += A[ i ][ k ] * B[ k ][ j ];
-        }
-    }
-    return ret;
-}
-
-//! calculates ret = A - B
-template< class K, int m, int n>
-Dune::FieldMatrix<K,m,n> operator- ( const Dune::FieldMatrix<K, m, n> &A, const Dune::FieldMatrix<K,m,n> &B)
-{
-    typedef typename Dune::FieldMatrix<K,m,n> :: size_type size_type;
-    Dune::FieldMatrix<K,m,n> ret;
-        
-    for( size_type i = 0; i < m; ++i )
-        for( size_type j = 0; j < n; ++j )
-            ret[i][j] = A[i][j] - B[i][j];
-
-    return ret;
-}
-
+#include <dune/gfe/linearalgebra.hh>
 
 /** \brief A function defined by simplicial geodesic interpolation 
            from the reference element to a Riemannian manifold.
-- 
GitLab