Summary: | Matrix operator== does not check for correct size and returns true for empty matrix comparisons. | ||
---|---|---|---|
Product: | Eigen | Reporter: | Simon Lynen <slynen> |
Component: | Core - general | Assignee: | Nobody <eigen.nobody> |
Status: | DECISIONNEEDED --- | ||
Severity: | Unknown | CC: | chtz, gael.guennebaud, jacob.benoit.1 |
Priority: | Normal | Keywords: | Documentation |
Version: | 3.2 | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Simon Lynen
2015-08-30 00:04:35 UTC
So far, we had a==b be equivalent to a.cwiseEqual(b).all(), which means we assume (and assert) that the sizes match. But checking for matching sizes before that actually makes sense (and I doubt it would break anything). Should we want to keep the current behavior, we must at least document it. If we change it, we should suggest the alternative .cwiseEqual().all(), in case someone really wishes to avoid the minor overhead of checking the dimension first. Such a change would make operator== equivalent to Matlab's isequal behavior, so why not. Another solution would be to add a isEqual() member (and maybe even a isEqualN() to deal with NaN) mimicking Matlab's isequal*, but if we do so, then for consistency we should probably also update isApprox to check for the size first. -- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1061. |