Skip to content

Commit 1201d7b

Browse files
committed
Specialize collectat for AbstractVector
1 parent 1cfc911 commit 1201d7b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utils/basic.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ end
2121
"""
2222
collectat(iter, inds)
2323
24-
Collect iterator `iter` at indices `inds` without materialization.
24+
Collect iterable `iter` at indices `inds` efficiently.
2525
"""
2626
function collectat(iter, inds)
2727
if isempty(inds)
@@ -35,6 +35,8 @@ function collectat(iter, inds)
3535
end
3636
end
3737

38+
collectat(vec::AbstractVector, inds) = vec[inds]
39+
3840
"""
3941
XYZ(xyz)
4042

0 commit comments

Comments
 (0)