JuliaReach / LazySets.jl

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

#3419 - Fast `low`/`high`/`extrema` for polyhedra #3617

Open schillic opened 1 month ago

schillic commented 1 month ago

Closes #3419.

julia> P = convert(HPolytope, Interval(1, 2));

julia> @time extrema(P)
  0.000274 seconds (701 allocations: 42.406 KiB)  # master
  0.000007 seconds (3 allocations: 160 bytes)
([1.0], [2.0])

julia> @time extrema(P, 1)
  0.000361 seconds (699 allocations: 42.281 KiB)  # master
  0.000004 seconds (1 allocation: 32 bytes)
(1.0, 2.0)

julia> @time low(P)
  0.000386 seconds (350 allocations: 21.188 KiB)  # master
  0.000011 seconds (1 allocation: 64 bytes)
1-element Vector{Float64}:
 1.0

julia> @time low(P, 1)
  0.000408 seconds (350 allocations: 21.141 KiB)  # master
  0.000005 seconds (1 allocation: 16 bytes)
1.0

julia> @time high(P)
  0.000322 seconds (350 allocations: 21.188 KiB)  # master
  0.000008 seconds (1 allocation: 64 bytes)
1-element Vector{Float64}:
 2.0

julia> @time high(P, 1)
  0.000214 seconds (350 allocations: 21.141 KiB)  # master
  0.000005 seconds (1 allocation: 16 bytes)
2.0