#11802: Generation of Lucas sequences modulo an integer
-------------------------------------+-------------------------------------
       Reporter:  somindu            |        Owner:  AlexGhitza
           Type:  enhancement        |       Status:  needs_work
       Priority:  minor              |    Milestone:  sage-6.1
      Component:  basic arithmetic   |   Resolution:
       Keywords:  Lucas sequence     |    Merged in:
  ecc2011                            |    Reviewers:
        Authors:  Somindu Chaya      |  Work issues:
  Ramanna, Shashank Singh, Srinivas  |       Commit:
  Vivek Venkatesh                    |  632255798b7721896673d9d75e96a280ef4d59cc
Report Upstream:  N/A                |     Stopgaps:
         Branch:                     |
  public/arith/lucas_seqences-11802  |
   Dependencies:                     |
-------------------------------------+-------------------------------------
Changes (by tscrim):

 * commit:   => 632255798b7721896673d9d75e96a280ef4d59cc
 * branch:   => public/arith/lucas_seqences-11802


Comment:

 Here's a branch version of this (no rebasing was required) and I fixed up
 some docstring formatting and deprecated `slow_lucas()` (see below).

 Currently `slow_lucas` uses the recursive definition which works for
 arbitrary integers, whereas the fast `Q=1` and general both only work in
 modular arithmetic? Although from the code, there doesn't seem to be
 anything that explicitly uses `n`, so I would (naively) think that this
 could work for general integers. I vote to keep the specialized `Q=1`
 implementation since it is faster.

 I've deprecated `slow_lucas` since the more general
 `BinaryRecurrenceSequence` is faster:
 {{{
 sage: from sage.rings.finite_rings.integer_mod import slow_lucas
 sage: %timeit L = [slow_lucas(k,1,-1) for k in range(20)]
 10 loops, best of 3: 16.4 ms per loop
 sage: %timeit L = [slow_lucas(k,1,-1) for k in range(20)]
 10 loops, best of 3: 16 ms per loop

 sage: %timeit B = BinaryRecurrenceSequence(1, 1, 2, 1)
 100000 loops, best of 3: 4.67 us per loop
 sage: B = BinaryRecurrenceSequence(1, 1, 2, 1)
 sage: %timeit LB = [B(k) for k in range(20)]
 1 loops, best of 3: 15.1 ms per loop
 sage: %timeit LB = [B(k) for k in range(20)] # There's caching going on
 100 loops, best of 3: 7.7 ms per loop
 }}}

 Best,[[BR]]
 Travis
 ----
 New commits:
 
||[[http://git.sagemath.org/sage.git/commit/?id=6322557|6322557]]||{{{Deprecated
 slow_lucas().}}}||
 ||[[http://git.sagemath.org/sage.git/commit/?id=b9f0603|b9f0603]]||{{{Some
 review tweaks.}}}||
 ||[[http://git.sagemath.org/sage.git/commit/?id=d8c854c|d8c854c]]||{{{Ticket
 #11802 (Generating Lucas sequences modulo an integer)}}}||

--
Ticket URL: <http://trac.sagemath.org/ticket/11802#comment:10>
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/groups/opt_out.

Reply via email to