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

Allow CartesianIndices with Bool argument #39962

Merged
merged 2 commits into from
Mar 12, 2021
Merged

Conversation

bkamins
Copy link
Member

@bkamins bkamins commented Mar 9, 2021

Follow up to the problem discussed in #31829 (comment).

I came to the conclusion that CartesianIndices((true,)) should be allowed as in this context true represents a dimension length not an index.

bkamins added 2 commits March 9, 2021 10:46
Follow up to the problem discussed in JuliaLang#31829 (comment).

I came to the conclusion that `CartesianIndices((true,))` should be allowed as in this context `true` represents a dimension length not an index.
@bkamins bkamins requested a review from timholy March 9, 2021 09:49
@vtjnash vtjnash merged commit d234931 into JuliaLang:master Mar 12, 2021
@@ -278,6 +278,7 @@ module IteratorsMD

CartesianIndices(A::AbstractArray) = CartesianIndices(axes(A))

_convert2ind(sz::Bool) = Base.OneTo(Int(sz))
Copy link
Member

Choose a reason for hiding this comment

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

Should we use Int8 here, so it doesn't occupy more memory?

ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
Follow up to the problem discussed in JuliaLang#31829 (comment).

I came to the conclusion that `CartesianIndices((true,))` should be allowed as in this context `true` represents a dimension length not an index.
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
Follow up to the problem discussed in JuliaLang#31829 (comment).

I came to the conclusion that `CartesianIndices((true,))` should be allowed as in this context `true` represents a dimension length not an index.
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.

2 participants