Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'u/vdelecroix/24897' of git://trac.sagemath.org/sage int…
Browse files Browse the repository at this point in the history
…o t/24889/enumerate_all_genera_of_given_signature__determinant_and_bounded_scale_of_a_jordan_block_
  • Loading branch information
Simon Brandhorst committed Mar 5, 2018
2 parents 37adad4 + 876819c commit 9e05a0d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/sage/misc/mrange.py
Expand Up @@ -686,6 +686,18 @@ def cantor_product(*args, **kwds):
sage: list(cantor_product(srange(5), repeat=2, min_slope=1))
[(0, 1), (0, 2), (1, 2), (0, 3), (1, 3),
(0, 4), (2, 3), (1, 4), (2, 4), (3, 4)]
Check that :trac:`24897` is fixed::
sage: from sage.misc.mrange import cantor_product
sage: list(cantor_product([1]))
[(1,)]
sage: list(cantor_product([1], repeat=2))
[(1, 1)]
sage: list(cantor_product([1], [1,2]))
[(1, 1), (1, 2)]
sage: list(cantor_product([1,2], [1]))
[(1, 1), (2, 1)]
"""
from itertools import count
from sage.combinat.integer_lists import IntegerListsLex
Expand Down Expand Up @@ -719,5 +731,5 @@ def cantor_product(*args, **kwds):
for v in IntegerListsLex(n, length=mm, ceiling=ceiling, **kwds):
yield tuple(data[i%m][v[i]] for i in range(mm))

if all(l is not None for l in lengths) and repeat*sum(l-1 for l in lengths) == n:
if all(l is not None for l in lengths) and repeat*sum(l-1 for l in lengths) <= n:
return

0 comments on commit 9e05a0d

Please sign in to comment.