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
MemoryError raised by WordMorphism.fixed_points method #13668
Comments
comment:1
Also reported by Timo Jolivet in October 2012 the following hangs forever:
It might be related to the bug in the description of this ticket... I will wait until a solution is found for the first before creating a new ticket for the second as the solution might fix both. |
Attachment: trac_13668-sl.patch.gz Tested on sage-5.2 |
comment:2
In fact, this bugs comes from the sage: s = WordMorphism({1:[1,2],2:[2,3],3:[4],4:[5],5:[6],6:[7],7:[8],8:[9],9:[10],10:[1]})
sage: s7 = s^7
sage: s7r = s7.reversal()
sage: M = matrix(s7r)^10
sage: max(flatten(map(list, M)))
274861440
sage: s7r10 = s7r^10
sage: it = s7r10._fixed_point_iterator(1)
sage: it.next()
Traceback (most recent call last):
...
in _fixed_point_iterator(self, letter)
1561 ('a', 1)
1562 """
-> 1563 w = list(self.image(letter))
1564 while True:
1565 for a in self.image(w.pop(0)):
MemoryError: |
This comment has been minimized.
This comment has been minimized.
comment:3
Indeed, the solution (which make use of iterators instead of lists) fixes both problems. I just attached a patch. Needs review! |
comment:4
Moreover, I am getting some timing improvements due to the change of the code of BEFORE:
AFTER:
|
Author: Sébastien Labbé |
Reviewer: Timo Jolivet |
comment:7
I don't have any problematic examples anymore and the patch changes are simple and effective, so positive review. |
comment:8
Note that this patch also fixes the following problem, thanks to better implementation:
|
Merged: sage-5.5.beta2 |
Changed merged from sage-5.5.beta2 to sage-5.5.beta3 |
Changed merged from sage-5.5.beta3 to sage-5.5.rc0 |
The following bug was reported to me by Timo Jolivet last July 2012. It is still there is sage-5.3:
Also reported by Timo Jolivet in October 2012 the following hangs forever:
CC: @sagetrac-tjolivet
Component: combinatorics
Author: Sébastien Labbé
Reviewer: Timo Jolivet
Merged: sage-5.5.rc0
Issue created by migration from https://trac.sagemath.org/ticket/13668
The text was updated successfully, but these errors were encountered: