Skip to content
Snippets Groups Projects
Commit d9f896dd authored by Lisa Julia Nebel's avatar Lisa Julia Nebel
Browse files

Add multiplication of a ScaledIdentityMatrix with another FieldMatrix to the...

Add multiplication of a ScaledIdentityMatrix with another FieldMatrix to the collection in linearalgebra.hh
parent 27834231
No related branches found
No related tags found
1 merge request!78Fix the use of projection-based finite elements in cosserat-continuum
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <dune/common/fmatrix.hh> #include <dune/common/fmatrix.hh>
#include <dune/common/version.hh> #include <dune/common/version.hh>
#include <dune/istl/scaledidmatrix.hh>
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
...@@ -13,6 +14,20 @@ namespace Dune { ...@@ -13,6 +14,20 @@ namespace Dune {
namespace GFE { namespace GFE {
/** \brief Multiplication of a ScalecIdentityMatrix with another FieldMatrix */
template <class T, int N, int otherCols>
Dune::FieldMatrix<T,N,otherCols> operator* ( const Dune::ScaledIdentityMatrix<T, N>& diagonalMatrix,
const Dune::FieldMatrix<T, N, otherCols>& matrix)
{
Dune::FieldMatrix<T,N,otherCols> result(0);
for (size_t i = 0; i < N; ++i)
for (size_t j = 0; j < otherCols; ++j)
result[i][j] = diagonalMatrix[i][i]*matrix[i][j];
return result;
}
/** \brief Return the trace of a matrix */ /** \brief Return the trace of a matrix */
template <class T, int n> template <class T, int n>
static T trace(const FieldMatrix<T,n,n>& A) static T trace(const FieldMatrix<T,n,n>& A)
......
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