[Dune] [Dune-Commit] dune-common r5532 - trunk/common

Oliver Sander sander at mi.fu-berlin.de
Fri May 29 14:11:14 CEST 2009


To me, both Markus and Andreas have a point.  Maybe we can
find a way to conceptually separate ISTL and FieldMatrix?

--
Oliver

Andreas Dedner schrieb:
> The problem of fmatrix being a part of dune-common and heavily
> used in dune-grid and at the same time being an interface class of
> dune-istl is an unfortunate difficulty;
> but asking people forced to use fmatrix
> (due to the dune-grid interface) to port a small addition to
> fmatrix to the dune-istl matricies
> (which we hardly use and do not know anything about),
> is asking a bit much in my opinion. FMatrix is used in dune-grid not as
> an interface class but as the fixed matrix implementation!
> And by the way the documentation does not state that this is an
> interface class - and an interface class should not contain the
> implementation...
>
> If fmatrix has a method mv and umv
> and a method umtv then anybody would expect it to have a method
> mtv, would you not agree? That is the only thing we added.
>
> If you think that using a work around like Roberts
> FMatrixHelp::multAssignTransposed (which does exactly the mtv operation
> is the better approach then we can discuss this...
>
> Andreas
>
>
>
> Markus Blatt wrote:
>   
>> 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
>>>
>>>       
>> _______________________________________________
>> Dune mailing list
>> Dune at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune
>>     
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>   


-- 
************************************************************************
* Oliver Sander                ** email: sander at mi.fu-berlin.de        *
* Freie Universität Berlin     ** phone: + 49 (30) 838 75348           *
* Institut für Mathematik      ** URL  : page.mi.fu-berlin.de/~sander  *
* Arnimallee 6                 ** -------------------------------------*
* 14195 Berlin, Germany        ** Member of MATHEON (www.matheon.de)   *
************************************************************************





More information about the Dune mailing list