summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Bourque <jay.bourque@continuum.io>2012-12-19 14:12:21 -0600
committerJay Bourque <jay.bourque@continuum.io>2013-08-16 16:39:31 -0500
commit13c1847ba2f0eab36004491deb0e2b8e1140c133 (patch)
treeeb6e37927c5c1bb47594fe356a4b3738ecd13378
parent1b81be70ff832aac385254d57fb0c6feae8873bf (diff)
downloadnumpy-13c1847ba2f0eab36004491deb0e2b8e1140c133.tar.gz
Reword some comments/documentation
-rw-r--r--numpy/add_newdocs.py13
-rw-r--r--numpy/core/src/umath/ufunc_object.c2
2 files changed, 9 insertions, 6 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index adfbc5b5a..e630ae921 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -5820,11 +5820,14 @@ add_newdoc('numpy.core', 'ufunc', ('at',
at(a, indices, b=None)
Performs operation in place on array for items specified by indices.
- Items can be listed more than once and operation will be performed
- on result of operation on previous item.
-
- Equivalent to a[indices] += b for addition ufunc, except that results
- are accumulated for indices listed more than once.
+ For addition ufunc, this method is equivalent to a[indices] += b,
+ except that results are accumulated for indices listed more than once.
+ This solves the problem with a[indices] += b where each time a duplicate
+ index is encounted, the increment is performed on the original element.
+ As a result, an element that appears three times in the fancy indexing
+ list will only be incremented once in the final result, whereas with the
+ new 'at' method the original element will be incremented by three in the
+ final result.
Parameters
----------
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index e7de6d379..dadf86e28 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -4953,7 +4953,7 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args, PyObject *kwds)
/*
* Be sure values array is "broadcastable"
- * to shape of mit->dimensions, mit->nd
+ * to shape of iter->dimensions, iter->nd
*/
if ((iter2 = (PyArrayIterObject *)\
PyArray_BroadcastToShape((PyObject *)op2_array,