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 reduced_index for Integer UnitRanges having eltypes other than Int #39999

Merged
merged 4 commits into from
Apr 28, 2021

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Mar 12, 2021

Fixes #39995

Now

julia> reduce(+, big(1):big(2), dims = 1)
1-element Vector{BigInt}:
 3

@jishnub jishnub changed the title Fix reduced_index for BigInt UnitRanges Fix reduced_index for Integer UnitRanges having eltypes other than Int Mar 13, 2021
@jishnub
Copy link
Contributor Author

jishnub commented Mar 13, 2021

This also fixes some other reductions that use non-Int axes

Before (using the 32-bit build of Julia):

julia> Int
Int32

julia> reduce(+, Int64(5):Int64(6), dims = 1)
ERROR: TypeError: in typeassert, expected Tuple{Base.OneTo{Int64}}, got a value of type Tuple{Base.OneTo{Int32}}

After:

julia> reduce(+, Int64(5):Int64(6), dims = 1)
1-element Array{Int64,1}:
 11

@kshyatt
Copy link
Contributor

kshyatt commented Apr 13, 2021

Is this good to go?

@jishnub
Copy link
Contributor Author

jishnub commented Apr 14, 2021

Yes, this is ready

@jishnub
Copy link
Contributor Author

jishnub commented Apr 28, 2021

Gentle bump, would be nice to have this fixed

base/reducedim.jl Outdated Show resolved Hide resolved
@simeonschaub simeonschaub added kind:bugfix This change fixes an existing bug status:merge me PR is reviewed. Merge when all tests are passing labels Apr 28, 2021
@musm musm merged commit 0470565 into JuliaLang:master Apr 28, 2021
@musm musm removed the status:merge me PR is reviewed. Merge when all tests are passing label Apr 28, 2021
@jishnub jishnub deleted the reducedindexBigInt branch April 28, 2021 15:22
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
JuliaLang#39999)

* reduced_index for BigInt UnitRanges

* Add tests for Integer subtypes

* use OneTo constructor instead of typeof

Co-authored-by: Simeon Schaub <[email protected]>

Co-authored-by: Simeon Schaub <[email protected]>
jarlebring pushed a commit to jarlebring/julia that referenced this pull request May 4, 2021
JuliaLang#39999)

* reduced_index for BigInt UnitRanges

* Add tests for Integer subtypes

* use OneTo constructor instead of typeof

Co-authored-by: Simeon Schaub <[email protected]>

Co-authored-by: Simeon Schaub <[email protected]>
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
JuliaLang#39999)

* reduced_index for BigInt UnitRanges

* Add tests for Integer subtypes

* use OneTo constructor instead of typeof

Co-authored-by: Simeon Schaub <[email protected]>

Co-authored-by: Simeon Schaub <[email protected]>
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
JuliaLang#39999)

* reduced_index for BigInt UnitRanges

* Add tests for Integer subtypes

* use OneTo constructor instead of typeof

Co-authored-by: Simeon Schaub <[email protected]>

Co-authored-by: Simeon Schaub <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bugfix This change fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in evaluating reduced indices with BigInt UnitRange arguments
6 participants