summaryrefslogtreecommitdiff
path: root/numpy/polynomial/laguerre.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-03-28 13:03:40 -0600
committerCharles Harris <charlesr.harris@gmail.com>2014-03-28 13:03:40 -0600
commit2baee6da0913f26d44bb7ada6976d3d076d23aab (patch)
tree486a9c9e72b11079d0d056eb48ff787988d35fa4 /numpy/polynomial/laguerre.py
parentab0642c9780a0c19c701facbc8ea85a278e4324d (diff)
parentef951bd3ab00fff4ffcfcf8707a9509cb3796b4b (diff)
downloadnumpy-2baee6da0913f26d44bb7ada6976d3d076d23aab.tar.gz
Merge pull request #4531 from charris/polynomial-abstract-base
Use polynomial abstract base instead of template.
Diffstat (limited to 'numpy/polynomial/laguerre.py')
-rw-r--r--numpy/polynomial/laguerre.py59
1 files changed, 52 insertions, 7 deletions
diff --git a/numpy/polynomial/laguerre.py b/numpy/polynomial/laguerre.py
index b7ffe9b0c..bf44dc5f4 100644
--- a/numpy/polynomial/laguerre.py
+++ b/numpy/polynomial/laguerre.py
@@ -59,11 +59,12 @@ See also
"""
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__ = ['lagzero', 'lagone', 'lagx', 'lagdomain', 'lagline',
'lagadd', 'lagsub', 'lagmulx', 'lagmul', 'lagdiv', 'lagpow',
@@ -1415,10 +1416,15 @@ def lagfit(x, y, deg, rcond=None, full=False, w=None):
the coefficients for the data in column k of `y` are in column
`k`.
- [residuals, rank, singular_values, rcond] : present when `full` = True
- Residuals of the least-squares fit, the effective rank of the
- scaled Vandermonde matrix and its singular values, and the
- specified value of `rcond`. For more details, see `linalg.lstsq`.
+ [residuals, rank, singular_values, rcond] : list
+ These values are only returned if `full` = True
+
+ resid -- sum of squared residuals of the least squares fit
+ rank -- the numerical rank of the scaled Vandermonde matrix
+ sv -- singular values of the scaled Vandermonde matrix
+ rcond -- value of `rcond`.
+
+ For more details, see `linalg.lstsq`.
Warns
-----
@@ -1739,4 +1745,43 @@ def lagweight(x):
# Laguerre series class
#
-exec(polytemplate.substitute(name='Laguerre', nick='lag', domain='[-1,1]'))
+class Laguerre(ABCPolyBase):
+ """A Laguerre series class.
+
+ The Laguerre class provides the standard Python numerical methods
+ '+', '-', '*', '//', '%', 'divmod', '**', and '()' as well as the
+ attributes and methods listed in the `ABCPolyBase` documentation.
+
+ Parameters
+ ----------
+ coef : array_like
+ Laguerre coefficients in order of increasing degree, i.e,
+ ``(1, 2, 3)`` gives ``1*L_0(x) + 2*L_1(X) + 3*L_2(x)``.
+ domain : (2,) array_like, optional
+ Domain to use. The interval ``[domain[0], domain[1]]`` is mapped
+ to the interval ``[window[0], window[1]]`` by shifting and scaling.
+ The default value is [0, 1].
+ window : (2,) array_like, optional
+ Window, see `domain` for its use. The default value is [0, 1].
+
+ .. versionadded:: 1.6.0
+
+ """
+ # Virtual Functions
+ _add = staticmethod(lagadd)
+ _sub = staticmethod(lagsub)
+ _mul = staticmethod(lagmul)
+ _div = staticmethod(lagdiv)
+ _pow = staticmethod(lagpow)
+ _val = staticmethod(lagval)
+ _int = staticmethod(lagint)
+ _der = staticmethod(lagder)
+ _fit = staticmethod(lagfit)
+ _line = staticmethod(lagline)
+ _roots = staticmethod(lagroots)
+ _fromroots = staticmethod(lagfromroots)
+
+ # Virtual properties
+ nickname = 'lag'
+ domain = np.array(lagdomain)
+ window = np.array(lagdomain)