-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add signed and compress to constructor args #48
Conversation
Codecov Report
@@ Coverage Diff @@
## main #48 +/- ##
==========================================
+ Coverage 75.63% 76.23% +0.60%
==========================================
Files 1 1
Lines 197 202 +5
==========================================
+ Hits 149 154 +5
Misses 48 48
Continue to review full report at Codecov.
|
@test eltype(PooledArray(s).refs) == UInt32 | ||
@test eltype(PooledArray(s, signed=true).refs) == Int32 | ||
@test eltype(PooledArray(s, compress=true).refs) == UInt8 | ||
@test eltype(PooledArray(s, signed=true, compress=true).refs) == Int8 |
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.
can we please add a test when signed widening happens?
@@ -123,13 +126,16 @@ function PooledArray{T}(d::AbstractArray, r::Type{R}) where {T,R<:Integer} | |||
PooledArray(RefArray(refs::Vector{R}), invpool::Dict{T,R}, pool) | |||
end | |||
|
|||
function PooledArray{T}(d::AbstractArray) where T | |||
refs, invpool, pool = _label(d, T) | |||
function PooledArray{T}(d::AbstractArray; signed::Bool=false, compress::Bool=false) where {T} |
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.
docstring above requires an update about kwargs.
# Constructor from array, invpool, and ref type | ||
|
||
""" | ||
PooledArray(array, [reftype]) | ||
PooledArray(array, [reftype]; signed=false, compress=false) | ||
|
||
Freshly allocate `PooledArray` using the given array as a source where each | ||
element will be referenced as an integer of the given type. | ||
If no `reftype` is specified one is chosen automatically based on the number of unique elements. |
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 isn't correct now. See #57.
Per the discussion in #47 this PR adds keyword arguments
signed
andcompress
to a constructor.