Skip to content

Commit

Permalink
cumsum default dims=1
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Feb 26, 2024
1 parent 1f44868 commit ab2a2ff
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QuasiArrays"
uuid = "c4ea9172-b204-11e9-377d-29865faadc5c"
authors = ["Sheehan Olver <[email protected]>"]
version = "0.11.4"
version = "0.11.5"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
3 changes: 1 addition & 2 deletions src/calculus.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ _sum(V::AbstractQuasiArray, dims) = sum_layout(MemoryLayout(V), V, dims)
_sum(V::AbstractQuasiArray, ::Colon) = sum_layout(MemoryLayout(V), V, :)

_cumsum(A, dims) = cumsum_layout(MemoryLayout(A), A, dims)
cumsum(A::AbstractQuasiArray; dims::Integer) = _cumsum(A, dims)
cumsum(x::AbstractQuasiVector) = cumsum(x, dims=1)
cumsum(A::AbstractQuasiArray; dims::Integer=1) = _cumsum(A, dims)

# sum is equivalent to hitting by ones(n) on the left or right

Expand Down
2 changes: 1 addition & 1 deletion test/test_calculus.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ using QuasiArrays, IntervalSets, Test
@test sum(ApplyQuasiArray(*, A, B); dims=2) sum(A*B; dims=2)

@test sum(b) last(cumsum(b)) cumsum(b)[2]
@test cumsum(B; dims=1)[2:2,:] sum(B; dims=1)
@test cumsum(B)[2:2,:] cumsum(B; dims=1)[2:2,:] sum(B; dims=1)
@test cumsum(B; dims=2)[:,0.5:0.5] sum(B; dims=2)

@test cumsum(ApplyQuasiArray(*, A, b)) cumsum(A*b)
Expand Down

0 comments on commit ab2a2ff

Please sign in to comment.