[Dune-devel] GSOC2013

shailesh borkar shaileshborkar9 at gmail.com
Mon Apr 22 00:09:03 CEST 2013


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 +=, -=.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20130422/2fbaa32e/attachment.htm>


More information about the Dune-devel mailing list