diff options
| author | Charles Harris <charlesr.harris@gmail.com> | 2014-03-21 14:53:18 -0600 |
|---|---|---|
| committer | Charles Harris <charlesr.harris@gmail.com> | 2014-03-26 20:41:48 -0600 |
| commit | 1eb81b7beaf571bdd534cfeec046b79b1d188714 (patch) | |
| tree | d080fbd576b089e25619dce768b84ba3aeaf7db4 /numpy/polynomial/legendre.py | |
| parent | 46767a2ffc6bf7b3c6841bd9b10f1f26543d22b7 (diff) | |
| download | numpy-1eb81b7beaf571bdd534cfeec046b79b1d188714.tar.gz | |
ENH, MAINT: Use an abstract base class for the polynomial classes.
The new base is ABCPolyBase and is intended to replace the use of the
polytemplate string. In this way the need to compile the polynomial
classes on import is avoided.
Closes #634. Closes #3639.
Diffstat (limited to 'numpy/polynomial/legendre.py')
| -rw-r--r-- | numpy/polynomial/legendre.py | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py index 8d89c8412..7d9bbfba5 100644 --- a/numpy/polynomial/legendre.py +++ b/numpy/polynomial/legendre.py @@ -83,11 +83,12 @@ numpy.polynomial.hermite_e """ from __future__ import division, absolute_import, print_function +import warnings import numpy as np import numpy.linalg as la + from . import polyutils as pu -import warnings -from .polytemplate import polytemplate +from ._polybase import ABCPolyBase __all__ = ['legzero', 'legone', 'legx', 'legdomain', 'legline', 'legadd', 'legsub', 'legmulx', 'legmul', 'legdiv', 'legpow', 'legval', @@ -1765,4 +1766,22 @@ def legweight(x): # Legendre series class # -exec(polytemplate.substitute(name='Legendre', nick='leg', domain='[-1,1]')) +class Legendre(ABCPolyBase): + # Virtual Functions + _add = staticmethod(legadd) + _sub = staticmethod(legsub) + _mul = staticmethod(legmul) + _div = staticmethod(legdiv) + _pow = staticmethod(legpow) + _val = staticmethod(legval) + _int = staticmethod(legint) + _der = staticmethod(legder) + _fit = staticmethod(legfit) + _line = staticmethod(legline) + _roots = staticmethod(legroots) + _fromroots = staticmethod(legfromroots) + + # Virtual properties + nickname = 'leg' + domain = np.array(legdomain) + window = np.array(legdomain) |
