-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #649 from JuliaReach/schillic/639
#639 - Compact sets
- Loading branch information
Showing
5 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export CompactSet, | ||
NonCompactSet | ||
|
||
""" | ||
CompactSet | ||
An alias for compact set types. | ||
### Notes | ||
Most lazy operations are not captured by this alias because whether their result | ||
is compact or not depends on the argument(s). | ||
""" | ||
const CompactSet = Union{ | ||
AbstractCentrallySymmetric, | ||
AbstractPolytope, | ||
EmptySet | ||
} | ||
|
||
""" | ||
NonCompactSet | ||
An alias for non-compact set types. | ||
### Notes | ||
Most lazy operations are not captured by this alias because whether their result | ||
is non-compact or not depends on the argument(s). | ||
""" | ||
const NonCompactSet = Union{ | ||
HalfSpace, | ||
Hyperplane, | ||
Line | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
for N in [Float64, Rational{Int}, Float32] | ||
# compact set | ||
@test Ball1 <: CompactSet && !(Ball1 <: NonCompactSet) | ||
b = Ball1(N[0, 1], N(1)) | ||
@test b isa CompactSet && !(b isa NonCompactSet) | ||
|
||
# non-compact set | ||
@test Line <: NonCompactSet && !(Line <: CompactSet) | ||
l = Line(N[0, 1], N(1)) | ||
@test l isa NonCompactSet && !(l isa CompactSet) | ||
|
||
# lazy operations are neither compact nor non-compact by default | ||
@test !(MinkowskiSum <: CompactSet) && !(MinkowskiSum <: NonCompactSet) | ||
ms = b + l | ||
@test !(ms isa CompactSet) && !(ms isa NonCompactSet) | ||
end |