Opened 7 months ago
Last modified 6 months ago
#32013 closed enhancement
Initialize a Set from a ConvexSet_base instance — at Version 10
Reported by:  mkoeppe  Owned by:  

Priority:  major  Milestone:  sage9.4 
Component:  geometry  Keywords:  
Cc:  ghkliem, tscrim  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:  08c52c2535aeb4c2eadc43e22979df076a6d0760 
Dependencies:  #31990, #31877  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 nonnecessarilyparent sets with methods union
, intersection
, etc.
ConvexSet_base
(from #31919) and RealSet
now both inherit from Set_base
. To complete the implementation of the Set_base
protocol, we add an implementation of RealSet.symmetric_difference
.
So we can now do the following things:
sage: Set(polytopes.cube()) Set of elements of A 3dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices sage: polytopes.cube().union(polytopes.tetrahedron()) Settheoretic union of Set of elements of A 3dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices and Set of elements of A 3dimensional polyhedron in ZZ^3 defined as the convex hull of 4 vertices
Change History (10)
comment:1 Changed 7 months ago by
 Branch set to u/mkoeppe/initialize_a_set_from_a_convexset_base_instance
comment:2 Changed 7 months ago by
 Cc ghkliem tscrim added
 Commit set to e1443896851ac805a89e8747e8c7412bbc7d9d10
 Dependencies set to #31990
 Description modified (diff)
 Status changed from new to needs_review
comment:3 Changed 7 months ago by
 Commit changed from e1443896851ac805a89e8747e8c7412bbc7d9d10 to bc26d4f1dfef8d64ffb60db717a2db7a155771d6
Branch pushed to git repo; I updated commit sha1. New commits:
bc26d4f  {LatticePolytopeClass, ConvexRationalPolyhedralCone._some_elements_: New

comment:4 Changed 7 months ago by
 Dependencies changed from #31990 to #31990, #32025
comment:5 Changed 7 months ago by
 Dependencies changed from #31990, #32025 to #31990, #31877, #32025
comment:6 Changed 7 months ago by
 Commit changed from bc26d4f1dfef8d64ffb60db717a2db7a155771d6 to afad76f41652e85f9c1ed34504ca9e4b08e355f5
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
5b8ceca  InternalRealInterval, RealSet: Add _latex_ methods

69ca854  RealSet._repr_: Use unicode cup sign instead of +

dbdfc06  InternalRealInterval, RealSet: Remove extra whitespace in latex, add documentation

7f56338  PiecewiseFunction: Adjust doctests for changed RealSet repr

8abdc8b  src/sage/functions/piecewise.py: Add coding header

5b0f85d  Merge #31880

e768463  Merge #31877

cb93c99  RealSet: Inherit from Set_base, Set_boolean_operators, Set_add_sub_operators

3a6f9bd  RealSet.symmetric_difference: New

afad76f  sage.sets.set.Set_object: Add _sympy_ methods to subclasses

comment:7 Changed 7 months ago by
 Commit changed from afad76f41652e85f9c1ed34504ca9e4b08e355f5 to 34d920be955ff91868e0c144444af8fc819493fa
Branch pushed to git repo; I updated commit sha1. New commits:
34d920b  Set_base._test_as_set_object: Skip _test_pickling

comment:8 Changed 7 months ago by
 Dependencies changed from #31990, #31877, #32025 to #31990, #31877
comment:9 Changed 7 months ago by
 Commit changed from 34d920be955ff91868e0c144444af8fc819493fa to 08c52c2535aeb4c2eadc43e22979df076a6d0760
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
08c52c2  Set_base._test_as_set_object: Skip _test_pickling

comment:10 Changed 7 months ago by
 Description modified (diff)
Last 10 new commits:
src/sage/geometry/polyhedron/face.py: Remove unused import
Merge #31959
Merge #31990
src/sage/sets/set.py: Split out mixin classes Set_base, Set_boolean_operators, Set_add_sub_operators from Set_object; pycodestyle fixes
Polyhedron_base.*contains: Return False for noniterables  do not raise an exception
ConvexSet_base.is_finite, cardinality: New
Set_object._an_element_: Handle noniterable 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