| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
[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.
|
| | |
|
|\ \
| | |
| | | |
MAINT: can't find Python.h when build_ext --include-dirs is set
|
| | |
| | |
| | |
| | |
| | | |
Ensure that build_ext.include_dirs is the same physical list as
build_ext.distribution.include_dirs.
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Boolean array indices will (unless the special case is taken)
always be converted using a nonzero logic. However, for example
```
arr = np.arange(10)
index = np.array([True])
arr[index]
```
would thus work as if index is filled up with `False`. This is
a source of confusion and hardly useful in practice. Especially
if the array has more then one dimension this behaviour can
be very unexpected as it conflicts with broadcasting.
Uses VisibleDeprecationWarning, since this is probably usually a
user bug in the first place.
|
|\ \
| | |
| | | |
Einsum fix
|
| | |
| | |
| | |
| | | |
More tests would be good, but for now two specific tests.
|
| | |
| | |
| | |
| | | |
Closes gh-5907
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously views of structured arrays containing objects were completely
disabled. This commit adds more lenient check for whether an object-array
view is allowed, and adds similar checks to getfield/setfield
Fixes #2346. Fixes #3256. Fixes #2599. Fixes #3253. Fixes #3286.
Fixes #5762.
|
| | |
| | |
| | |
| | |
| | | |
Document the matmul function and add '@' to the operator
section of the reference manual.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Start labels at beginning of line.
Break a long line
Whitespace.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is the functional counterpart of the '@' operator that will be
available in Python 3.5 with the addition of an out keyword. It
operates like the dot function except that
- scalar multiplication is not allowed.
- multiplication of arrays with more than 2 dimensions broadcasts.
The last means that when arrays have more than 2 dimensions they are
treated as stacks of matrices and those stacks are broadcast against
each other unlike the current behavior of dot that does an outer
product. Like dot, matmul is aware of `__numpy_ufunc__` and can be
overridden.
The current version of the function uses einsum when cblas cannot be
used, hence object arrays are not yet supported.
|
| | |
| | |
| | |
| | |
| | | |
The function was not static, which led to multiple definition
errors.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
A new inline function 'npy_cache_pyfunc' is provided for the common
operation of inporting and caching a Python function in static
variables. The intended usage is as follows.
int myfunc()
{
static PyObject *cache = NULL:
npy_cache_pyfunc("the.module.name", "function", &cache);
...
}
Errors are not recoverable, so checked with assert for debugging.
|
|\ \ \
| | | |
| | | | |
ENH: Let MaskedArray getter, setter respect baseclass overrides
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
MAINT: explicit fft copy
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
BUG: Further fixes to record and recarray getitem/getattr
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This is a followup to PR #5505, which didn't go quite far
enough. This fixes two issues in particular:
1) The record class also needs an updated `__getitem__` that works
analogously to its `__getattribute__` so that a nested record is
returned as a `record` object and not a plain `np.void`. In other
words the old behavior is:
```python
>>> rec = np.rec.array([('abc ', (1,1), 1), ('abc', (2,3), 1)],
... dtype=[('foo', 'S4'), ('bar', [('A', int), ('B', int)]),
('baz', int)])
>>> rec[0].bar
(1, 1)
>>> type(rec[0].bar)
<class 'numpy.record'>
>>> type(rec[0]['bar'])
<type 'numpy.void'>
```
demonstrated inconsistency between `.bar` and `['bar']` on the record
object. The new behavior is:
```python
>>> type(rec[0]['bar'])
<class 'numpy.record'>
```
2) The second issue is more subtle. The fix to #5505 used the
`obj.dtype.descr` attribute to create a new dtype of type `record`.
However, this does not recreate the correct type if the fields are
not aligned. To demonstrate:
```python
>>> dt = np.dtype({'C': ('S5', 0), 'D': ('S5', 6)})
>>> dt.fields
dict_proxy({'C': (dtype('S5'), 0), 'D': (dtype('S5'), 6)})
>>> dt.descr
[('C', '|S5'), ('', '|V1'), ('D', '|S5')]
>>> new_dt = np.dtype((np.record, dt.descr))
>>> new_dt
dtype((numpy.record, [('C', 'S5'), ('f1', 'V1'), ('D', 'S5')]))
>>> new_dt.fields
dict_proxy({'f1': (dtype('V1'), 5), 'C': (dtype('S5'), 0), 'D':
(dtype('S5'), 6)})
```
Using the `fields` dict to construct the new type reconstructs the
correct type with the correct offsets:
```python
>>> new_dt2 = np.dtype((np.record, dt.fields))
>>> new_dt2.fields
dict_proxy({'C': (dtype('S5'), 0), 'D': (dtype('S5'), 6)})
```
(Note: This is based on #5920 for convenience, but I could decouple
the changes if that's preferable.)
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | | |
The _PyArray_ITER_NEXT3 macro is not used in PyArray_ITER_NEXT,
and has syntax errors that would fail compilation if used.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
ENH: Allow dictproxy objects to be used in place of dicts when creating a dtype
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
a dtype
arraydescr_new allows passing in a dict to represent a multi-field
dtype. However, the .fields attribute on such dtypes is returned
as a dictproxy object. Therefore it is convenient, for copying
existing multi-field dtypes, to be able to pass in a dictproxy object
as well.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
BUG: np.broadcast should accept itself as an input
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Fixes #5881
|
| | |_|_|/ /
| |/| | | | |
|
|\ \ \ \ \ \
| |_|/ / / /
|/| | | | | |
DOC: Better document 'order' argument of 'sort' and friends
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Closes #5927
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Avoids modifying the dtype of the array.
Also removed explicit memcpy calls, let copyswap take care of it.
|
| | | | | |
|
| | | | | |
|
|\ \ \ \ \
| |_|/ / /
|/| | | | |
Simplify numpy/distutils/__init__.py
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Thanks to the presence of
from __future__ import absolute_import
we don't need different code paths for Python 2/3.
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
|\ \ \ \ \
| |_|/ / /
|/| | | | |
DOC: Fix spelling of Von Hann's surname
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
BUG: Handling of axisc in np.cross
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Fixes #5885 by ignoring `axisc` when both input vectors are 2D.
Also adds explicit checks for `axis?` parameters in bounds, to
provide more informative errors.
Also slightly simplified the calculation logic and documented the
assumptions in each branch with `assert`s.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | | |
Modified the handling that np.ma.compress_nd does of its 'axis'
argument, to more closely follow that of ufunc methods, including
error messages for wrong values.
|