Skip to content

Commit 0167d2a

Browse files
Merge pull request #107 from SciML/myb/mapreduce
Fix mapreduce
2 parents 986b697 + c3d5f3f commit 0167d2a

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "RecursiveArrayTools"
22
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "2.4.3"
4+
version = "2.4.4"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/vector_of_array.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ end
151151
VA.t,VA.u
152152
end
153153

154+
Base.mapreduce(f,op,A::AbstractVectorOfArray) = mapreduce(f,op,(mapreduce(f,op,x) for x in A.u))
155+
154156
## broadcasting
155157

156158
struct VectorOfArrayStyle{N} <: Broadcast.AbstractArrayStyle{N} end # N is only used when voa sees other abstract arrays

test/basic_indexing.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using RecursiveArrayTools, Test
44
recs = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
55
testa = cat(recs..., dims=2)
66
testva = VectorOfArray(recs)
7+
@test maximum(testva) == maximum(maximum.(recs))
78

89
# broadcast with array
910
X = rand(3, 3)

0 commit comments

Comments
 (0)