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

Charles R Harris charlesr.harris@gmail....
Tue Oct 6 20:38:16 CDT 2009


On Tue, Oct 6, 2009 at 7:25 PM, Charles R Harris
<charlesr.harris@gmail.com>wrote:

>
>
> On Tue, Oct 6, 2009 at 6:57 PM, Fernando Perez <fperez.net@gmail.com>wrote:
>
>> 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),
>
>
> That wouldn't make it much faster for large arrays of data points, the code
> is just multiply and add applied repeatedly to whole arrays. Well, OK, maybe
> the ndarray multiply and add overhead might slow things down.
>
>

Well, good cache/register usage could make a *big* difference. But that
would require getting down to the c level.  Hmm, that could be left as an
implementation optimization to be done later while keeping the same
interface. Cython would probably do that job quite nicely, although object
type arrays wouldn't benefit  much from that.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20091006/7e3ae1a3/attachment.html 


More information about the Scipy-dev mailing list