You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be very nice if this could be supported, too:
julia> v2 = [1,2,3,4,missing]
5-element Array{Union{Missing, Int64},1}:1234missing
julia>reinterpret(Union{Missing, Some{Int64}}, v)
ERROR: ArgumentError: cannot reinterpret `Int64``Union{Missing, Some{Int64}}`, type `Union{Missing, Some{Int64}}` is not a bits type
Stacktrace:
[1] (::getfield(Base, Symbol("#throwbits#200")))(::Type{Int64}, ::Type{Union{Missing, Some{Int64}}}, ::Type{Union{Missing, Some{Int64}}}) at ./reinterpretarray.jl:16
[2] reinterpret(::Type{Union{Missing, Some{Int64}}}, ::Array{Int64,1}) at ./reinterpretarray.jl:33
[3] top-level scope at none:0
I've explained the use case on discourse. Briefly, when working with Unitful vectors, one often has to take out the units (eg. to make a linear regression), then tack them back on the result. Both operations could conceivably be done allocation-free with reinterpret, but are very slow on vectors that contain missings.
The text was updated successfully, but these errors were encountered:
This works:
It would be very nice if this could be supported, too:
I've explained the use case on discourse. Briefly, when working with Unitful vectors, one often has to take out the units (eg. to make a linear regression), then tack them back on the result. Both operations could conceivably be done allocation-free with
reinterpret
, but are very slow on vectors that containmissing
s.The text was updated successfully, but these errors were encountered: