-
Notifications
You must be signed in to change notification settings - Fork 46
Trying to allow Int8 as indices
#371
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #371 +/- ##
==========================================
- Coverage 96.57% 95.58% -0.99%
==========================================
Files 6 6
Lines 467 476 +9
==========================================
+ Hits 451 455 +4
- Misses 16 21 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
giordano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll defer the decision about adding a new type parameter to the maintainers of the package
| @static if isdefined(Adapt, :parent_type) | ||
| # To support Adapt 3.0 which doesn't have parent_type defined | ||
| Adapt.parent_type(::Type{OffsetArray{T,N,AA,I}}) where {T,N,AA,I} = AA | ||
| Adapt.parent_type(::Type{OffsetArray{T,N,AA}}) where {T,N,AA} = AA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is probably redundant at this point
| Adapt.parent_type(::Type{OffsetArray{T,N,AA}}) where {T,N,AA} = AA |
|
|
||
| Base.IndexStyle(::Type{OA}) where {OA<:OffsetArray} = IndexStyle(parenttype(OA)) | ||
| parenttype(::Type{OffsetArray{T,N,AA,I}}) where {T,N,AA,I} = AA | ||
| parenttype(::Type{OffsetArray{T,N,AA}}) where {T,N,AA} = AA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this method is redundant
| parenttype(::Type{OffsetArray{T,N,AA}}) where {T,N,AA} = AA |
|
|
||
| Base.strides(A::OffsetArray) = strides(parent(A)) | ||
| Base.elsize(::Type{OffsetArray{T,N,A,I}}) where {T,N,A,I} = Base.elsize(A) | ||
| Base.elsize(::Type{OffsetArray{T,N,A}}) where {T,N,A} = Base.elsize(A) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other redundant method
| Base.elsize(::Type{OffsetArray{T,N,A}}) where {T,N,A} = Base.elsize(A) |
| # something similar also holds for OffsetUnitRange{BigInt} | ||
| # We may replace the former with the latter in an indexing operation to obtain a performance boost | ||
| @inline function Base.to_index(r::OffsetUnitRange{<:Union{Int,BigInt}}) | ||
| @inline function Base.to_index(r::OffsetUnitRange{<:Union{Integer,BigInt}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BigInt <: Integer
| @inline function Base.to_index(r::OffsetUnitRange{<:Union{Integer,BigInt}}) | |
| @inline function Base.to_index(r::OffsetUnitRange{<:Integer}) |
This PR is trying to solve #370. This is just an initial proposal, but I guess there is a lot of work to do still.
I have noticed that
so I had to manually change some tests when the offsets are
BigIntsAny suggestion or comment is more than welcome as I am not very sure about downstream implications of this PR