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

Use cantor_product for Cartesian products of infinite enumerated sets #34374

Closed
mkoeppe opened this issue Aug 16, 2022 · 9 comments
Closed

Use cantor_product for Cartesian products of infinite enumerated sets #34374

mkoeppe opened this issue Aug 16, 2022 · 9 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 16, 2022

(split out from #19195)

CC: @tscrim @yyyyx4 @videlec @jhpalmieri

Component: combinatorics

Author: Matthias Koeppe

Branch/Commit: a20341e

Reviewer: Travis Scrimshaw

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

@mkoeppe mkoeppe added this to the sage-9.7 milestone Aug 16, 2022
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2022

Author: Matthias Koeppe

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2022

New commits:

2edbdbaSets.CartesianProducts.ParentMethods.__iter__: Use cantor_product if factors other than first are infinite
8890f1esrc/sage/categories/sets_cat.py: Update documentation - cantor_product refines with revlex
a20341esrc/sage/categories/sets_cat.py: Rephrase cartesian product docstring

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2022

Commit: a20341e

@jhpalmieri
Copy link
Member

comment:3

The behavior of for x in iter(cartesian_product([RR, RR])): print(x) has changed with this ticket, I think in an improvement. Old version:

sage: for x in iter(cartesian_product([RR, RR])): print(x)
/Users/jpalmier/Desktop/Sage/git/sage/src/sage/categories/sets_cat.py:2300: UserWarning: Sage is not able to determine whether the factors of this Cartesian product are finite. The lexicographic ordering might not go through all elements.
  warn("Sage is not able to determine whether the factors of "
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 for x in iter(cartesian_product([RR, RR])): print(x)
...
NotImplementedError: object does not support iteration

New version:

sage: for x in iter(cartesian_product([RR, RR])): print(x)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 for x in iter(cartesian_product([RR, RR])): print(x)
...
NotImplementedError: object does not support iteration

@tscrim
Copy link
Collaborator

tscrim commented Aug 17, 2022

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Aug 17, 2022

comment:4

LGTM.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 17, 2022

comment:5

Thanks!

@vbraun
Copy link
Member

vbraun commented Aug 30, 2022

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