Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3521)

Issue 140053: [scipy.special] Fast and stabler evaluation of orthogonal polynomials (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 6 months ago by pv
Modified:
13 years, 7 months ago
Reviewers:
Anne
Visibility:
Public.

Description

[scipy.special] Fast and stabler evaluation of orthogonal polynomials Rationale --------- Often, one needs just values of orthogonal polynomials at a couple of points. This calls for vectorized functions -- the routines currently in orthogonal.py compute roots first, which is quite slow. Sometimes high orders are also needed, so the evaluation functions need to be sufficiently stable numerically. Moreover, it would be useful to integrate the evaluation functions to the current interface. This patch ---------- - Adds vectorized eval_* routines for evaluating orthogonal polynomials. They are either written using stable recurrences in Cython, or related to hypergeometric functions. - Hooks these evaluation routines to the orthopoly1d class, so that __call__ uses them. This gains mainly numerical stability. orthopoly1d lose their identity on arithmetic, so after any arithmetic, evaluation is done via the unstable numpy.poly1d route. - Makes *all* orthogonal routines return orthopoly1d's. I believe the normalisation metadata etc. are still handled properly. - There are tests comparing the numpy.poly1d route for low polynomial orders. TODO ---- - I haven't really carefully checked that eg. eval_jacobi is *really* numerically stabler. Quick checks seem to show that it is, but more tests are needed. Notes ----- - Many of the polynomials are related to hyp2f1. I fixed recently several bugs in it that hit hard the parameter ranges useful for orthogonal polynomials, so if you want to try this out, grab a SVN version of Scipy.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+623 lines, -246 lines) Patch
M scipy/special/SConscript View 1 chunk +3 lines, -0 lines 0 comments Download
M scipy/special/__init__.py View 1 chunk +1 line, -3 lines 0 comments Download
M scipy/special/orthogonal.py View 16 chunks +74 lines, -20 lines 0 comments Download
A scipy/special/orthogonal_eval.pyx View 1 chunk +206 lines, -0 lines 0 comments Download
M scipy/special/setup.py View 1 chunk +6 lines, -0 lines 0 comments Download
M scipy/special/tests/test_basic.py View 3 chunks +0 lines, -223 lines 0 comments Download
A scipy/special/tests/test_orthogonal.py View 1 chunk +226 lines, -0 lines 0 comments Download
A scipy/special/tests/test_orthogonal_eval.py View 1 chunk +107 lines, -0 lines 0 comments Download

Messages

Total messages: 1
Anne
14 years, 6 months ago (2009-10-26 01:20:19 UTC) #1
Looks good. I'd say go ahead and add it.

In the long run, I think we need something more comprehensive; as it stands a
user must remember to do a*p(x)+q(x) rather than (a*p+q)(x) or their numerical
stability will mysteriously disappear. 

My favored approach would be to allow any family of orthogonal polynomials to be
used as a basis, since (I think) there is an efficient and stable recurrence to
evaluate linear combinations of orthogonal polynomials. But this is a much
bigger piece of code, and the subject of much debate on the mailing list. This
patch is a big improvement that's ready to go right now.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b