Skip to content

Conversation

@YingboMa
Copy link
Member

No description provided.

@YingboMa YingboMa requested a review from ChrisRackauckas May 27, 2020 01:45
@ChrisRackauckas ChrisRackauckas merged commit 6866437 into master May 27, 2020
@ChrisRackauckas ChrisRackauckas deleted the myb/cart branch May 27, 2020 02:57

v = VectorOfArray([zeros(20), zeros(10,10), zeros(3,3,3)])
v[CartesianIndex((3, 2, 3, 2))] = 1
@test v[CartesianIndex((3, 2, 3, 2))] == 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The testing here is insufficient. The abstract array contract is violated

julia> IndexStyle(v)
IndexCartesian()

julia> v[CartesianIndex(size(v))]
ERROR: BoundsError: attempt to access 3-element Array{Array{Float64,N} where N,1} at index [20]
Stacktrace:
 [1] getindex at ./array.jl:788 [inlined]
 [2] getindex(::VectorOfArray{Float64,2,Array{Array{Float64,N} where N,1}}, ::CartesianIndex{2}) at /Users/andreasnoack/.julia/packages/RecursiveArrayTools/Wx7AV/src/vector_of_array.jl:46
 [3] top-level scope at REPL[124]:1

Hasn't this change broken a lot of DiffEq tests?

julia> x = [rand(2) for i in 1:3]
3-element Array{Array{Float64,1},1}:
 [0.9852201256045343, 0.32847272010896966]
 [0.9368428797761215, 0.9223074651115168]
 [0.2577978464729409, 0.9482205432256972]

julia> xde = RecursiveArrayTools.DiffEqArray(x, [1.0, 2.0, 3.0])
t: 3-element Array{Float64,1}:
 1.0
 2.0
 3.0
u: 3-element Array{Array{Float64,1},1}:
 [0.9852201256045343, 0.32847272010896966]
 [0.9368428797761215, 0.9223074651115168]
 [0.2577978464729409, 0.9482205432256972]

julia> hcat(x...)
2×3 Array{Float64,2}:
 0.98522   0.936843  0.257798
 0.328473  0.922307  0.948221

julia> hcat(x...) - xde
2×3 Array{Float64,2}:
  0.0      0.60837  0.257798
 -0.60837  0.0      0.948221

and it gives bounds errors if bounds checking is enabled.

Also, the show method lies about the type

julia> v = VectorOfArray([zeros(20), zeros(10,10), zeros(3,3,3)])
3-element Array{Array{Float64,N} where N,1}:
...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It broke a ton of downstream tests. It'll get worked on today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants