File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -13,24 +13,31 @@ Base.axes(g::GroupedArray) = axes(g.refs)
1313Base. IndexStyle (g:: GroupedArray ) = Base. IndexLinear ()
1414Base. LinearIndices (g:: GroupedArray ) = axes (g. refs, 1 )
1515
16+ Base. @propagate_inbounds function Base. getindex (g:: GroupedArray{Int} , i:: Number )
17+ @boundscheck checkbounds (g, i)
18+ @inbounds g. refs[i]
19+ end
1620
1721Base. @propagate_inbounds function Base. getindex (g:: GroupedArray , i:: Number )
1822 @boundscheck checkbounds (g, i)
1923 @inbounds x = g. refs[i]
2024 x == 0 ? missing : x
2125end
22- Base. @propagate_inbounds function Base. getindex (g:: GroupedArray{Int} , i:: Number )
23- @boundscheck checkbounds (g, i)
24- @inbounds g. refs[i]
25- end
2626
2727Base. @propagate_inbounds function Base. setindex! (g:: GroupedArray , x:: Number , i:: Number )
2828 @boundscheck checkbounds (g, i)
29- x <= 0 && throw (ArgumentError (" The number x must be positive" ))
30- x > g. ngroups && (g. ngroups = x)
29+ x > 0 || throw (ArgumentError (" The number x must be positive" ))
30+ if x > g. ngroups
31+ g. ngroups = x
32+ end
3133 @inbounds g. refs[i] = x
3234end
3335
36+ Base. @propagate_inbounds function Base. setindex! (g:: GroupedArray{T} , x:: Missing , i:: Number ) where {T >: Missing }
37+ @boundscheck checkbounds (g, i)
38+ @inbounds g. refs[i] = 0
39+ end
40+
3441# Constructor
3542function GroupedArray (args... ; coalesce = false )
3643 s = size (args[1 ])
You can’t perform that action at this time.
0 commit comments