| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
* Rewrite the documentation for `deg`.
* Check that the passed degrees are int and raise if not.
* Do not accept `deg` arguments that do not convert as 0-D or 1-D.
* Sort passed degree terms for repeatability.
|
|
|
|
|
|
|
|
|
|
| |
The argument `deg` is enhanced to allow an
array_like argument to past which specifies
which terms to include in the fit.
The returned coef array is exapnded to have
entries of 0 for all coefficients which were
not included in the fit.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new computations use normalized polynomials. Those polynomials are
less subject to overflow and allow the determination of the weights and
roots up to about degree 350, at which point the weights underflow.
Two private functions are added for computing the values of the
normalized polynomials:
1. _normed_hermite_n
2. _normed_hermite_e_n
|
|
|
|
|
|
|
|
|
| |
The previous method used for hermite and hermite_e polynomials suffered
from double overflow for polynomials of large degree. Those numbers were
later scaled down by equally large numbers, but the result was NaN. The
wanted values are now computed in such a way that overflow in some
entries is replaced by underflow in others. The resulting zeros are a
negligible perturbation of the companion matrix.
|
|
|
|
| |
Detected by pyflakes.
|
|
|
|
|
| |
The rather lax standards used in scipy were used to identify the
needed style fixups.
|
| |
|
|\
| |
| | |
DOC: remove obsolete NA reference from polyfit docs
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Move the class documentation to the place of definition in the
appropriate module. This allow for documenting the specific series kind
along with the series specific default domains and windows
Remove template placeholders from the ABCPolyBase class documention.
General fixup of documentation that rendered poorly.
|
|/
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long
and will need to be broken at some point. OTOH, some lines were already
too long and need to be broken at some point. Now seems as good a time
as any to do this with open PRs at a minimum.
|
|
|
|
|
|
|
|
| |
The companion matrices returned by the various polynomial types was
a scalar in the degree one case instead of a 2-D array. Fix that and
add a test to check for that result.
Closes #3459.
|
|
|
|
|
|
|
| |
Add `print_function` to all `from __future__ import ...` statements
and use the python3 print function syntax everywhere.
Closes #3078.
|
|\
| |
| | |
DOC: Formatting fixes using regex
|
| |
| |
| |
| | |
also other spacing or formatting mistakes
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new import `absolute_import` is added the `from __future__ import`
statement and The 2to3 `import` fixer is run to make the imports
compatible. There are several things that need to be dealt with to make
this work.
1) Files meant to be run as scripts run in a different environment than
files imported as part of a package, and so changes to those files need
to be skipped. The affected script files are:
* all setup.py files
* numpy/core/code_generators/generate_umath.py
* numpy/core/code_generators/generate_numpy_api.py
* numpy/core/code_generators/generate_ufunc_api.py
2) Some imported modules are not available as they are created during
the build process and consequently 2to3 is unable to handle them
correctly. Files that import those modules need a bit of extra work.
The affected files are:
* core/__init__.py,
* core/numeric.py,
* core/_internal.py,
* core/arrayprint.py,
* core/fromnumeric.py,
* numpy/__init__.py,
* lib/npyio.py,
* lib/function_base.py,
* fft/fftpack.py,
* random/__init__.py
Closes #3172
|
|
|
|
| |
This changes the `exec` command to the `exec` function.
|
|
|
|
|
|
|
|
|
|
| |
Instead of
if lhs.dtype.char in np.typecodes['Complex']:
use
if issubclass(lhs.dtype.type, np.complexfloating):
|
|
|
|
|
|
|
| |
The columns should be scaled using their 2-norm, but in the complex case
that was being incorrectly computed as the square root of the sum of the
squared elements rather than as the square root of the sum of their squared
real and imaginary parts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The original masked-NA-NEP branch contained a large number of changes
in addition to the core NA support. For example:
- ufunc.__call__ support for where= argument
- nditer support for arbitrary masks (in support of where=)
- ufunc.reduce support for simultaneous reduction over multiple axes
- a new "array assignment API"
- ndarray.diagonal() returning a view in all cases
- bug-fixes in __array_priority__ handling
- datetime test changes
etc. There's no consensus yet on what should be done with the
maskna-related part of this branch, but the rest is generally useful
and uncontroversial, so the goal of this branch is to identify exactly
which code changes are involved in maskna support.
The basic strategy used to create this patch was:
- Remove the new masking-related fields from ndarray, so no arrays
are masked
- Go through and remove all the code that this makes
dead/inaccessible/irrelevant, in a largely mechanical fashion. So
for example, if I saw 'if (PyArray_HASMASK(a)) { ... }' then that
whole block was obviously just dead code if no arrays have masks,
and I removed it. Likewise for function arguments like skipna that
are useless if there aren't any NAs to skip.
This changed the signature of a number of functions that were newly
exposed in the numpy public API. I've removed all such functions from
the public API, since releasing them with the NA-less signature in 1.7
would create pointless compatibility hassles later if and when we add
back the NA-related functionality. Most such functions are removed by
this commit; the exception is PyArray_ReduceWrapper, which requires
more extensive surgery, and will be handled in followup commits.
I also removed the new ndarray.setasflat method. Reason: a comment
noted that the only reason this was added was to allow easier testing
of one branch of PyArray_CopyAsFlat. That branch is now the main
branch, so that isn't an issue. Nonetheless this function is arguably
useful, so perhaps it should have remained, but I judged that since
numpy's API is already hairier than we would like, it's not a good
idea to add extra hair "just in case". (Also AFAICT the test for this
method in test_maskna was actually incorrect, as noted here:
https://github.com/njsmith/numpyNEP/blob/master/numpyNEP.py
so I'm not confident that it ever worked in master, though I haven't
had a chance to follow-up on this.)
I also removed numpy.count_reduce_items, since without skipna it
became trivial.
I believe that these are the only exceptions to the "remove dead code"
strategy.
|
|
|
|
| |
Use divmod instead of // and % separately.
|
|
|
|
|
|
|
|
|
| |
The original method was overly sensitive to roundoff. Of the two
approaches considered, gauss integration or binary subdivision of
the roots, the latter is more compatible with using other number
representations such as mpmath. No method is going to be suitable
for large numbers of arbitrary zeros but the current method is a
significant improvement.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
The old functions could use a review, but that isn't pressing.
|
| |
|
|
|
|
| |
Step 1 in the polynomial package documentation revisions.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new functions for Gauss quadrature are of the form xxxgauss, where xxx
is any of cheb, leg, lag, herm, herme. They return the Gauss points and
weights for Gauss quadrature of the various orthogonal polynomial types
given the degree. They are tested to work up to degree 100.
The new functions for the weight are of the form xxxweight, where xxx is
any of cheb, leg, lag, herm, herme. They return the value of the weight
function for the various orthogonal polynomial types given and array of
points.
|
|
|
|
|
|
|
|
|
| |
The new companion matrices are related to the old by a
similarity transformation that makes them better conditioned
for root finding. In particular, the companion matrices for
the orthogonal polynomials are symmetric when the zeros of a
single polynomial term is wanted. This produces better zeros
for use in Gauss quadrature.
|
|
|
|
|
|
|
|
| |
Where xxx is one of poly, cheb, leg, lag, herm, herme:
Refactor xxxval2d, xxxval3d, xxxgrid2d, and xxxgrid3d for clarity.
Check that coordinate arrays are compatible in xxxval2d, xxxval3d.
Work around einsum bug that affected xxxvander3d.
|
|
|
|
|
|
|
|
|
|
| |
An axis keyword was added to the function signatures of xxxder and
xxxint, where xxx is any of poly, cheb, leg, lag, herm, herme. The
evaluation method for the Chebeshev series was also changed to avoid
using z_series and to more closely resemble the other implementations.
At some point the z_series will be removed from the chebyshev module
and only used for trigonometric series.
|
|
|
|
|
|
|
|
| |
are useful for least squares fits to data depending on two or three variables using the various polynomial basis.
The new functions have names polyvander2d, and polyvander3d,
where 'poly' can be replaced by any of 'leg', 'cheb', 'lag',
'herm', or 'herme'.
|
|
|
|
|
|
|
|
|
|
| |
coefficient arrays can be used. Add functions for evaluation of 2D and 3D polynomial series evaluated either on a specified set of points or on a cartesian product of 1D points.
The new functions have names polyval2d, polygrid2d, polyval3d, and
polygrid3d, where 'poly' can be replaced by any of 'leg', 'cheb', 'lag',
'herm', or 'herme'. These additional functions should cover the common
multidimensional cases and provide examples for anyone who wants to go to
higher dimensions.
|
| |
|
| |
|
| |
|
|
tests still need fixes.
|