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:

Status badges

Description (last modified by Matthias Köppe)

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 Matthias Köppe

Branch: u/mkoeppe/initialize_a_set_from_a_convexset_base_instance

comment:2 Changed 17 months ago by Matthias Köppe

Authors: Matthias Koeppe
Cc: gh-kliem Travis Scrimshaw added
Commit: e1443896851ac805a89e8747e8c7412bbc7d9d10
Dependencies: #31990
Description: modified (diff)
Status: newneeds_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
Note: See TracTickets for help on using tickets.