-
Notifications
You must be signed in to change notification settings - Fork 2.2k
remove redundant copy operation. fix warning which can be interpreted as an error in some projects #3486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are missing a conditional here. the actual stride of the EigenConformable must be (0,0) if the negative stride boolean is not set (read the comment about bug http://eigen.tuxfamily.org/bz/show_bug.cgi?id=747). As this is implemented, I am worried it will break compatibility with old Eigen versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, older versions of Eigen will hit the static assert, so we need to make the Stride object is strictly positive for maximum backwards compatibility.
include/pybind11/eigen.h
Outdated
stride{EigenRowMajor ? rstride > 0 ? rstride : 0 : cstride > 0 ? cstride : 0 /* outer stride */, | ||
EigenRowMajor ? cstride > 0 ? cstride : 0 : rstride > 0 ? rstride : 0 /* inner stride */ } { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add parenthesis, please, I can't easily tell what's happening here.
include/pybind11/eigen.h
Outdated
// TODO: when Eigen bug #747 is fixed, remove the tests for non-negativity. http://eigen.tuxfamily.org/bz/show_bug.cgi?id=747 | ||
if (rstride < 0 || cstride < 0) { | ||
negativestrides = true; | ||
} else { | ||
stride = {EigenRowMajor ? rstride : cstride /* outer stride */, | ||
EigenRowMajor ? cstride : rstride /* inner stride */ }; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} |
Description
Suggested changelog entry: