From c3d5f3f466e23e83a024998a61678ce77556c816 Mon Sep 17 00:00:00 2001 From: Yingbo Ma Date: Tue, 9 Jun 2020 14:21:42 -0400 Subject: [PATCH] Fix mapreduce --- Project.toml | 2 +- src/vector_of_array.jl | 2 ++ test/basic_indexing.jl | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 11009d49..d9cdd6ba 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "RecursiveArrayTools" uuid = "731186ca-8d62-57ce-b412-fbd966d074cd" authors = ["Chris Rackauckas "] -version = "2.4.3" +version = "2.4.4" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" diff --git a/src/vector_of_array.jl b/src/vector_of_array.jl index 7389efe2..f72e08dc 100644 --- a/src/vector_of_array.jl +++ b/src/vector_of_array.jl @@ -151,6 +151,8 @@ end VA.t,VA.u end +Base.mapreduce(f,op,A::AbstractVectorOfArray) = mapreduce(f,op,(mapreduce(f,op,x) for x in A.u)) + ## broadcasting struct VectorOfArrayStyle{N} <: Broadcast.AbstractArrayStyle{N} end # N is only used when voa sees other abstract arrays diff --git a/test/basic_indexing.jl b/test/basic_indexing.jl index 0c13e9ea..b60f41ff 100644 --- a/test/basic_indexing.jl +++ b/test/basic_indexing.jl @@ -4,6 +4,7 @@ using RecursiveArrayTools, Test recs = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] testa = cat(recs..., dims=2) testva = VectorOfArray(recs) +@test maximum(testva) == maximum(maximum.(recs)) # broadcast with array X = rand(3, 3)