Opened 17 months ago
Last modified 16 months ago
#32013 closed enhancement
Initialize a Set from a ConvexSet_base instance — at Version 2
Reported by: | Matthias Köppe | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.4 |
Component: | geometry | Keywords: | |
Cc: | gh-kliem, Travis Scrimshaw | Merged in: | |
Authors: | Matthias Koeppe | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | u/mkoeppe/initialize_a_set_from_a_convexset_base_instance (Commits, GitHub, GitLab) | Commit: | e1443896851ac805a89e8747e8c7412bbc7d9d10 |
Dependencies: | #31990 | Stopgaps: |
Description (last modified by )
A Polyhedron
is not a Parent
, so Set
refuses to construct the set of its elements.
We change this by creating a new abstract base class for non-necessarily-parent sets with methods union
, intersection
, etc.
ConvexSet_base
(from #31919) now inherits from Set_base
.
So we can now do the following things:
sage: Set(polytopes.cube()) Set of elements of A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices sage: polytopes.cube().union(polytopes.tetrahedron()) Set-theoretic union of Set of elements of A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices and Set of elements of A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 4 vertices
Change History (2)
comment:1 Changed 17 months ago by
Branch: | → u/mkoeppe/initialize_a_set_from_a_convexset_base_instance |
---|
comment:2 Changed 17 months ago by
Authors: | → Matthias Koeppe |
---|---|
Cc: | gh-kliem Travis Scrimshaw added |
Commit: | → e1443896851ac805a89e8747e8c7412bbc7d9d10 |
Dependencies: | → #31990 |
Description: | modified (diff) |
Status: | new → needs_review |
Note: See
TracTickets for help on using
tickets.
Last 10 new commits:
src/sage/geometry/polyhedron/face.py: Remove unused import
Merge #31959
Merge #31990
src/sage/sets/set.py: Split out mix-in classes Set_base, Set_boolean_operators, Set_add_sub_operators from Set_object; pycodestyle fixes
Polyhedron_base.*contains: Return False for non-iterables - do not raise an exception
ConvexSet_base.is_finite, cardinality: New
Set_object._an_element_: Handle non-iterable objects by delegating to __object.an_element
Set: Create a wrapper instance also for Elements that subclass Set_base
Set_base.union, intersection, difference, symmetric_difference: Convert to Set if necessary
ConvexSet_base.intersection: Remove abstract method; now inherits Set_base.intersection