From 64af4453109da8808130bbf66d824087bc11e4e5 Mon Sep 17 00:00:00 2001 From: Martin Nolte <mnolte@dune-project.org> Date: Fri, 29 May 2009 08:14:02 +0000 Subject: [PATCH] add missing method mtv (mv and umtv exist, so mtv should exist, too) [[Imported from SVN: r5532]] --- common/fmatrix.hh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/common/fmatrix.hh b/common/fmatrix.hh index 8513ecd13..5b3d1d143 100644 --- a/common/fmatrix.hh +++ b/common/fmatrix.hh @@ -304,6 +304,25 @@ namespace Dune { } } + //! y = A^T x + template< class X, class Y > + void mtv ( const X &x, Y &y ) const + { +#ifdef DUNE_FMatrix_WITH_CHECKING + assert( &x != &y ); + if( x.N() != N() ) + DUNE_THROW( FMatrixError, "Index out of range." ); + if( y.N() != M() ) + DUNE_THROW( FMatrixError, "Index out of range." ); +#endif + for( size_type i = 0; i < m; ++i ) + { + y[ i ] = 0; + for( size_type j = 0; j < n; ++j ) + y[ i ] += (*this)[ j ][ i ] * x[ j ]; + } + } + //! y += A x template<class X, class Y> void umv (const X& x, Y& y) const -- GitLab