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 findmin/findmax to return cartesian indices for BitMatrix #30102

Merged
merged 2 commits into from
Nov 28, 2018

Conversation

nalimilan
Copy link
Member

@nalimilan nalimilan commented Nov 20, 2018

For consistency with other AbstractArray types. It's annoying we haven't spotted this earlier, as fixing this inconsistency is technically breaking.

The call to keys is optimized out by the compiler for vectors thanks to @inbounds.

BTW, I've also noticed that the findnext/prev(testf::Function, B::BitArray, start::Integer) methods (just above the diff) accept linear indices even for non-vectors, which is not the case for Array. What's more, there is currently no equivalent of these optimized methods taking CartesianIndex objects, meaning we use the slower generic fallback. That's lower priority, but I'll file an issue.

@nalimilan nalimilan added bugfix This change fixes an existing bug search & find The find* family of functions minor change Marginal behavior change acceptable for a minor release labels Nov 20, 2018
@mbauman mbauman added the triage This should be discussed on a triage call label Nov 20, 2018
@mbauman
Copy link
Member

mbauman commented Nov 20, 2018

Dang, that's unfortunate. I approve of the idea, but we should try to figure out if this is too big for a minor change.

m, mi = false, 1
ti = 1
ac = a.chunks
for i = 1:length(ac)
Copy link
Member

@mbauman mbauman Nov 20, 2018

Choose a reason for hiding this comment

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

Ideally we could just compose with findfirst(B) (and findfirst(!, B) below), but I think the current implementations would be slower than what you have here. Perhaps another place for separate improvements.

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed. But that will require fixing findnext and findprev to accept cartesian indices (as I noted in the description).

Copy link
Member

@timholy timholy left a comment

Choose a reason for hiding this comment

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

Good catch. I do think this is too big for 1.0.x but obviously this is a critical fix for 1.1.0.

@StefanKarpinski
Copy link
Member

macOS CI seems to be failing, anyone know why? @staticfloat?

@staticfloat
Copy link
Member

staticfloat commented Nov 21, 2018

It looks like Travis has changed their image to no longer include ccache. We need to either disable our use of that or get the Travis image to install it again.

EDIT: #30111

@StefanKarpinski
Copy link
Member

F&#$ing Travis.

There is no reason to have them in LinearAlgebra.
For consistency with other AbstractArray types.
The call to keys is optimized out by the compiler for vectors thanks to
@inbounds.
@nalimilan nalimilan merged commit 402c747 into master Nov 28, 2018
@nalimilan nalimilan deleted the nl/findminmax branch November 28, 2018 11:41
@StefanKarpinski StefanKarpinski added needs news A NEWS entry is required for this change and removed triage This should be discussed on a triage call labels Dec 6, 2018
@StefanKarpinski
Copy link
Member

@mbauman or @nalimilan, could you add NEWS for this minor change?

@mbauman
Copy link
Member

mbauman commented Dec 6, 2018

NEWS is in add1246#diff-8312ad0561ef661716b48d09478362f3R27 — a similar change that also should get into 1.1.

@mbauman mbauman removed the needs news A NEWS entry is required for this change label Dec 7, 2018
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 minor change Marginal behavior change acceptable for a minor release search & find The find* family of functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants