Skip to content
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

fix unique over a dimension to use isequal over == #42737

Merged
merged 1 commit into from
Oct 21, 2021

Conversation

KristofferC
Copy link
Member

unique is documented to use isequal.

Fixes #42733

@KristofferC KristofferC added bugfix This change fixes an existing bug backport 1.6 Change should be backported to release-1.6 backport 1.7 labels Oct 21, 2021
@Seelengrab
Copy link
Contributor


# With NaNs:
E = [1 NaN 3; 1 NaN 3; 1 NaN 3];
@test isequal(unique(E, dims=1), [1 NaN 3])
Copy link
Member

Choose a reason for hiding this comment

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

Also needs a test for dims=2

Copy link
Member Author

Choose a reason for hiding this comment

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

And dims=3, dims=4..? Why?

Copy link
Member

Choose a reason for hiding this comment

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

Given the current implementation it is unlikely to break depending on dimension, but since the observed problem was qualitatively fairly different (adding a column), it seems possible to me that the added test could help in the future (and it's a pretty much free test).

Copy link
Contributor

@Moelf Moelf Oct 21, 2021

Choose a reason for hiding this comment

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

dims=1 is the default so we should at least test dims=2 maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

Given the current implementation it is unlikely to break depending on dimension, but since the observed problem was qualitatively fairly different (adding a column)

There was an identical problem for dims=1 where a row was added.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think these needs more tests, so I added merge-me

@vtjnash vtjnash added the merge me PR is reviewed. Merge when all tests are passing label Oct 21, 2021
@KristofferC KristofferC merged commit 011fda9 into master Oct 21, 2021
@KristofferC KristofferC deleted the kc/isequal_unique branch October 21, 2021 19:57
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Oct 22, 2021
KristofferC added a commit that referenced this pull request Oct 22, 2021
KristofferC added a commit that referenced this pull request Oct 29, 2021
KristofferC added a commit that referenced this pull request Nov 11, 2021
@KristofferC KristofferC removed backport 1.6 Change should be backported to release-1.6 backport 1.7 labels Nov 13, 2021
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug with the "unique" function
6 participants