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)
13
13
Base. IndexStyle (g:: GroupedArray ) = Base. IndexLinear ()
14
14
Base. LinearIndices (g:: GroupedArray ) = axes (g. refs, 1 )
15
15
16
+ Base. @propagate_inbounds function Base. getindex (g:: GroupedArray{Int} , i:: Number )
17
+ @boundscheck checkbounds (g, i)
18
+ @inbounds g. refs[i]
19
+ end
16
20
17
21
Base. @propagate_inbounds function Base. getindex (g:: GroupedArray , i:: Number )
18
22
@boundscheck checkbounds (g, i)
19
23
@inbounds x = g. refs[i]
20
24
x == 0 ? missing : x
21
25
end
22
- Base. @propagate_inbounds function Base. getindex (g:: GroupedArray{Int} , i:: Number )
23
- @boundscheck checkbounds (g, i)
24
- @inbounds g. refs[i]
25
- end
26
26
27
27
Base. @propagate_inbounds function Base. setindex! (g:: GroupedArray , x:: Number , i:: Number )
28
28
@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
31
33
@inbounds g. refs[i] = x
32
34
end
33
35
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
+
34
41
# Constructor
35
42
function GroupedArray (args... ; coalesce = false )
36
43
s = size (args[1 ])
You can’t perform that action at this time.
0 commit comments