[SciPy-dev] Generic polynomials class (was Re: Volunteer for Scipy Project)

Charles R Harris charlesr.harris at gmail.com
Thu Oct 8 12:45:20 EDT 2009


On Thu, Oct 8, 2009 at 10:29 AM, Charles R Harris <charlesr.harris at gmail.com
> wrote:

> Hi Anne,
>
> On Thu, Oct 8, 2009 at 9:37 AM, Anne Archibald <peridot.faceted at gmail.com>wrote:
>
>> 2009/10/7 David Goldsmith <d.l.goldsmith at gmail.com>:
>> > Thanks for doing that, Anne!
>>
>> There is now a rough prototype on github:
>> http://github.com/aarchiba/scikits.polynomial
>> It certainly needs more tests and features, but it does support both
>> the power basis and the Lagrange basis (polynomials represented by
>> values at Chebyshev points).
>>
>>
> Just took a quick look, which is probably all I'll get to for a few days as
> I'm going out of town tomorrow. Anyway, the Chebyshev points there are type
> II, which should probably be distinguished from type I (and III & IV). I
> also had the impression that the base class could have a few more functions
> and NotImplemented bits. The Polynomial class is implemented as a wrapper,
> it might even make sense to use multiple inheritance (horrors) to get
> specific polynomial types, but anyway it caught my attention and that part
> of the design might be worth spending some time thinking about. It also
> might be worth distinguishing series as a separate base because series do
> admit the division operators //, %, and divmod. Scalar
> multiplication/division (__truedivision__) should also be built in. I've
> also been using "from __future__ import division" up at the top to be py3k
> ready. For a series basis I was thinking of using what I've got for
> Chebyshev but with a bunch of the __foo__  functions raising the
> NotImplementedError. I've also got a single function for importing the
> coefficient arrays and doing the type conversions/checking. It's worth doing
> that one way for all the implementations as it makes it easier to fix/extend
> things.
>
> I've attached the low->high version of the chebyshev.py file just for
> further reference. The Chebyshev class is at the end.
>
>
Oh, and one other thing. I'm thinking that there should be *no* true inplace
functions. That is, every operation returns a new object. That way the
various classes look like basic, immutable, types which makes life simpler
and less error prone. No views with side effects to worry about, and the
coefficient arrays are likely to be small enough that the overhead to make
copies will be small.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20091008/81de0afe/attachment.html>


More information about the SciPy-Dev mailing list