[Dune] [Dune-Commit] dune-common r5532 - trunk/common
Markus Blatt
Markus.Blatt at iwr.uni-heidelberg.de
Fri May 29 12:02:44 CEST 2009
Hi,
despite living in dune-common, the interface of fmatrix belongs to
ISTL (at least the one for matrix-vector operations=. If you really
need this method, you (or some volunteer) should also implement it in all
ISTL matrices to avoid future surprises.
BTW: I am always suprised how fast my fellow developers are in adding
and implementing interface changes to core modules besides dune-grid.
Regards,
Markus
On Fri, May 29, 2009 at 10:14:02AM +0200, mnolte at dune-project.org wrote:
> Author: mnolte
> Date: 2009-05-29 10:14:02 +0200 (Fri, 29 May 2009)
> New Revision: 5532
>
> Modified:
> trunk/common/fmatrix.hh
> Log:
> add missing method mtv (mv and umtv exist, so mtv should exist, too)
>
>
> Modified: trunk/common/fmatrix.hh
> ===================================================================
> --- trunk/common/fmatrix.hh 2009-05-29 08:12:40 UTC (rev 5531)
> +++ trunk/common/fmatrix.hh 2009-05-29 08:14:02 UTC (rev 5532)
> @@ -294,13 +294,32 @@
> if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
> if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
> #endif
> - for (size_type i=0; i<n; ++i)
> + for (size_type i=0; i<n; ++i)
> + {
> + y[i] = 0;
> + for (size_type j=0; j<m; j++)
> + y[i] += (*this)[i][j] * x[j];
> + }
> + }
> +
> + //! y = A^T x
> + template< class X, class Y >
> + void mtv ( const X &x, Y &y ) const
> {
> - y[i] = 0;
> - for (size_type j=0; j<m; j++)
> - y[i] += (*this)[i][j] * x[j];
> +#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>
>
>
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
>
More information about the Dune
mailing list