#8490: Bad behavior of is_square_free for Words
---------------------------------+------------------------------------------
   Reporter:  vdelecroix         |       Owner:  vdelecroix
       Type:  defect             |      Status:  needs_work
   Priority:  major              |   Milestone:  sage-4.4.1
  Component:  combinatorics      |    Keywords:  word      
     Author:  Vincent Delecroix  |    Upstream:  N/A       
   Reviewer:  Mike Hansen        |      Merged:            
Work_issues:                     |  
---------------------------------+------------------------------------------

Comment(by slabbe):

 The same bug was occuring with {{{is_cube_free}}} :

 {{{
 sage: Word('111').is_cube_free()
 True
 sage: Word('2111').is_cube_free()
 True
 sage: Word('32111').is_cube_free()
 True
 }}}

 I just applied a patch which fixes this problem. I changed some doctests
 of both {{{is_square_free}}} and {{{is_cube_free}}}. I also removed a
 useless slice in the code of both functions and this gives good
 improvements in timings :

 BEFORE:

 {{{
 sage: t = words.ThueMorseWord()
 sage: %timeit t[:100].is_cube_free()
 5 loops, best of 3: 3.13 s per loop
 }}}

 AFTER:

 {{{
 sage: t = words.ThueMorseWord()
 sage: %timeit t[:100].is_cube_free()
 5 loops, best of 3: 1.18 s per loop
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8490#comment:5>
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