Skip to content

Commit

Permalink
unicode alias for box_approximation
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Apr 29, 2023
1 parent b861736 commit 2d48603
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/src/lib/approximations.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ approximate
```@docs
box_approximation
interval_hull
□(::LazySet)
symmetric_interval_hull
box_approximation_symmetric
ballinf_approximation
Expand Down
2 changes: 1 addition & 1 deletion src/Approximations/Approximations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using LazySets.JuMP: Model, set_silent, @variable, @constraint, optimize!,
value, @NLobjective

import Base: convert
import LazySets: project
import LazySets: project, □

using ..LazySets: @assert, activate_assertions
# activate assertions by default
Expand Down
7 changes: 7 additions & 0 deletions src/Approximations/box_approximation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ Alias for `box_approximation`.
"""
interval_hull = box_approximation

"""
□(X::LazySet)
Alias for `box_approximation(X)`.
"""
(X::LazySet) = box_approximation(X)

# AbstractHyperrectangle specialization
function box_approximation(S::AbstractHyperrectangle)
return Hyperrectangle(center(S), radius_hyperrectangle(S))
Expand Down
3 changes: 3 additions & 0 deletions test/Approximations/box_approximation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ for N in [Float64, Rational{Int}, Float32]
E = EmptySet{N}(2)
@test box_approximation(E) == E

# alias constructors
@test interval_hull(b) == (b) == box_approximation(b)

# ===================================================================
# Testing box_approximation_symmetric (= symmetric interval hull)
# ===================================================================
Expand Down

0 comments on commit 2d48603

Please sign in to comment.