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

Fernando Perez fperez.net@gmail....
Tue Oct 6 19:57:10 CDT 2009


On Tue, Oct 6, 2009 at 5:46 PM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
>
>
> On Tue, Oct 6, 2009 at 6:32 PM, Fernando Perez <fperez.net@gmail.com> wrote:

>> - the correct choice of coefficient order
>
> OK, I'm changing that now.

Thank you!

>> - that is stable and fast both for point-wise and for array-wise
>> evaluations
>>
>
> Just to be clear, you mean 1 polynomial in 1 variable evaluated at many
> points ? The current code evaluates at an arbitrary ndarray of points, but
> is a bit wasteful of memory: there are essentially three active copies of
> the data points at any one time.

I had a peculiar need: I needed to evaluate a family of all Legendre
polynomials of order up to n-1, at an array with n points.  This was
fairly performance-critical, so I rolled my own code, though I could
have done the loop over polynomial index.  But ideally, we'd have the
evaluation code (fast, stable) for whole arrays accessible in
C(ython), so that a funky use case like mine could be implemented both
easily and efficiently with a Cython loop that would do pure C calls
without jumping up into the python layer.

Dreaming here :)


>> would be great, as I wouldn't (for example) have had to roll my own.
>> Others with more extensive needs and experience on this, like Anne,
>> can pitch in with more informed ideas for the API than I can come up
>> with right now.
>>
>
> Do you ever use the indexing in poly1d? I'm thinking of dropping that. After
> all, the coefficient array is available if one wants to cheat.

I didn't, but this is a sample of 1, so take it for what it's worth :)

Cheers,

f


More information about the Scipy-dev mailing list