JuliaReach / LazySets.jl

Scalable symbolic-numeric set computations in Julia
https://juliareach.github.io/LazySets.jl/
Other
226 stars 32 forks source link

Generic vertices list for hyperrectangular sets fails with static vectors #1983

Closed mforets closed 4 years ago

mforets commented 4 years ago
julia> using LazySets, StaticArrays

julia> A = Hyperrectangle(low=SVector(0.0, 0.0), high=SVector(1.0, 1.0))
Hyperrectangle{Float64,SArray{Tuple{2},Float64,1,2},SArray{Tuple{2},Float64,1,2}}([0.5, 0.5], [0.5, 0.5])

julia> vertices_list(A)
setindex!(::SArray{Tuple{2},Float64,1,2}, value, ::Int) is not defined.

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] setindex!(::SArray{Tuple{2},Float64,1,2}, ::Float64, ::Int64) at /home/mforets/.julia/packages/StaticArrays/1g9bq/src/indexing.jl:3
 [3] vertices_list(::Hyperrectangle{Float64,SArray{Tuple{2},Float64,1,2},SArray{Tuple{2},Float64,1,2}}) at /home/mforets/.julia/dev/LazySets/src/Interfaces/AbstractHyperrectangle.jl:197
 [4] top-level scope at In[51]:1
schillic commented 4 years ago

The problem is that we copy the center and modify the copy. In addition we should convert the copy to a Vector.

https://github.com/JuliaReach/LazySets.jl/blob/c61beeacc7ad7eae8634a03f8e2fb7aef65bb8c9/src/Interfaces/AbstractHyperrectangle.jl#L182-L201

mforets commented 4 years ago

In addition we should convert the copy to a Vector.

I didn't check it yet, but that sounds like it would return Vectors? The list returned by vertices_list shouldn't change the vector representation.