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: sage-9.4
Component: geometry Keywords:
Cc: gh-kliem, 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:

Status badges

Description (last modified by mkoeppe)

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) 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 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 (10)

comment:1 Changed 7 months ago by mkoeppe

  • Branch set to u/mkoeppe/initialize_a_set_from_a_convexset_base_instance

comment:2 Changed 7 months ago by mkoeppe

  • Authors set to Matthias Koeppe
  • Cc gh-kliem tscrim added
  • Commit set to e1443896851ac805a89e8747e8c7412bbc7d9d10
  • Dependencies set to #31990
  • Description modified (diff)
  • Status changed from new to needs_review

Last 10 new commits:

f02ca28src/sage/geometry/polyhedron/face.py: Remove unused import
1744ffaMerge #31959
bd8e702Merge #31990
f351eb8src/sage/sets/set.py: Split out mix-in classes Set_base, Set_boolean_operators, Set_add_sub_operators from Set_object; pycodestyle fixes
f1db666Polyhedron_base.*contains: Return False for non-iterables - do not raise an exception
6237fbcConvexSet_base.is_finite, cardinality: New
18270ceSet_object._an_element_: Handle non-iterable objects by delegating to __object.an_element
b8f5978Set: Create a wrapper instance also for Elements that subclass Set_base
b67092cSet_base.union, intersection, difference, symmetric_difference: Convert to Set if necessary
e144389ConvexSet_base.intersection: Remove abstract method; now inherits Set_base.intersection

comment:3 Changed 7 months ago by git

  • 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 mkoeppe

  • Dependencies changed from #31990 to #31990, #32025

comment:5 Changed 7 months ago by mkoeppe

  • Dependencies changed from #31990, #32025 to #31990, #31877, #32025

comment:6 Changed 7 months ago by git

  • Commit changed from bc26d4f1dfef8d64ffb60db717a2db7a155771d6 to afad76f41652e85f9c1ed34504ca9e4b08e355f5

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

5b8cecaInternalRealInterval, RealSet: Add _latex_ methods
69ca854RealSet._repr_: Use unicode cup sign instead of +
dbdfc06InternalRealInterval, RealSet: Remove extra whitespace in latex, add documentation
7f56338PiecewiseFunction: Adjust doctests for changed RealSet repr
8abdc8bsrc/sage/functions/piecewise.py: Add coding header
5b0f85dMerge #31880
e768463Merge #31877
cb93c99RealSet: Inherit from Set_base, Set_boolean_operators, Set_add_sub_operators
3a6f9bdRealSet.symmetric_difference: New
afad76fsage.sets.set.Set_object: Add _sympy_ methods to subclasses

comment:7 Changed 7 months ago by git

  • Commit changed from afad76f41652e85f9c1ed34504ca9e4b08e355f5 to 34d920be955ff91868e0c144444af8fc819493fa

Branch pushed to git repo; I updated commit sha1. New commits:

34d920bSet_base._test_as_set_object: Skip _test_pickling

comment:8 Changed 7 months ago by mkoeppe

  • Dependencies changed from #31990, #31877, #32025 to #31990, #31877

comment:9 Changed 7 months ago by git

  • Commit changed from 34d920be955ff91868e0c144444af8fc819493fa to 08c52c2535aeb4c2eadc43e22979df076a6d0760

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

08c52c2Set_base._test_as_set_object: Skip _test_pickling

comment:10 Changed 7 months ago by mkoeppe

  • Description modified (diff)
Note: See TracTickets for help on using tickets.