summaryrefslogtreecommitdiff
path: root/numpy/lib/polynomial.py
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Remove implicit inheritance from object class (#15236)Jon Dufresne2020-01-051-1/+1
| | | | | | | Inheriting from object was necessary for Python 2 compatibility to use new-style classes. In Python 3, this is unnecessary as there are no old-style classes. Dropping the object is more idiomatic Python.
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* DOC: clarify residual in np.polyfitSeth Troisi2019-10-021-4/+4
|
* BUG: Increment stacklevel for warnings to account for NEP-18 overrides (#13589)Stephan Hoyer2019-05-201-1/+1
| | | | | | | | | | | | | | * Increment stacklevel for warnings to account for NEP-18 overrides For NumPy functions that make use of `__array_function__`, the appropriate the stack level for warnings should generally be increased by 1 to account for the override function defined in numpy.core.overrides. Fixes GH-13329 * Update numpy/lib/type_check.py Co-Authored-By: Sebastian Berg <sebastian@sipsolutions.net>
* Merge branch 'master' into poly1d-fixes-fixes-fixes-fixesEric Wieser2019-04-161-48/+119
|\
| * DOC: fix 4 remaining doc build warnings.Ralf Gommers2019-04-141-2/+4
| | | | | | | | 2 for polyfit rankwarning, 2 for divide by zero in log10.
| * DOC: fix some more See Also issuesRalf Gommers2019-04-141-5/+4
| | | | | | | | These ones just generated warnings, not build failures
| * Merge pull request #12239 from daten-kieker/polyval_2477Marten van Kerkwijk2019-01-041-1/+3
| |\ | | | | | | BUG: polyval returned non-masked arrays for masked input.
| | * BUG: polyval returned Non-Masked Arrays for Masked Input.Joachim Hereth2018-10-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | This fix will preserve subtypes of ndarray when given as input (x) to the polyval function. In particular, the results for masked values of a masked array will be masked. Fixes #2477.
| * | TST, DOC: enable refguide_checkTyler Reddy2018-12-141-21/+22
| | | | | | | | | | | | | | | | | | | | | | | | * ported the refguide_check module from SciPy for usage in NumPy docstring execution/ verification; added the refguide_check run to Azure Mac OS CI * adjusted NumPy docstrings such that refguide_check passes
| * | Removed non-standard scaling of the covariance matrix and added option to ↵Andreas Nussbaumer2018-11-211-11/+19
| | | | | | | | | | | | disable scaling completely.
| * | DOC: Fix typo in polyint.Alon Hershenhorn2018-11-151-1/+1
| | | | | | | | | | | | | | | Change differentiate to integrate in parameter `p` description. Fixes #12386.
| * | ENH: set correct __module__ for objects in numpy's public APIStephan Hoyer2018-11-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes GH-12271 Tests verify that everything in ``dir(numpy)`` either has ``__module__`` set to ``'numpy'``, or appears in an explicit whitelist of undocumented functions and exported bulitins. These should eventually be documented or removed. I also identified a handful of functions for which I had accidentally not setup dispatch for with ``__array_function__`` before, because they were listed under "ndarray methods" in ``_add_newdocs.py``. I guess that should be a lesson in trusting code comments :).
| * | MAINT: set preferred __module__ for numpy functionsStephan Hoyer2018-10-231-1/+6
| | |
| * | ENH: __array_function__ support for np.lib, part 2/2 (#12119)Stephan Hoyer2018-10-221-0/+52
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ENH: __array_function__ support for np.lib, part 2 xref GH12028 np.lib.npyio through np.lib.ufunclike * Fix failures in numpy/core/tests/test_overrides.py * CLN: handle depreaction in dispatchers for np.lib.ufunclike * CLN: fewer dispatchers in lib.twodim_base * CLN: fewer dispatchers in lib.shape_base * CLN: more dispatcher consolidation * BUG: fix test failure * Use all method instead of function in assert_equal * DOC: indicate n is array_like in scimath.logn * MAINT: updates per review * MAINT: more conservative changes in assert_array_equal * MAINT: add back in comment * MAINT: casting tweaks in assert_array_equal * MAINT: fixes and tests for assert_array_equal on subclasses
| * DOC: Small docstring fixes for old polyfit.Charles Harris2018-08-151-2/+1
| | | | | | | | | | * Remove misleading reference to numpy/polynomial/polynomial/polyfit. * Add missing period in numpy/polynomial/_polybase.py
| * DOC: recommend polynomial.Polynomial over np.polyfit (#11733)Matti Picus2018-08-141-1/+6
| | | | | | | | | | | | | | | | | | | | * DOC: reccomend polynomail.Polynomial over np.polyfit * update from review * update from review, fix links * fix from review
| * HTTP -> HTTPS, and other linkrot fixesMike Toews2018-06-161-2/+2
| |
| * MAINT: move matrix tests in lib to matrixlib.Marten van Kerkwijk2018-04-291-5/+0
| |
| * BUG: Fixed polydiv for Complex Numbers (#10473)Deepak Kumar Gouda2018-01-301-1/+1
| | | | | | | | | | | | This previously failed with: TypeError: Cannot cast ufunc subtract output from dtype('complex128') to dtype('float64') with casting rule 'same_kind'
* | BUG: Return the coefficients array directlyEric Wieser2017-07-081-2/+8
|/ | | | | | | Turns out that this was relied upon downstream We also add a setter for coeffs, so that augmented assignment does not both change state and raise an exception suggesting state could not be changed.
* TST: Prove that poly1d coeffs are immutableEric Wieser2017-03-211-3/+2
| | | | Remove the comment suggesting that they are not
* BUG: Prevent modification of coefficientsEric Wieser2017-03-211-1/+1
| | | | | | | `poly.coeffs = 1` has always failed with a strong exception guarantee. However, `poly.coeffs += 1` would both change the state and fail. Now both fail without affecting the value.
* BUG: Fix regression in scipy that relied on quirky behaviourEric Wieser2017-03-211-0/+10
| | | | Scipy needs `.__dict__['coeffs']` to work, so we can't call the member _coeffs
* DEP: Deprecate copying random properties in __init__Eric Wieser2017-03-091-2/+9
|
* MAINT: Remove weird __setattr__ logic emulating propertiesEric Wieser2017-03-091-27/+32
| | | | | Presumably written long before @property existed. This means we don't need __dict__ everywhere
* BUG: Prevent crash in poly1d.__eq__Eric Wieser2017-03-091-0/+4
| | | | Fixes #8760
* MAINT: replace len(x.shape) with x.ndimEric Wieser2017-02-241-2/+2
|
* DOC: Fix erroneous return type description for np.roots.Stuart Archibald2016-09-231-1/+1
| | | | | | | | | | | | | | np.roots() does not always return complex roots, the roots of a polynomial depend its coefficients and therefore may be in the real or complex domain. e.g. ``` >>> (np.roots([1,2,3])).dtype dtype('complex128') >>> (np.roots([1,2,])).dtype dtype('float64') ```
* ENH: Add stacklevel to all (or almost all) our function callsSebastian Berg2016-09-021-1/+1
|
* DOC: Fixed documented dimension of return value Joseph Fox-Rabinovitz2016-08-261-1/+1
| | | The first dimension of the return value depends on the degree of the polynomial, not the number of elements being used in the fit.
* TST: Test that polyfit raises if not enough data for cov estimate.Charles Harris2016-06-151-3/+3
| | | | Also a slight refactoring of np.polyfit.
* BUG: Make sure we don't divide by zero in np.polyfit.David Schaich2016-06-151-0/+3
| | | | | | | | This should fix the issue discussed at https://mail.scipy.org/pipermail/numpy-discussion/2013-July/067076.html Without the ValueError added here, polyfit can (and does) return negative or nan variances with no warning.
* Merge pull request #4073 from endolith/patch-2Charles Harris2016-06-151-6/+2
|\ | | | | BUG: change real output checking to test if all imaginary parts are zero
| * Simpler checking of complex conjugatesendolith2015-02-171-6/+3
| |
| * BUG: sort after conjugating so that poly() outputs real type for exact ↵endolith2015-01-251-6/+5
| | | | | | | | conjugates
* | DOC: Fix some incorrect RST definition listsEndolith2016-05-111-1/+1
| |
* | DOC: Fix poly_val description for 'x' inputgfyoung2015-12-221-4/+4
| | | | | | | | Closes gh-6849.
* | DOC: Use print only as function when print_function is imported from __future__gfyoung2015-12-191-8/+8
| | | | | | | | Closes gh-6863.
* | add clarification of weights to documentationGriffin Hosseinzadeh2015-11-131-1/+2
|/
* DOC : do not abuse enum markupThomas A Caswell2014-12-121-2/+2
| | | | | | | | | - {ndarray, bool} -> ndarray or bool - {int, array of ints} -> int or array of ints - {str, function} -> str or function - {sequnce, int} -> sequence or int - {array_like, poly1d} -> array_like or poly1d - {None, list of `m` scalars, scalar} -> list of `m` scalars or scalar
* ENH: Cast non-object arrays to float in np.polyjaimefrio2014-09-251-6/+12
| | | | | | Closes #5096. Casts integer arrays to np.double, to prevent integer overflow. Object arrays are left unchanged, to allow use of arbitrary precision objects.
* MAINT: Make numpy/lib/polynomial/polyval a bit faster.Charles Harris2014-09-021-1/+1
| | | | | | | | | Multiplying a numpy_scalar times a numpy_array is much faster than the other way around. This PR switches the order of multiplication in the polyval function resulting in a speedup of about 5x for scalar values of x. Closes #4610.
* STY: Make files in numpy/lib PEP8 compliant.Charles Harris2014-07-311-33/+34
| | | | The rules enforced are the same as those used for scipy.
* MAINT: Comparison deprecation followup fixesSebastian Berg2014-05-041-15/+3
| | | | | | | Makes the identity check `a = np.array([np.nan], dtype=object)` `a == a`, etc. a deprecation/futurewarning instead of just changing it. Also fixes some smaller things.
* DEP: Deprecate that comparisons ignore errors.Sebastian Berg2014-05-041-2/+16
| | | | | | | | | | | | | | | | | | | | This means that for example broadcasting errors get raised. The array_equiv function is changed to explicitely test if broadcasting is possible. It may be nice to do this test differently, but I am not sure if that is possible. Create a FutureWarning for comparisons to None, which should result in areal elementwise (object) comparisons. Slightly adepted a wrong test. Poly changes: Some changes in the polycode was necessary, the one is probably a bug fix, the other needs to be thought over, since len check is not perfect maybe, since it is more liekly to raise raise an error. Closes gh-3759 and gh-1608
* DOC: Link convolve with polymulendolith2014-03-221-0/+2
| | | | Matlab uses `conv` for both convolution and polynomial multiplication. Clarifying that numpy has functions for each.
* DOC: specify that 2d array must be non-empty in np.poly error message.Daniel da Silva2014-03-151-1/+1
| | | | Fixes #2092. Changes message passed to ValueError.
* Merge pull request #3657 from charris/add-hash-method-to-polynomialsCharles Harris2013-09-041-0/+2
|\ | | | | BUG: Set __hash__ = None for non-hashable classes.
| * BUG: Set __hash__ = None for non-hashable classes.Charles Harris2013-08-281-0/+2
| | | | | | | | | | | | | | | | | | | | Because neither poly1d nor the Polynomial package polynomial classes are immutable, hence not reliably hashable, they should signal that by setting __hash__ = None. This also fixes the warning Overriding __eq__ blocks inheritance of __hash__ in 3.x that is given when the command `python2.7 -3 -c"import numpy"` is run.