JuliaReach / LazySets.jl

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

Conversion from zonotopic set to Hyperrectangle #3484

Closed schillic closed 3 months ago

mforets commented 3 months ago

I see it can be useful syntax, but slightly confusing, given that only works for some but not (actually most) zonotopes? While in the other direction it always works. I'd rather not have this method, and in practice suggest using overapproximate(Hyperrectangle, Z::Zonotope).

EDIT: I see it can be useful syntax for exact conversions, so I'll approve it.

schillic commented 3 months ago

Unfortunately, I do not remember why I suggested this PR. I would now agree to use overapproximate(Z::Zonotope, Hyperrectangle). The implementation here is probably more efficient, but it is true that it only applies in rare cases. Nevertheless, Julia generally allows convert even if most inputs are invalid:

julia> convert(Int, 1.0)
1

julia> convert(Int, 1.1)
ERROR: InexactError: Int64(1.1)

In that light, I think we can add this method.