JuliaReach / LazySets.jl

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

Type inference problem with order reduction #2091

Open mforets opened 4 years ago

mforets commented 4 years ago
using Test, InteractiveUtils

Z = rand(Zonotope, num_generators=40, dim=4);
order(Z)

@inferred reduce_order(Z, 5)
return type Zonotope{Float64,Array{Float64,1},SparseMatrixCSC{Float64,Int64}} does not match inferred return type Zonotope

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at In[62]:1

Source for a variation of the implementation which does not have this problem: https://github.com/JuliaReach/ReachabilityAnalysis.jl/blob/master/src/Flowpipes/setops.jl#L268

mforets commented 4 years ago
@btime ReachabilityAnalysis._reduce_order($Z, 5);
  1.677 μs (54 allocations: 7.22 KiB)

@btime reduce_order($Z, 5);
  5.386 μs (134 allocations: 18.95 KiB)