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

More IdOffsetRange broadcasting #292

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented May 24, 2022

Fix an overflow issue with broadcasting over IdOffsetRange, and add more methods that exist for Base ranges:

julia> r = OffsetArrays.IdOffsetRange(3:5, -1)
OffsetArrays.IdOffsetRange(values=2:4, indices=0:2)

julia> r .+ big(typemax(Int)) # fixed in this PR
OffsetArrays.IdOffsetRange(values=9223372036854775809:9223372036854775811, indices=0:2)

julia> r .* 2
4:2:8 with indices 0:2

julia> big.(r)
OffsetArrays.IdOffsetRange(values=2:4, indices=0:2)

@codecov
Copy link

codecov bot commented May 24, 2022

Codecov Report

Merging #292 (1fc8720) into master (26de770) will increase coverage by 0.75%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #292      +/-   ##
==========================================
+ Coverage   95.67%   96.42%   +0.75%     
==========================================
  Files           5        5              
  Lines         439      448       +9     
==========================================
+ Hits          420      432      +12     
+ Misses         19       16       -3     
Impacted Files Coverage Δ
src/axes.jl 100.00% <100.00%> (ø)
src/OffsetArrays.jl 98.27% <0.00%> (+0.68%) ⬆️
src/utils.jl 98.00% <0.00%> (+2.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 26de770...1fc8720. Read the comment docs.

Copy link
Member

@johnnychen94 johnnychen94 left a comment

Choose a reason for hiding this comment

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

I'm not sure if promoting to OffsetVector is a wanted outcome. Do you have some real applications to illustrate this more?

@johnnychen94 johnnychen94 requested a review from timholy May 24, 2022 21:40
@jishnub
Copy link
Member Author

jishnub commented May 25, 2022

I don't really have an application in mind, this was more about making an offset range and an offset vector behave identically. Currently, we don't have an OffsetRange <: AbstractRange type, so I defaulted to OffsetArray. In the future, perhaps this may return an AbstractRange.

@johnnychen94
Copy link
Member

@jishnub I just removed the review request from @timholy, if you still want this output then should probably rebase this PR and reassign him.

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