Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Jun 10, 2024
1 parent d833880 commit b61f93d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/src/lib/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ volume(::LazySet)
affine_map(::AbstractMatrix, ::LazySet, ::AbstractVector)
exponential_map(::AbstractMatrix, ::LazySet)
∈(::AbstractVector, ::LazySet)
is_interior_point(::AbstractVector{N}, ::LazySet; p=Inf, ε=_rtol(N)) where {N<:Real}
is_interior_point(::AbstractVector{<:Real}, ::LazySet; kwargs...)
linear_map(::AbstractMatrix, ::LazySet)
permute(::LazySet, ::AbstractVector{Int})
project(::LazySet, ::AbstractVector{Int})
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/interfaces/LazySet.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ exponential_map(::AbstractMatrix, ::LazySet)
an_element(::LazySet)
tosimplehrep(::LazySet)
reflect(::LazySet)
is_interior_point(::AbstractVector, ::LazySet; kwargs...)
is_interior_point(::AbstractVector{<:Real}, ::LazySet; kwargs...)
isoperation(::LazySet)
isequivalent(::LazySet, ::LazySet)
surface(::LazySet)
Expand Down
8 changes: 4 additions & 4 deletions src/API/Mixed/is_interior_point.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
"""
is_interior_point(v::AbstractVector{N}, X::LazySet; [p]=N(Inf), [ε]=_rtol(N)) where {N}
is_interior_point(v::AbstractVector{<:Real}, X::LazySet; kwargs...) end
Check whether a point is contained in the interior of a set.
### Input
- `v` -- point/vector
- `X` -- set
- `p` -- (optional; default: `N(Inf)`) norm of the ball used to apply the error
- `p` -- (optional; default: `Inf`) norm of the ball used to apply the error
tolerance
- `ε` -- (optional; default: `_rtol(N)`) error tolerance of the check
- `ε` -- (optional; default: `_rtol(eltype(X))`) error tolerance of the check
### Output
`true` iff the point `v` is strictly contained in `X` with tolerance `ε`.
"""
function is_interior_point(::AbstractVector{N}, ::LazySet; p=N(Inf), ε=_rtol(N)) where {N} end
function is_interior_point(::AbstractVector{<:Real}, ::LazySet; kwargs...) end
9 changes: 7 additions & 2 deletions src/Interfaces/LazySet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ The default implementation determines `v ∈ interior(X)` with error tolerance
`ε` by checking whether a `Ballp` of norm `p` with center `v` and radius `ε` is
contained in `X`.
"""
function is_interior_point(v::AbstractVector, X::LazySet; kwargs...)
function is_interior_point(v::AbstractVector{<:Real}, X::LazySet; kwargs...)
N = promote_type(eltype(v), eltype(X))
if N != eltype(X)
throw(ArgumentError("the set eltype must be more general"))
Expand All @@ -594,8 +594,13 @@ function is_interior_point(v::AbstractVector, X::LazySet; kwargs...)
v = convert(Vector{N}, v)
end
ε = get(kwargs, , _rtol(N))
@assert ε > zero(N) "the tolerance must be strictly positive"
p = get(kwargs, :p, N(Inf))
return is_interior_point(v, X; p=p, ε=ε)
end

function is_interior_point(v::AbstractVector{N}, X::LazySet{N}; p=N(Inf),
ε=_rtol(N)) where {N<:Real}
@assert ε > zero(N) "the tolerance must be strictly positive"
return Ballp(p, v, ε) X
end

Expand Down

0 comments on commit b61f93d

Please sign in to comment.