[Dune-devel] GSOC2013

Markus Blatt markus at dr-blatt.de
Mon Apr 22 11:08:25 CEST 2013


Hi Shailesh,

On Mon, Apr 22, 2013 at 03:39:03AM +0530, shailesh borkar wrote:
> Hello everyone,
> While reading code in dune/common/densematrix.hh file, I found that in
> function
> 
> template <class Other>
> bool operator== (const DenseMatrix<Other>& y) const
> {
>      for (size_type i=0; i<rows(); i++)
>         if ((*this)[i]!=y[i])
>           return false;
>       return true;
> }
> 
> we have not checked the condition to compare row sizes of both the matrices
> before actually comparing the elements.
> I tested it with the following code
> 
> FieldMatrix<ft,2,2> v(1);
> FieldMatrix<ft,3,2> w(1);
> w[2][0]=3;
> w[2][1]=5;
>  if(v==w)
>       std::cout<<"yes\n";
>  else
>       std::cout<<"no\n";
> 
> and it printed yes.
> But when you change the column size of any matrix and make it different
> from other one, then it results in fail for column equality  condition
> present in dune/common/densevector.hh.
> so my question is, why have not we taken care of the condition to check row
> sizes while comparing matrices? Is it intentional or a bug?
> Same is for +=, -=.

That pretty much looks like a bug to me and should be reported to the
bugtracker. 

It would be really nice, if you find the time to to add a test for
this at the appropriate place in dune/common/test and attach a patch
the bug report.

Cheers,

Markus
-- 
Do you need more support with DUNE or HPC in general? 

Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de
Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany
Tel.: +49 (0) 160 97590858  Fax: +49 (0)322 1108991658 




More information about the Dune-devel mailing list