Skip to content

Commit

Permalink
Rectification: add some 'isconvextype' special cases
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Jan 4, 2025
1 parent cb9fac3 commit 7edd581
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/LazyOperations/Rectification.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ isoperationtype(::Type{<:Rectification}) = true

isconvextype(::Type{<:Rectification}) = false

isconvextype(::Type{<:Rectification{N,<:AbstractHyperrectangle}}) where {N} = true
isconvextype(::Type{<:Rectification{N,<:EmptySet}}) where {N} = true
isconvextype(::Type{<:Rectification{N,<:Universe}}) where {N} = true

function _compute_exact_representation!(R::Rectification)
if isnothing(R.cache.set)
R.cache.set = to_union_of_projections(R)
Expand Down
6 changes: 6 additions & 0 deletions test/LazyOperations/Rectification.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ for N in [Float64, Rational{Int}, Float32]
@test !isbounded(RI4) && !isboundedtype(typeof(RI4))
@test !isbounded(Rectification(HalfSpace(N[-1], N(0))))

# isconvextype
@test !isconvextype(typeof(Rectification(Ball1(N[0, 0], N(1)))))
@test isconvextype(typeof(RI1))
@test isconvextype(typeof(Rectification(EmptySet{N}(2))))
@test isconvextype(typeof(Rectification(Universe{N}(2))))

# conversion
@test convert(Interval, RI1) == Interval(N(0), N(1))
@test convert(Hyperrectangle, RB1) ==
Expand Down

0 comments on commit 7edd581

Please sign in to comment.