summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
* DOC: Fix typo in documentationamir2015-06-121-4/+4
| | | | [ci skip]
* Merge pull request #5947 from ahaldane/voidscalar_getsetfieldCharles Harris2015-06-113-75/+107
|\ | | | | BUG: make void-scalar getfield/setfield use ndarray methods
| * BUG: make void-scalar getfield/setfield use ndarray methodsAllan Haldane2015-06-103-75/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | DOC: Polynomial.deriv refers to integrations, not differentiationsAndrew Nelson2015-06-101-1/+1
| |
* | Merge pull request #5866 from tdsmith/include_dirsRalf Gommers2015-06-091-3/+17
|\ \ | | | | | | MAINT: can't find Python.h when build_ext --include-dirs is set
| * | BLD: find Python.h when build_ext --include-dirs is setTim D. Smith2015-06-051-3/+17
| | | | | | | | | | | | | | | Ensure that build_ext.include_dirs is the same physical list as build_ext.distribution.include_dirs.
* | | DEP: Deprecate boolean array indices with non-matching shapeSebastian Berg2015-06-067-21/+101
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #5944 from seberg/einsum-fixCharles Harris2015-06-052-3/+25
|\ \ | | | | | | Einsum fix
| * | TST: Einsum contiguous output testSebastian Berg2015-06-051-1/+23
| | | | | | | | | | | | More tests would be good, but for now two specific tests.
| * | BUG: Einsum specialization did not check contiguity of output arraySebastian Berg2015-06-051-2/+2
| | | | | | | | | | | | Closes gh-5907
* | | ENH: structured datatype safety checksAllan Haldane2015-06-057-38/+332
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | DOC: Document '@' and matmul.Charles Harris2015-06-041-1/+126
| | | | | | | | | | | | | | | Document the matmul function and add '@' to the operator section of the reference manual.
* | | STY: Minor C style fixes for multiarraymodule.c.Charles Harris2015-06-041-10/+12
| | | | | | | | | | | | | | | | | | Start labels at beginning of line. Break a long line Whitespace.
* | | TST: Add tests for multiarray.matmul and operator '@'.Charles Harris2015-06-041-2/+283
| | |
* | | ENH: Add support for the '@' operator added in Python 3.5.Charles Harris2015-06-041-4/+26
| | |
* | | ENH: Add a matmul function to multiarrayCharles Harris2015-06-042-7/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | BUG: Fix npy_cache_pyfunc to properly implement inline.Charles Harris2015-06-041-2/+1
| | | | | | | | | | | | | | | The function was not static, which led to multiple definition errors.
* | | ENH: Add inline C function to import and cache Python functions.Charles Harris2015-06-041-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #4586 from mhvk/ma/subclass-item-setting-gettingCharles Harris2015-06-033-18/+145
|\ \ \ | | | | | | | | ENH: Let MaskedArray getter, setter respect baseclass overrides
| * | | ENH: Let MaskedArray getter, setter respect baseclass overridesMarten van Kerkwijk2015-04-223-18/+145
| | | |
* | | | Merge pull request #5910 from argriffing/more-astype-auditingJaime2015-06-021-16/+16
|\ \ \ \ | | | | | | | | | | MAINT: explicit fft copy
| * | | | MAINT: fft: np.asarray(...) -> array(...)alex2015-06-021-9/+8
| | | | |
| * | | | MAINT: in fft, make copying more explicitalex2015-05-291-7/+14
| | | | |
| * | | | MAINT: remove unnecessary helper functionalex2015-05-291-13/+9
| | | | |
| * | | | MAINT: explicit fft copyalex2015-05-221-14/+12
| | | | |
* | | | | Merge pull request #5921 from embray/record-getitem-fixesCharles Harris2015-06-022-6/+28
|\ \ \ \ \ | | | | | | | | | | | | BUG: Further fixes to record and recarray getitem/getattr
| * | | | | BUG: Further fixes to record and recarray getitem/getattrErik M. Bray2015-06-012-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* | | | | | MANT: Remove unused macro _PyArray_ITER_NEXT3Jaime Fernandez2015-06-011-21/+0
|/ / / / / | | | | | | | | | | | | | | | | | | | | The _PyArray_ITER_NEXT3 macro is not used in PyArray_ITER_NEXT, and has syntax errors that would fail compilation if used.
* | | | | Merge pull request #5920 from embray/descr-fields-dictproxyJaime2015-06-012-19/+40
|\ \ \ \ \ | | | | | | | | | | | | ENH: Allow dictproxy objects to be used in place of dicts when creating a dtype
| * | | | | ENH: Allow dictproxy objects to be used in place of dicts when creatingErik M. Bray2015-06-012-19/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | Merge pull request #5889 from jaimefrio/broadcast_broadcastCharles Harris2015-06-012-14/+75
|\ \ \ \ \ \ | | | | | | | | | | | | | | BUG: np.broadcast should accept itself as an input
| * | | | | | BUG: np.broadcast should accept itself as an inputJaime Fernandez2015-05-171-14/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #5881
| * | | | | | TST: np.broadcast should accept itself as inputJaime Fernandez2015-05-171-0/+28
| | |_|_|/ / | |/| | | |
* | | | | | Merge pull request #5928 from jaimefrio/sort_order_docCharles Harris2015-06-012-20/+32
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | DOC: Better document 'order' argument of 'sort' and friends
| * | | | | DOC: Better document 'order' argument of 'sort' and friendsJaime Fernandez2015-05-302-20/+32
| | | | | | | | | | | | | | | | | | | | | | | | Closes #5927
* | | | | | MANT: Style clean-up in VOID_compareJaime Fernandez2015-05-301-21/+15
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | Avoids modifying the dtype of the array. Also removed explicit memcpy calls, let copyswap take care of it.
* | | | | DOC: np.std and np.var docstring examples are outdatedMortada Mehyar2015-05-281-12/+12
| | | | |
* | | | | DOC: Fix typo and some grammarVraj Mohan2015-05-271-2/+2
| | | | |
* | | | | Merge pull request #5892 from andreabedini/masterNathaniel J. Smith2015-05-241-28/+12
|\ \ \ \ \ | |_|/ / / |/| | | | Simplify numpy/distutils/__init__.py
| * | | | Simplify numpy/distutils/__init__.pyAndrea Bedini2015-05-161-28/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thanks to the presence of from __future__ import absolute_import we don't need different code paths for Python 2/3.
* | | | | MAINT: conditional copy=False in some astype callsalex2015-05-221-4/+16
| | | | |
* | | | | MAINT: skip copy=False for det and logdetalex2015-05-221-3/+2
| | | | |
* | | | | MAINT: use copy=False in a few astype callsalex2015-05-221-18/+21
| | | | |
* | | | | MAINT: more consistent notation in umath_linalgalex2015-05-211-5/+13
| | | | |
* | | | | MAINT: use more conservative integer types for umath linalgalex2015-05-201-36/+54
| | | | |
* | | | | Merge pull request #5893 from stefanv/hannNathaniel J. Smith2015-05-181-1/+1
|\ \ \ \ \ | |_|/ / / |/| | | | DOC: Fix spelling of Von Hann's surname
| * | | | DOC: Fix spelling of Von Hann's surnameStefan van der Walt2015-05-181-1/+1
| | | | |
* | | | | Merge pull request #5886 from jaimefrio/cross_axisCharles Harris2015-05-172-14/+24
|\ \ \ \ \ | | | | | | | | | | | | BUG: Handling of axisc in np.cross
| * | | | | BUG: Handling of axisc in np.crossJaime Fernandez2015-05-172-14/+24
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | MANT: handling of axis in np.ma.compress_ndJaime Fernandez2015-05-171-16/+14
|/ / / / | | | | | | | | | | | | | | | | | | | | 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.