| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | | |
These functions npy_PyFile_Dup and npy_PyFile_DupClose do not work
correctly in Python 3. Deprecation messages have been raised in
npy_PyFile_Dup since 1.9 and it is probably best to smoke out any
remaining uses by simply removing the function.
|
|\ \ \ \ \ \ \ \ \ \ \
| | | | | | | | | | | |
| | | | | | | | | | | | |
MAINT: improve laguerre and legendre efficiency
|
| | | | | | | | | | | | |
|
|\ \ \ \ \ \ \ \ \ \ \ \
| |/ / / / / / / / / / /
|/| | | | | | | | | | | |
MAINT: notice that eigvalsh returns a sorted array
|
| | |_|_|_|_|_|_|_|/ /
| |/| | | | | | | | | |
|
|\ \ \ \ \ \ \ \ \ \ \
| | | | | | | | | | | |
| | | | | | | | | | | | |
ENH: Take advantage of symmetry in leggauss.
|
| |/ / / / / / / / / /
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | | |
The calculation of points and weights for Gauss-Legendre quadrature
can take advantage of the symmetry of the companion matrix when
computing its eigenvalues in order to speed up the computation.
|
|\ \ \ \ \ \ \ \ \ \ \
| | | | | | | | | | | |
| | | | | | | | | | | | |
DOC: update eigvalsh docstring example
|
| |/ / / / / / / / / / |
|
|\ \ \ \ \ \ \ \ \ \ \
| |/ / / / / / / / / /
|/| | | | | | | | | | |
BUG: automatically convert recarray dtype to np.record
|
| |/ / / / / / / / /
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
Viewing an ndarray as a np.recarray now automatically converts
the dtype to np.record.
This commit also fixes assignment to MaskedArray's dtype attribute,
fixes the repr of recarrays with non-structured dtype, and removes
recarray.view so that viewing a recarray as a non-structured dtype
no longer converts to ndarray type.
Fixes #3581
|
|/ / / / / / / / /
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
The function will be new in NumPy 1.10, so get this done before
branching that version. The old name was a bit too specific for a
function that could also be used to cache other attributes than just
functions.
|
|\ \ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
BUG: Large concatenates with axis=None causing segfault.
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
This was due to sizes assuming a MAX_ARGS, just remove usage and
call PyArray_SIZE each time.
Closes gh-5979
|
| |/ / / / / / / /
|/| | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
For a masked array holding objects that themselves are arrays, when selecting a
single item, it is treated as if it were a slice of the array and an attempt is
made to set its mask. This was always a bug, but it become visible with a
recent change to `MaskedArray.__getitem__` (gh-4586) where it is attempted to
change the shape of the mask. With this PR, this case gets special treatment
in that the object is made into a Masked Array with a full set mask.
(A previous attempt to do the perhaps more logical think and just return
`masked` caused quite a few errors in astropy.io.votable; it seemed it was
not worth breaking backwards compatibility that much).
Test case that now works but used to fail:
```
mx1 = MaskedArray([1.], mask=[True])
mx2 = MaskedArray([1., 2.])
mx = MaskedArray([mx1, mx2], mask=[False, True])
mx[0]
```
|
|\ \ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
BUG allow subclasses in MaskedArray ufuncs -- for non-ndarray _data
|
| | | | | | | | | | |
|
|/ / / / / / / / /
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
This commit simplifies the code in array_subscript and
array_assign_subscript related to field access. This fixes #4806,
and also removes a potential segfaults, eg if the array is indexed using
an sequence-like object that raises an exception in getitem.
Also fixes #5631, related to creation of structured dtypes
with no fields (an unusual and probably useless edge case).
Also moves all imports in _internal.py to the top.
Fixes #4806.
Fixes #5631.
|
|\ \ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
BUG: fix inconsistency with np.array(['']) being truthy
```
a = np.array([0])
b = np.array([None])
c = np.array([''])
d = np.array([' '])
```
Why should we have this inconsistency:
```
>>> bool(a)
False
>>> bool(b)
False
>>> bool(c)
True
>>> bool(d)
False
```
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
|\ \ \ \ \ \ \ \ \ \
| | | | | | | | | | |
| | | | | | | | | | | |
ENH: allow subclass overrides by removing explicit ndarray methods
|
| | | | | | | | | | | |
|
|\ \ \ \ \ \ \ \ \ \ \
| |_|_|/ / / / / / / /
|/| | | / / / / / / /
| | |_|/ / / / / / /
| |/| | | | | | | | |
FIX sprintf bug + get rid of a lot of warnings
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
Output argument was a char ** instead of a char *.
Also changed to use snprintf for safety; if the error message is
ever changed, the magic number 174 (!?) is likely to go stale,
causing buffer overruns.
|
| | | | | | | | | | |
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
See #5946. The input/output pointers were being incorrectly
incremented.
|
|\ \ \ \ \ \ \ \ \ \
| | | | | | | | | | |
| | | | | | | | | | | |
BUG: einsums bool_sum_of_products_contig incorrect for small arrays
|
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | | | |
The small array (and end of loop) special case incorrectly stepped
through array and left pointers bogus.
|
| |_|_|/ / / / / / /
|/| | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
Fixed by #5964, but might as well keep the test from #5960.
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
This checks the four classes with different __array_priority__ values
against each other for the operators
__add__, __radd__
__sub__, __rsub__
__mul__, __rmul__
__pow__, __rpow__
__div__, __rdiv__
__mod__, __rmod__
__truediv__, __rtruediv__
__floordiv__, __rfloordiv__
__and__, __rand__
__xor__, __rxor__
__or__, __ror__
__lshift__, __rlshift__
__rshift__, __rrshift__
__eq__
__ne__
__gt__
__ge__
__lt__
__le__
The classes are ndarray, two subclasses of ndarray, and a class unrelated
to ndarray. The combinations checked are
ndarray -- ndarray subclass
ndarray -- unrelated class
ndarray subclass -- ndarray subclass
ndarray subclass -- unrelated class
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
The following functions now raise a TypeError instead of returning
NotImplemented:
np.power, np.add, np.subtract, np.multiply, np.divide,
np.bitwise_and, np.bitwise_or, np.bitwise_xor, np.floor_divide,
np.fmax, np.fmin, np.fmod, np.hypot, np.logaddexp,
np.logaddexp2, np.logical_and, np.logical_or, np.logical_xor,
np.maximum, np.minimum, np.mod
Functions that remain to be fixed:
np.greater, np.greater_equal, np.less,
np.less_equal, np.not_equal
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
Also added back some extended error messages that were in original
PR #5864.
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
The NotArray test class needs to define a `__ne__` method, otherwise the
inherited Python 3 method will call `__eq__`, resulting in two rather
than one DeprecationWarning.
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
This is probably a good change in any case, and in particular might
help with debugging whatever bizarro thing is going wrong on Travis.
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
This was redundant/broken anyway.
See gh-5844 for discussion. See the massive comment added to
ufunc_object.c:get_ufunc_arguments for a discussion of the deprecation
strategy here -- it turns out that array_richcompare is such a
disaster zone that we can't quite wholly eliminate NotImplemented
quite yet. But this removes most NotImplementeds, and lays the
groundwork for eliminating the rest in a release or two.
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
ndarray special methods like __add__ have a special case where if the
right argument is not an ndarray or subclass, and it has higher
__array_priority__ than the left argument, then we return
NotImplemented and let the right argument handle the operation.
ufuncs have traditionally had a similar but different special case,
where if it's a 2 input - 1 output ufunc, and the right argument is
not an ndarray (exactly, subclasses don't count), and when converted
to an ndarray ends up as an object array (presumably b/c it doesn't
have a meaningful coercion route, though who knows), and it has a
higher __array_priority__ than the left argument AND it has a
__r<operation>__ attribute, then they return NotImplemented.
In practice this latter special case is not used by regular ndarrays,
b/c anytime it would need to be triggered, the former special case
triggers first and the ufunc is never called. However, numpy.ma did
not have the former special case, and was thus relying on the ufunc
special case. This commit adds the special case to the numpy.ma
special methods directly, so that they no longer depend on the quirky
ufunc behaviour.
It also cleans up the relevant test to things that actually should be
true in general, instead of just testing some implementation details.
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
The ndarray richcompare function has special case code for handling
void dtypes (esp. structured dtypes), since there are no ufuncs for
this. Previously, we would attempt to call the relevant
ufunc (e.g. np.equal), and then when this failed (as signaled by the
ufunc returning NotImplemented), we would fall back on the special
case code. This commit moves the special case code to before the
regular code, so that it no longer requires ufuncs to return
NotImplemented.
Technically, it is possible to define ufunc loops for void dtypes
using PyUFunc_RegisterLoopForDescr, so technically I think this commit
changes behaviour: if someone had registered a ufunc loop for one of
these operations, then previously it might have been found and
pre-empted the special case fallback code; now, we use the
special-case code without even checking for any ufunc. But the only
possible use of this functionality would have been if someone wanted
to redefine what == or != meant for a particular structured dtype --
like, they decided that equality for 2-tuples of float32's should be
different from the obvious thing. This does not seem like an important
capability to preserve.
There were also several cases here where on error, an array comparison
would return a scalar instead of raising. This is supposedly
deprecated, but there were call paths that did this that had no
deprecation warning. I added those warnings.
|
| |/ / / / / / / /
|/| | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
The ndarray richcompare function has a special case for handling
string dtypes (which currently cannot be handled by
ufuncs). Traditionally this was handled by the ufuncs returning
NotImplemented, and then falling through to a special case. By moving
the special case to the top of the richcompare function, it becomes
unnecessary for the ufuncs to return NotImplemented in this case.
|
|\ \ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
Rubustify tuple loop search
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
This was failing due to the check for matching loops not searching
through all available loops, rather ending with int8 inputs and float
output, which in turn would fail casting.
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
When a loop match fails on account of casting, continue searching the
loops until success or all loops have been examined. The failure to do
this was causing true_divide to fail with float inputs and dtype=float
because the first loop found was (int8, int8, float64), leading to a
casting error as float cannot be safely cast to int8. Versions of numpy
previous to 1.10 will still fail silently if this is backported as the
casting rules were less strict, so that would also need fixing.
Closes #3484.
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
[ci skip]
|
|\ \ \ \ \ \ \ \ \ \
| |_|_|/ / / / / / /
|/| | | | | | | | | |
BUG: make void-scalar getfield/setfield use ndarray methods
|
| | |/ / / / / / /
| |/| | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
This commit modifies voidtype_get/setfield to call ndarray's
get/setfield, which does proper safety checks (for object arrays) and
broadcasts properly. This solves bugs related to void-scalar
assignment.
Also changed the calling convention of voidtype_getfield. Previously it
accepted a (dtype, offset, title) tuple and dropped title. Now it
expects only (dtype, offset), just like ndarray's getfield.
Fixes #3126.
Fixes #3561.
|