[NumPy-Tickets] [NumPy] #1922: Indexing arrays with arrays having redundant entries
NumPy Trac
numpy-tickets@scipy....
Tue Aug 2 09:56:57 CDT 2011
#1922: Indexing arrays with arrays having redundant entries
----------------------------+-----------------------------------------------
Reporter: gfabbian | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.numarray | Version: 1.6.0
Keywords: array indexing |
----------------------------+-----------------------------------------------
I'm experiencing a problem with array indexing. Suppose you have an array
a and another array b you want to use to use as index for a in order to
assign some values to the position pointed by b elements.
{{{
>>>a=numpy.zeros(5)
>>> print a
>>>[ 0. 0. 0. 0. 0.]
}}}
Now I would like to increase the second element twice using this technique
{{{
>>>b=numpy.array([1,1])
>>>a[b]+=1.
>>> print a
>>>[ 0. 1. 0. 0. 0.]
}}}
while I expected to have
{{{
>>>[ 0. 2. 0. 0. 0.]
}}}
There are no problems if the array b has no redundancies (all values of
its elements are different).
Is it a bug or I'm missing something?
Thanks in advance
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1922>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list