#17016: Implement naive algorithm for factor_set method of a finite word
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  slabbe                 |       Status:  needs_review
           Type:         |    Milestone:  sage-6.4
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:
  combinatorics          |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  7ed2922be57b5e27c8e5508963c182b80e4fe3e5
Report Upstream:  N/A    |     Stopgaps:
         Branch:         |
  u/slabbe/17016         |
   Dependencies:         |
-------------------------+-------------------------------------------------
Changes (by slabbe):

 * status:  new => needs_review
 * cc: vdelecroix (added)
 * component:  PLEASE CHANGE => combinatorics
 * branch:   => u/slabbe/17016
 * commit:   => 7ed2922be57b5e27c8e5508963c182b80e4fe3e5
 * type:  PLEASE CHANGE => enhancement


Old description:



New description:

 Because it allows to compare the suffix tree implementation with the naive
 approach which simply uses a sliding window. Also because sometimes the
 naive approach is faster:

 Sometime a naive algorithm is faster::

 {{{
     sage: w = Word([randint(0,2) for _ in range(10000)], alphabet=[0,1,2])
     sage: %time L = [w.number_of_factors(i, algorithm='naive') for i in
 range(20)]
     CPU times: user 356 ms, sys: 34.9 ms, total: 391 ms
     Wall time: 389 ms
     sage: %time O = [w.number_of_factors(i, algorithm='suffix tree') for i
 in range(20)]
     CPU times: user 676 ms, sys: 25.7 ms, total: 701 ms
     Wall time: 694 ms
 }}}

 Sometimes the suffix tree is faster (for longer word)::

 {{{
     sage: w = Word([randint(0,2) for _ in range(100000)],
 alphabet=[0,1,2])
     sage: %time L = [w.number_of_factors(i, algorithm='naive') for i in
 range(20)]
     CPU times: user 6.9 s, sys: 294 ms, total: 7.2 s
     Wall time: 7.17 s
     sage: %time O = [w.number_of_factors(i, algorithm='suffix tree') for i
 in range(20)]
     CPU times: user 6.34 s, sys: 131 ms, total: 6.47 s
     Wall time: 6.52 s
     sage: %time O = [w.number_of_factors(i, algorithm='suffix tree') for i
 in range(20)]
     CPU times: user 3.64 s, sys: 28.3 ms, total: 3.67 s
     Wall time: 3.76 s
     sage: %time L = [w.number_of_factors(i, algorithm='naive') for i in
 range(20)]
     CPU times: user 6.64 s, sys: 302 ms, total: 6.94 s
     Wall time: 6.93 s
 }}}

--

Comment:

 New commits:
 
||[http://git.sagemath.org/sage.git/commit/?id=7ed2922be57b5e27c8e5508963c182b80e4fe3e5
 7ed2922]||{{{Implement naive algorithm for factor_set method}}}||

--
Ticket URL: <http://trac.sagemath.org/ticket/17016#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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to