#13668: MemoryError raised by WordMorphism.fixed_points method
---------------------------------+------------------------------------------
       Reporter:  slabbe         |         Owner:  slabbe  
           Type:  defect         |        Status:  new     
       Priority:  major          |     Milestone:  sage-5.5
      Component:  combinatorics  |    Resolution:          
       Keywords:                 |   Work issues:          
Report Upstream:  N/A            |     Reviewers:          
        Authors:                 |     Merged in:          
   Dependencies:                 |      Stopgaps:          
---------------------------------+------------------------------------------

Old description:

> The following bug was reported to me by Timo Jolivet last July 2012. It
> is still there is sage-5.3:
>
> {{{
> 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: (s^7).fixed_points()
> [word: 122..., word: 2,3,4,...]
> sage: (s^7).reversal().fixed_points()
> MemoryError [...]
> }}}

New description:

 The following bug was reported to me by Timo Jolivet last July 2012. It is
 still there is sage-5.3:

 {{{
 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: (s^7).fixed_points()
 [word: 122..., word: 2,3,4,...]
 sage: (s^7).reversal().fixed_points()
 MemoryError [...]
 }}}

 Also reported by Timo Jolivet in October 2012 the following hangs forever:

 {{{
 sage: s =
 
WordMorphism("1->321331332133133,2->133321331332133133,3->2133133133321331332133133")
 sage: (s^2).fixed_points()
 }}}

--

Comment (by slabbe):

 In fact, this bugs comes from the `_fixed_point_iterator` method which
 expand a possibly long word as a list :

 {{{
 #!python
 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:
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13668#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to