Skip to content

Commit 6e5272f

Browse files
add a map overload
In general, Base.collect_similar isn't able to figure out the right output
1 parent b55b1f1 commit 6e5272f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
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.8.2"
4+
version = "2.9.0"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
@@ -16,7 +16,7 @@ ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
1616
ArrayInterface = "2.7"
1717
RecipesBase = "0.7, 0.8, 1.0"
1818
Requires = "0.5, 1.0"
19-
StaticArrays = "1.0"
19+
StaticArrays = "0.12, 1.0"
2020
ZygoteRules = "0.2"
2121
julia = "1.3"
2222

src/vector_of_array.jl

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

154+
Base.map(f,A::RecursiveArrayTools.AbstractVectorOfArray) = map(f,A.u)
154155
Base.mapreduce(f,op,A::AbstractVectorOfArray) = mapreduce(f,op,(mapreduce(f,op,x) for x in A.u))
155156

156157
## broadcasting

test/interface_tests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@ emptyva = VectorOfArray(Array{Vector{Float64}}([]))
7474
@test isempty(emptyva)
7575
emptyda = DiffEqArray(Array{Vector{Float64}}([]), Vector{Float64}())
7676
@test isempty(emptyda)
77+
78+
A = VectorOfArray(map(i->rand(2,4),1:7))
79+
@test map(x->maximum(x),A) isa Vector

0 commit comments

Comments
 (0)