#8227: Improving iterated palindromic closure computation
---------------------------+------------------------------------------------
   Reporter:  abmasse      |       Owner:  AlexGhitza                  
       Type:  enhancement  |      Status:  needs_review                
   Priority:  major        |   Milestone:  sage-4.3.3                  
  Component:  algebra      |    Keywords:  iterated palindromic closure
     Author:  abmasse      |    Upstream:  N/A                         
   Reviewer:               |      Merged:                              
Work_issues:               |  
---------------------------+------------------------------------------------
Changes (by abmasse):

  * status:  new => needs_review


Old description:

> There is a faster way to compute the iterated paindromic closure of a
> word than using the definition. The problem with the latter is that it
> needs to compute the longest f-palindromic suffix of the current word at
> each step, while it is possible to easily deduce this length only by
> looking at the directive word.

New description:

 There is a faster way to compute the iterated paindromic closure of a word
 than using the definition. The problem with the latter is that it needs to
 compute the longest f-palindromic suffix of the current word at each step,
 while it is possible to easily deduce this length only by looking at the
 directive word.[[BR]]
 Here is an example:
 {{{
 sage: w = words.RandomWord(10)
 sage: w.iterated_right_palindromic_closure(algorithm='definition')
 word: 0010010001001000100100010010001001001000...
 sage: timeit("print
 w.iterated_right_palindromic_closure(algorithm='definition').length()")
 5 loops, best of 3: 211 ms per loop
 sage: timeit("print
 w.iterated_right_palindromic_closure(algorithm='recursive').length()")
 25 loops, best of 3: 9.46 ms per loop
 }}}
 The difference is particularly notable for longer words:
 {{{
 sage: w = words.RandomWord(15)
 sage: timeit("print
 w.iterated_right_palindromic_closure(algorithm='definition').length()")
 5 loops, best of 3: 3.73 s per loop
 sage: timeit("print
 w.iterated_right_palindromic_closure(algorithm='recursive').length()")
 25 loops, best of 3: 37.4 ms per loop
 }}}

--

Comment:

 I had to implement two other functions: find() and rfind() that were only
 available for Word_str words. It is not the more efficient implementation
 yet, but that was not the goal of this ticket...

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