Phase out slice for dense matrices#2259
Merged
alecjacobson merged 10 commits intomainfrom Sep 1, 2023
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2258
As mentioned in #2258, Eigen v3.4 supports slicing for dense matrices making many of the
igl::sliceoverloads obsolete. I've removed all of their uses within libigl internally and in the tests and tutorial so that now dense slices show up in the static library. They're still available for now (e.g., via header only).This will break code relying on these in the static library, but the fixes are straight forward (and result in cleaner + faster code! thanks, eigen!).
I've also added a
igl::findoverload to make using binary masks easy.There's a nasty gotcha in Eigen's slicing, I'll document here:
this results in
We can see that the
trueandfalsevalues of theEigen::Array<bool,…> Mhave been interpreted as indices0and1🙃Remembering to use
igl::findis a fine solution as long as ... well ... you remember. I wish Eigen would throw a warning if you useboolscalar types as a slicing index.