OffsetArrays.jl icon indicating copy to clipboard operation
OffsetArrays.jl copied to clipboard

More IdOffsetRange broadcasting

Open jishnub opened this issue 3 years ago • 3 comments

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)

jishnub avatar May 24 '22 17:05 jishnub

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%) :arrow_up:
src/utils.jl 98.00% <0.00%> (+2.00%) :arrow_up:

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.

codecov[bot] avatar May 24 '22 17:05 codecov[bot]

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.

jishnub avatar May 25 '22 04:05 jishnub

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

johnnychen94 avatar Jun 07 '22 03:06 johnnychen94