Skip to content
Snippets Groups Projects
Commit 050d4303 authored by Oliver Sander's avatar Oliver Sander Committed by sander@FU-BERLIN.DE
Browse files

Move matrix-matrix multiplication methods into a separate file

[[Imported from SVN: r7547]]
parent 735cc0a5
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ srcinclude_HEADERS = averagedistanceassembler.hh \ ...@@ -11,6 +11,7 @@ srcinclude_HEADERS = averagedistanceassembler.hh \
geodesicfeassembler.hh \ geodesicfeassembler.hh \
geodesicfefunctionadaptor.hh \ geodesicfefunctionadaptor.hh \
harmonicenergystiffness.hh \ harmonicenergystiffness.hh \
linearalgebra.hh \
localgeodesicfefunction.hh \ localgeodesicfefunction.hh \
localgeodesicfestiffness.hh \ localgeodesicfestiffness.hh \
maxnormtrustregion.hh \ maxnormtrustregion.hh \
......
#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
...@@ -10,39 +10,7 @@ ...@@ -10,39 +10,7 @@
#include <dune/gfe/targetspacertrsolver.hh> #include <dune/gfe/targetspacertrsolver.hh>
#include <dune/gfe/tensor3.hh> #include <dune/gfe/tensor3.hh>
#include <dune/gfe/linearalgebra.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;
}
/** \brief A function defined by simplicial geodesic interpolation /** \brief A function defined by simplicial geodesic interpolation
from the reference element to a Riemannian manifold. from the reference element to a Riemannian manifold.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment