Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize a Set from a ConvexSet_base instance #32013

Closed
mkoeppe opened this issue Jun 20, 2021 · 45 comments
Closed

Initialize a Set from a ConvexSet_base instance #32013

mkoeppe opened this issue Jun 20, 2021 · 45 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 20, 2021

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

Depends on #30473

CC: @kliem @tscrim

Component: geometry

Author: Matthias Koeppe

Branch/Commit: fff2a79

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/32013

@mkoeppe mkoeppe added this to the sage-9.4 milestone Jun 20, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 20, 2021

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 20, 2021

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

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 20, 2021

Commit: e144389

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 20, 2021

Author: Matthias Koeppe

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 20, 2021

Dependencies: #31990

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 21, 2021

Changed commit from e144389 to bc26d4f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 21, 2021

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

bc26d4f{LatticePolytopeClass, ConvexRationalPolyhedralCone._some_elements_: New

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 21, 2021

Changed dependencies from #31990 to #31990, #32025

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 21, 2021

Changed dependencies from #31990, #32025 to #31990, #31877, #32025

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 21, 2021

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

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 21, 2021

Changed commit from bc26d4f to afad76f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 21, 2021

Changed commit from afad76f to 34d920b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 21, 2021

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

34d920bSet_base._test_as_set_object: Skip _test_pickling

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 21, 2021

Changed dependencies from #31990, #31877, #32025 to #31990, #31877

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 21, 2021

Changed commit from 34d920b to 08c52c2

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 21, 2021

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

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 1, 2021

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

200b1efMerge tag '9.4.beta4' into t/32013/initialize_a_set_from_a_convexset_base_instance

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 1, 2021

Changed commit from 08c52c2 to 200b1ef

@tscrim
Copy link
Collaborator

tscrim commented Jul 2, 2021

comment:12

LGTM.

@tscrim
Copy link
Collaborator

tscrim commented Jul 2, 2021

Reviewer: Travis Scrimshaw

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 2, 2021

comment:13

Thanks!

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 7, 2021

comment:20

Thanks!

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 7, 2021

Changed commit from 63c2cfe to 55240bb

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 7, 2021

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. Last 10 new commits:

da8893fUse sage.typeset.unicode_characters in TensorProductFunctor and SignedTensorProductFunctor
2a23cb5Unicode symbol 2202 (partial) for the text display of coordinate frames
5d096f1f-string for unicode_symbol in TensorProductFunctor and SignedTensorProductFunctor
76c2fd5Use Unicode symbol for the Riemann sphere example
5167e6cUse Unicode symbol for default text display of RealLine
332410bUse unicode_otimes in TensorProductFunctor and SignedTensorProductFunctor
f5d15d2Merge branch 'public/manifolds/unicode_art' of git://trac.sagemath.org/sage into Sage 9.4.beta4.
d87d09b#30473: fix doctest error in DiffMap.pullback
f2ae50e#30473: fix doctests outside sage/manifolds and sage/tensor/modules
55240bbMerge #30473

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 7, 2021

Dependencies: #30473

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 7, 2021

comment:22

Merged #30473 to resolve a merge conflict

@vbraun
Copy link
Member

vbraun commented Jul 11, 2021

comment:23

PDF docs fail

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 11, 2021

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

fff2a79src/sage/sets/set.py: Fix docstring markup

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 11, 2021

Changed commit from 55240bb to fff2a79

@mjungmath
Copy link

comment:26
-        EXAMPLE::
+        EXAMPLES::

See https://wiki.sagemath.org/plugins#blocks.

@tscrim
Copy link
Collaborator

tscrim commented Jul 13, 2021

comment:27

While that is against our general practice, it is not sufficient to revert a positive review IMO. However, if Matthias wants to update it, he can go ahead and do it (and immediately reset a positive review).

@mjungmath
Copy link

comment:28
-        Returns the symmetric difference of ``self`` and ``X``.
+        Return the symmetric difference of ``self`` and ``X``.

etc.

See https://wiki.sagemath.org/plugins#blocks.

@tscrim
Copy link
Collaborator

tscrim commented Jul 13, 2021

comment:29

See other tickets.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 13, 2021

comment:30

Replying to @tscrim:

While that is against our general practice, it is not sufficient to revert a positive review IMO.

... in particular since this is not new code. It's not the job of a ticket to fix everything that's wrong in a given file.

@mjungmath
Copy link

comment:32

I have opened a ticket devoted to those deviations of convention: #32192.

@vbraun
Copy link
Member

vbraun commented Jul 23, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants