diff --git a/src/Initialization/init_Distributions.jl b/src/Initialization/init_Distributions.jl index 894a236e0e..e04c5b9f4e 100644 --- a/src/Initialization/init_Distributions.jl +++ b/src/Initialization/init_Distributions.jl @@ -1 +1 @@ -eval(load_distributions_samples()) +eval(load_Distributions_sample()) diff --git a/src/Sets/Ball2/init.jl b/src/Sets/Ball2/init.jl index db21eea3f0..44135f39e8 100644 --- a/src/Sets/Ball2/init.jl +++ b/src/Sets/Ball2/init.jl @@ -1,3 +1,3 @@ function __init__() - @require Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" eval(load_distributions_samples()) + @require Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" eval(load_Distributions_sample()) end diff --git a/src/Sets/Ball2/sample.jl b/src/Sets/Ball2/sample.jl index 283b8f2836..c69899fd41 100644 --- a/src/Sets/Ball2/sample.jl +++ b/src/Sets/Ball2/sample.jl @@ -82,17 +82,15 @@ function _sample_unit_nball_muller!(D::Vector{Vector{N}}, n::Int, p::Int; return _sample_unit_nball_muller_distributions!(D, n, p; rng=rng, seed=seed) end -function load_distributions_samples() +function load_Distributions_sample() return quote - using .Distributions: Uniform, Normal - function _sample_unit_nball_muller_distributions!(D::Vector{Vector{N}}, n::Int, p::Int; rng::AbstractRNG=GLOBAL_RNG, seed::Union{Int,Nothing}=nothing) where {N} rng = reseed!(rng, seed) - Zdims = [Normal() for _ in 1:n] # normal distributions for each dimension - Zrad = Uniform() # distribution to pick random radius + Zdims = [Distributions.Normal() for _ in 1:n] # normal distributions for each dimension + Zrad = Distributions.Uniform() # distribution to pick random radius one_over_n = one(N) / n v = Vector{N}(undef, n) # sample direction @inbounds for j in 1:p @@ -108,4 +106,4 @@ function load_distributions_samples() return D end end -end # quote / load_distributions_samples() +end # load_Distributions_sample diff --git a/src/Sets/BallInf/genmat.jl b/src/Sets/BallInf/genmat.jl index 627b95e030..7988a0c2c8 100644 --- a/src/Sets/BallInf/genmat.jl +++ b/src/Sets/BallInf/genmat.jl @@ -1,17 +1,17 @@ -function load_genmat_ballinf_static() +function load_StaticArraysCore_genmat() return quote - using StaticArraysCore: SMatrix, SVector, MMatrix + using StaticArraysCore: SVector function genmat(B::BallInf{N,SVector{L,N}}) where {L,N} if isflat(B) - return SMatrix{L,0,N,0}() + return StaticArraysCore.SMatrix{L,0,N,0}() else - gens = zeros(MMatrix{L,L}) + gens = zeros(StaticArraysCore.MMatrix{L,L}) @inbounds for i in 1:L gens[i, i] = B.radius end - return SMatrix(gens) + return StaticArraysCore.SMatrix(gens) end end end -end # quote / load_genmat_ballinf_static() +end # load_StaticArraysCore_genmat diff --git a/src/Sets/BallInf/init.jl b/src/Sets/BallInf/init.jl index dd08a10483..68bd99a980 100644 --- a/src/Sets/BallInf/init.jl +++ b/src/Sets/BallInf/init.jl @@ -1,3 +1,3 @@ function __init__() - @require StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" eval(load_genmat_ballinf_static()) + @require StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" eval(load_StaticArraysCore_genmat()) end diff --git a/src/Sets/HPolyhedron/HPolyhedron.jl b/src/Sets/HPolyhedron/HPolyhedron.jl index c6ed055887..15589a90b4 100644 --- a/src/Sets/HPolyhedron/HPolyhedron.jl +++ b/src/Sets/HPolyhedron/HPolyhedron.jl @@ -59,7 +59,7 @@ function load_Polyhedra_HPolyhedron() end end # load_Polyhedra_HPolyhedron -function load_symbolics_hpolyhedron() +function load_Symbolics_HPolyhedron() return quote using .Symbolics: Num using ..LazySets: _get_variables, _vec, _is_halfspace, _is_hyperplane @@ -140,4 +140,4 @@ function load_symbolics_hpolyhedron() return HPolyhedron(expr, _vec(vars); N=N) end end -end # quote / load_symbolics_hpolyhedron() +end # load_Symbolics_HPolyhedron diff --git a/src/Sets/HPolyhedron/init.jl b/src/Sets/HPolyhedron/init.jl index b66c9faef4..b8390d2134 100644 --- a/src/Sets/HPolyhedron/init.jl +++ b/src/Sets/HPolyhedron/init.jl @@ -1,5 +1,5 @@ function __init__() @require LazySets = "b4f0291d-fe17-52bc-9479-3d1a343d9043" include("init_LazySets.jl") @require Polyhedra = "67491407-f73d-577b-9b50-8179a7c68029" include("init_Polyhedra.jl") - @require Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" eval(load_symbolics_hpolyhedron()) + @require Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" eval(load_Symbolics_HPolyhedron()) end diff --git a/src/Sets/HPolytope/HPolytope.jl b/src/Sets/HPolytope/HPolytope.jl index c1a5f8c588..5329feb58e 100644 --- a/src/Sets/HPolytope/HPolytope.jl +++ b/src/Sets/HPolytope/HPolytope.jl @@ -101,7 +101,7 @@ function load_Polyhedra_HPolytope() end end # load_Polyhedra_HPolytope -function load_symbolics_hpolytope() +function load_Symbolics_HPolytope() return quote using .Symbolics: Num using ..LazySets: _get_variables, _vec @@ -161,4 +161,4 @@ function load_symbolics_hpolytope() return HPolytope(expr, _vec(vars); N=N, check_boundedness=check_boundedness) end end -end # quote / load_symbolics_hpolytope() +end # load_Symbolics_HPolytope diff --git a/src/Sets/HPolytope/init.jl b/src/Sets/HPolytope/init.jl index 614e4b31e0..3f7e2e7e06 100644 --- a/src/Sets/HPolytope/init.jl +++ b/src/Sets/HPolytope/init.jl @@ -1,5 +1,5 @@ function __init__() @require LazySets = "b4f0291d-fe17-52bc-9479-3d1a343d9043" include("init_LazySets.jl") @require Polyhedra = "67491407-f73d-577b-9b50-8179a7c68029" include("init_Polyhedra.jl") - @require Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" eval(load_symbolics_hpolytope()) + @require Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" eval(load_Symbolics_HPolytope()) end diff --git a/src/Sets/Hyperrectangle/genmat.jl b/src/Sets/Hyperrectangle/genmat.jl index b819db99e5..0aa1363567 100644 --- a/src/Sets/Hyperrectangle/genmat.jl +++ b/src/Sets/Hyperrectangle/genmat.jl @@ -4,12 +4,12 @@ function genmat(H::Hyperrectangle{N,<:AbstractVector,<:SparseVector{N}}) where { return sparse(nze, 1:length(nze), nzv, n, length(nze)) end -function load_genmat_hyperrectangle_static() +function load_StaticArraysCore_genmat() return quote - using .StaticArraysCore: SVector, MMatrix, SMatrix + using .StaticArraysCore: SVector function genmat(H::Hyperrectangle{N,SVector{L,N},SVector{L,N}}) where {L,N} - gens = zeros(MMatrix{L,L,N}) + gens = zeros(StaticArraysCore.MMatrix{L,L,N}) nzcol = Vector{Int}() @inbounds for i in 1:L r = H.radius[i] @@ -19,18 +19,18 @@ function load_genmat_hyperrectangle_static() end end m = length(nzcol) - return SMatrix{L,m}(view(gens, :, nzcol)) + return StaticArraysCore.SMatrix{L,m}(view(gens, :, nzcol)) end # this function is type stable, but it does not prune the generators # according to flat dimensions of H function _genmat_static(H::Hyperrectangle{N,SVector{L,N},SVector{L,N}}) where {L,N} - gens = zeros(MMatrix{L,L,N}) + gens = zeros(StaticArraysCore.MMatrix{L,L,N}) @inbounds for i in 1:L r = H.radius[i] gens[i, i] = r end - return SMatrix{L,L}(gens) + return StaticArraysCore.SMatrix{L,L}(gens) end end -end # quote / load_genmat_hyperrectangle_static() +end # load_StaticArraysCore_genmat diff --git a/src/Sets/Hyperrectangle/init.jl b/src/Sets/Hyperrectangle/init.jl index 685b1f5ae9..73e7121db5 100644 --- a/src/Sets/Hyperrectangle/init.jl +++ b/src/Sets/Hyperrectangle/init.jl @@ -1,4 +1,4 @@ function __init__() @require IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" eval(load_IntervalArithmetic_convert()) - @require StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" eval(load_genmat_hyperrectangle_static()) + @require StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" eval(load_StaticArraysCore_genmat()) end diff --git a/src/Sets/SparsePolynomialZonotope/init_RangeEnclosures.jl b/src/Sets/SparsePolynomialZonotope/init_RangeEnclosures.jl index 4db845d6cc..41b58f3d76 100644 --- a/src/Sets/SparsePolynomialZonotope/init_RangeEnclosures.jl +++ b/src/Sets/SparsePolynomialZonotope/init_RangeEnclosures.jl @@ -1,3 +1 @@ -using .RangeEnclosures: enclose - -eval(load_RangeEnclosures_rho()) +eval(load_RangeEnclosures_support_function()) diff --git a/src/Sets/SparsePolynomialZonotope/support_function.jl b/src/Sets/SparsePolynomialZonotope/support_function.jl index f0c5683093..82bafa1207 100644 --- a/src/Sets/SparsePolynomialZonotope/support_function.jl +++ b/src/Sets/SparsePolynomialZonotope/support_function.jl @@ -29,7 +29,7 @@ function ρ(d::AbstractVector, P::SparsePolynomialZonotope; return _ρ_range_enclosures(d, P, enclosure_method) end -function load_RangeEnclosures_rho() +function load_RangeEnclosures_support_function() return quote function _ρ_range_enclosures(d::AbstractVector, P::SparsePolynomialZonotope, method::Union{RangeEnclosures.AbstractEnclosureAlgorithm, @@ -48,8 +48,8 @@ function load_RangeEnclosures_rho() f(x) = sum(d' * gi * prod(x .^ ei) for (gi, ei) in zip(eachcol(G), eachcol(E))) dom = IA.IntervalBox(IA.interval(-1, 1), n) - res += IA.sup(enclose(f, dom, method)) + res += IA.sup(RangeEnclosures.enclose(f, dom, method)) return res end end -end +end # load_RangeEnclosures_support_function diff --git a/src/Sets/Zonotope/init_StaticArraysCore.jl b/src/Sets/Zonotope/init_StaticArraysCore.jl index 80351aa77d..2b485e95a9 100644 --- a/src/Sets/Zonotope/init_StaticArraysCore.jl +++ b/src/Sets/Zonotope/init_StaticArraysCore.jl @@ -1,4 +1,2 @@ -using StaticArraysCore: SMatrix, SVector, MMatrix, MVector - -eval(load_split_static()) -eval(load_reduce_order_static_zonotope()) +eval(load_StaticArraysCore_split()) +eval(load_StaticArraysCore_reduce_order()) diff --git a/src/Sets/Zonotope/reduce_order.jl b/src/Sets/Zonotope/reduce_order.jl index b6abc4c562..0f42f06224 100644 --- a/src/Sets/Zonotope/reduce_order.jl +++ b/src/Sets/Zonotope/reduce_order.jl @@ -1,11 +1,12 @@ -function load_reduce_order_static_zonotope() +function load_StaticArraysCore_reduce_order() return quote + using .StaticArraysCore: MMatrix using ..LazySets: AbstractReductionMethod # conversion for static matrix function reduce_order(Z::Zonotope{N,<:AbstractVector,<:MMatrix}, r::Real, method::AbstractReductionMethod=GIR05()) where {N} - return reduce_order(Zonotope(center(Z), SMatrix(genmat(Z))), r, method) + return reduce_order(Zonotope(center(Z), StaticArraysCore.SMatrix(genmat(Z))), r, method) end end -end # quote / load_reduce_order_static_zonotope +end # load_StaticArraysCore_reduce_order diff --git a/src/Sets/Zonotope/split.jl b/src/Sets/Zonotope/split.jl index 1e74b0b7db..5554d701bc 100644 --- a/src/Sets/Zonotope/split.jl +++ b/src/Sets/Zonotope/split.jl @@ -35,16 +35,18 @@ end _split_ret(Z₁::Zonotope, Z₂::Zonotope) = (Z₁, Z₂) -function load_split_static() +function load_StaticArraysCore_split() return quote + using .StaticArraysCore: MMatrix, MVector + function _split_ret(Z₁::Zonotope{N,SV,SM}, Z₂::Zonotope{N,SV,SM}) where {N,n,p,SV<:MVector{n,N},SM<:MMatrix{n,p,N}} - Z₁ = Zonotope(SVector{n}(Z₁.center), SMatrix{n,p}(Z₁.generators)) - Z₂ = Zonotope(SVector{n}(Z₂.center), SMatrix{n,p}(Z₂.generators)) + Z₁ = Zonotope(StaticArraysCore.SVector{n}(Z₁.center), StaticArraysCore.SMatrix{n,p}(Z₁.generators)) + Z₂ = Zonotope(StaticArraysCore.SVector{n}(Z₂.center), StaticArraysCore.SMatrix{n,p}(Z₂.generators)) return Z₁, Z₂ end end -end # quote / load_split_static +end # load_StaticArraysCore_split function _split(Z::Zonotope, gens::AbstractVector, n::AbstractVector) p = length(gens) diff --git a/src/Utils/samples.jl b/src/Utils/samples.jl index 7f6ba01613..9a685f3bea 100644 --- a/src/Utils/samples.jl +++ b/src/Utils/samples.jl @@ -625,9 +625,9 @@ function _sample_unit_nsphere_muller!(D::Vector{Vector{N}}, n::Int, p::Int; return _sample_unit_nsphere_muller_distributions!(D, n, p; rng=rng, seed=seed) end -function load_distributions_samples() +function load_Distributions_sample() return quote - using .Distributions: Normal, UnivariateDistribution + using .Distributions: UnivariateDistribution function RejectionSampler(distr::UnivariateDistribution; tight::Bool=false) return RejectionSampler([distr]; tight=tight) @@ -638,7 +638,7 @@ function load_distributions_samples() rng::AbstractRNG=GLOBAL_RNG, seed::Union{Int,Nothing}=nothing) where {N} rng = reseed!(rng, seed) - Zdims = [Normal() for _ in 1:n] # normal distributions for each dimension + Zdims = [Distributions.Normal() for _ in 1:n] # normal distributions for each dimension v = Vector{N}(undef, n) # sample direction @inbounds for j in 1:p α = zero(N) @@ -651,4 +651,4 @@ function load_distributions_samples() return D end end -end # quote / load_distributions_samples() +end # load_Distributions_sample