#15673: major improvements to lazy power series
-------------------------------------+-------------------------------------
       Reporter:  mhansen            |        Owner:
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.4
      Component:  combinatorics      |   Resolution:
       Keywords:  LazyPowerSeries,,  |    Merged in:
  days57                             |    Reviewers:  Ralf Stephan,
        Authors:  Mike Hansen        |  Matthieu Dien
Report Upstream:  N/A                |  Work issues:
         Branch:  u/mantepse/15673   |       Commit:
   Dependencies:                     |  aa8fd83522eaeb583da0caa5c6628ddd1ed36b04
                                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 Well done for the rebase!

 Some personal feelings about the code

 1. There are public method that should not be there. For example
 `Stream.compute`. The documentation mentions `Do not use this method`. In
 such case, the method should be private, i.e. starting with an underscore
 like `_compute`. Might apply as well to `SeriesStream.refine_order`,
 `SeriesStream.compute_order`, `RecursiveStream.not_defined_check`, ...

 2. The `check_constant_decorator` is really ugly. I would implement it
 directly in the `__getitem__`.

 3. You should seriously consider replacing `new_stream.py` with
 `lazy_list.pyx` which is currently about 5x faster for `__getitem__` and
 provide more or less the same functionality
   {{{
   sage: from sage.combinat.species.new_stream import StreamFromFunction
   sage: h = lambda l: 1 if len(l) < 2 else l[-1] + l[-2]
   sage: s = StreamFromFunction(h)
   sage: from sage.misc.lazy_list import lazy_list
   sage: def h2(l): l.append(l[-1]+l[-2])
   sage: s2 = lazy_list(initial_values=[1,1],update_function=h2)
   }}}
   Then
   {{{
   sage: %timeit s[0]
   1000000 loops, best of 3: 942 ns per loop
   sage: %timeit s2[0]
   10000000 loops, best of 3: 148 ns per loop
   }}}
   Though there are missing features. For example, current `lazy_list` do
 not care about being periodic or constant after a certain point. But I
 would be happy to implement needed stuff from this side.

   This series code would be a good test case to see whether `lazy_list`
 are as flexible as they claim to be.

 4. In many situations it would be much faster to use Newton's method
 rather than an intricated tree of streams.

--
Ticket URL: <http://trac.sagemath.org/ticket/15673#comment:45>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to