From fd12389ff9178ca42a518638a8245224cf4c5ecc Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Fri, 15 Jul 2011 09:09:46 +0000 Subject: [PATCH] add division of FieldMatrix by scalar [[Imported from SVN: r7561]] --- dune/gfe/linearalgebra.hh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dune/gfe/linearalgebra.hh b/dune/gfe/linearalgebra.hh index 04f464fa..6e202259 100644 --- a/dune/gfe/linearalgebra.hh +++ b/dune/gfe/linearalgebra.hh @@ -36,4 +36,18 @@ Dune::FieldMatrix<K,m,n> operator- ( const Dune::FieldMatrix<K, m, n> &A, const } +//! 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 K& s) +{ + 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] / s; + + return ret; +} + #endif -- GitLab