Skip to content

Conversation

@Lishen1
Copy link
Contributor

@Lishen1 Lishen1 commented Nov 19, 2021

Description

Suggested changelog entry:

* Fix a rare warning about extra copy in an Eigen constructor. 

Copy link
Collaborator

@Skylion007 Skylion007 left a 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.

@Skylion007 Skylion007 self-requested a review November 19, 2021 16:09
Copy link
Collaborator

@Skylion007 Skylion007 left a 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.

Comment on lines 84 to 85
stride{EigenRowMajor ? rstride > 0 ? rstride : 0 : cstride > 0 ? cstride : 0 /* outer stride */,
EigenRowMajor ? cstride > 0 ? cstride : 0 : rstride > 0 ? rstride : 0 /* inner stride */ } {
Copy link
Collaborator

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.

} else {
stride = {EigenRowMajor ? rstride : cstride /* outer stride */,
EigenRowMajor ? cstride : rstride /* inner stride */ };
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}

@henryiii henryiii merged commit 5d067e8 into pybind:master Nov 22, 2021
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Nov 22, 2021
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants