Re: [eigen] MatrixBase==

[ Thread Index | Date Index | More Archives ]

If the result of == was a matrix (for example) as the other binary operators do I would agree, but as it is I don’t think it makes sense. Ideally == WOULD return a matrix and then you would have a isEqualTo method. But I doubt you’d want to make that breaking the latter would be good at least.


On Jul 3, 2017, at 7:52 AM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:

We assumed that a size mismatch was a programming mistake for any binary operators. In the case of operator==, I understand your point that it could accept objects of different sizes and simply returns zero in that case. Nonetheless, I still have the feeling that when you write if(A==B)  and that A and B are of different sizes, then a bug is likely hidden somewhere...

Perhaps a A.isSameSize(B) helper could help ?


On Fri, Jun 30, 2017 at 5:46 PM, Rob Conde <rob.conde@xxxxxxxxxxxxxxxx> wrote:

I was a bit surprised that for dynamically sized matrices MatrixBase== doesn't check dimension equivalence before doing a component wise equals. Obviously, this is easy to check myself, but is there a canonical way to do it? I can see this making sense for fixed size matrices where a mismatch leads to a constant condition, but it doesn't seem like the right thing to do for dynamic sized matrices.



Mail converted by MHonArc 2.6.19+