Skip to content

Commit 1fb0f9c

Browse files
authored
Merge pull request #16 from CasBex/reduce_over_dims
_buffer_frame for Cartesian index
2 parents 45f79d4 + 9e08d85 commit 1fb0f9c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/CircularArrayBuffers.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ end
9696
end
9797
end
9898

99+
_buffer_frame(cb::CircularArrayBuffer, I::CartesianIndex) = CartesianIndex(map(i->_buffer_frame(cb, i), Tuple(I)))
99100
_buffer_frame(cb::CircularArrayBuffer, I::AbstractArray{<:Integer}) = map(i -> _buffer_frame(cb, i), I)
100101
_buffer_frame(cb::CircularArrayBuffer, ::Colon) = _buffer_frame(cb, axes(cb)[end])
101102

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ CUDA.allowscalar(false)
129129
push!(b, x * A)
130130
end
131131

132+
@test sum(b, dims=3) == fill(6.0, 2, 2, 1)
133+
132134
@test capacity(b) == 3
133135
@test isfull(b) == true
134136
@test length(b) == 2 * 2 * 3
@@ -176,6 +178,7 @@ CUDA.allowscalar(false)
176178
for i in 1:5
177179
push!(b, fill(i, 2))
178180
end
181+
@test sum(b, dims=2) == [12;12;;]
179182
empty!(b)
180183
append!(b, 1:4)
181184
@test b == [

0 commit comments

Comments
 (0)