<div dir="ltr"><div><div><div><div><div><div>Hello everyone,<br></div>While reading code in dune/common/densematrix.hh file, I found that in function<br><br>template <class Other><br>bool operator== (const DenseMatrix<Other>& y) const<br>
{<br> for (size_type i=0; i<rows(); i++)<br> if ((*this)[i]!=y[i])<br> return false;<br> return true;<br>} <br><br></div>we have not checked the condition to compare row sizes of both the matrices before actually comparing the elements.<br>
</div>I tested it with the following code<br><br>FieldMatrix<ft,2,2> v(1);<br>FieldMatrix<ft,3,2> w(1);<br>w[2][0]=3;<br>w[2][1]=5;<br> if(v==w)<br> std::cout<<"yes\n";<br> else<br> std::cout<<"no\n";<br>
<br></div>and it printed yes.<br></div>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.<br>
</div><div>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?<br></div><div>Same is for +=, -=.<br></div></div>