JuliaReach/LazySets.jl

Outsource common code to implement concretize of lazy array operations

schillic opened this issue · 0 comments

Compare:

function concretize(msa::MinkowskiSumArray)
a = array(msa)
@assert !isempty(a) "an empty Minkowski sum is not allowed"
X = msa
@inbounds for (i, Y) in enumerate(a)
if i == 1
X = concretize(Y)
else
X = minkowski_sum(X, concretize(Y))
end
end
return X
end

function concretize(cpa::CartesianProductArray)
a = array(cpa)
@assert !isempty(a) "an empty Cartesian product is not allowed"
X = cpa
@inbounds for (i, Y) in enumerate(a)
if i == 1
X = concretize(Y)
else
X = cartesian_product(X, concretize(Y))
end
end
return X
end