#1283 Check for size mismatches in +=, ==, etc. in densematrix.hh
Metadata
Property | Value |
---|---|
Reported by | shailesh borkar (shaileshborkar9@gmail.com) |
Reported at | Apr 22, 2013 17:38 |
Type | Bug Report |
Version | Git (pre2.4) [autotools] |
Operating System | Unspecified / All |
Last edited by | Christoph Grüninger (gruenich@iws.uni-stuttgart.de) |
Last edited at | Jan 14, 2015 06:37 |
Description
Hello everyone,
There is a missing condition of comparing row sizes before performing operations on matrices in some functions given in dune/common/densematrix.hh file, causing failure in matrix operations like +=
, -=
and matrix comparison.
In following matrix comparison 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 must add
assert(rows()==y.rows());
same for other operations
Here is my patch for densematrix.hh file and test condition for fmatrixtest.cc file