This repository was archived by the owner on Feb 1, 2023. It is now read-only.
Commit bc4b0ec
Release Manager
Trac #29524: bug with rational input in IntegerVectors
As reported on [[https://ask.sagemath.org/question/50814/error-with-
rational-input-in-integervectors/|ask]], we have the following
unexpected behavior of !IntegerVectors:
{{{
sage: IntegerVectors(2,3).list()
[[2, 0, 0], [1, 1, 0], [1, 0, 1], [0, 2, 0], [0, 1, 1], [0, 0, 2]]
sage: IntegerVectors(2,3/1).list()
[[2, 0, 0], [1, 1, 0]]
}}}
The relevant code block in the implementation of !IntegerVectors seems
to be the following:
{{{
try:
return IntegerVectors_nnondescents(n, tuple(k))
except TypeError:
pass
return IntegerVectors_nk(n, k)
}}}
For k=3/1 one has that tuple(k) does not give a !TypeError (as opposed
to tuple(3)) and thus the code never tries to interpret k as an integer.
{{{
sage: tuple(3/1)
(3,)
sage: tuple(3)
------------------------------------------------------------------------
---
TypeError Traceback (most recent call
last)
<ipython-input-2-35e4067a6e17> in <module>()
----> 1 tuple(Integer(3))
TypeError: 'sage.rings.integer.Integer' object is not iterable
}}}
URL: https://trac.sagemath.org/29524
Reported by: vdelecroix
Ticket author(s): Vincent Delecroix
Reviewer(s): Frédéric Chapoton2 files changed
+15
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
592 | 593 | | |
593 | 594 | | |
594 | 595 | | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
595 | 603 | | |
596 | 604 | | |
597 | 605 | | |
| |||
607 | 615 | | |
608 | 616 | | |
609 | 617 | | |
610 | | - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
611 | 621 | | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
| 622 | + | |
| 623 | + | |
616 | 624 | | |
617 | 625 | | |
618 | 626 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6500 | 6500 | | |
6501 | 6501 | | |
6502 | 6502 | | |
6503 | | - | |
| 6503 | + | |
6504 | 6504 | | |
6505 | | - | |
| 6505 | + | |
6506 | 6506 | | |
6507 | 6507 | | |
6508 | 6508 | | |
| |||
0 commit comments