On Thu, Mar 20, 2008 at 06:43:21PM -0300, Lisandro Dalcin wrote:
> I think you are wrong, here THERE ARE tmp arrays involved... numpy has
> to copy data if indices are not contiguous or strides (in the sense of
> actually using a slice)
> In [1]: from numpy import *
> In [2]: A = array([0,0,0])
>
I think you are wrong, here THERE ARE tmp arrays involved... numpy has
to copy data if indices are not contiguous or strides (in the sense of
actually using a slice)
In [1]: from numpy import *
In [2]: A = array([0,0,0])
In [3]: B = A[[0,1,2]]
In [4]: print B.base
None
In [5]: C = A[0:3]
In [6]: p
Hi,
> More importantly, it is technically impossible because of the way that
> *Python* works. See the thread "Histograms via indirect index arrays"
> for a detailed explanation.
>
> http://projects.scipy.org/pipermail/numpy-discussion/2006-March/006877.html
OK, that makes things much clearer
On 20/03/2008, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
> On Thu, Mar 20, 2008 at 06:17:44PM +, James Philbin wrote:
> > Hi,
>
> > > This cannot work, because the inplace operation does not
> > > take place as a for loop.
> > Well, this would be fine if I was assigning the values to temp
On Thu, Mar 20, 2008 at 1:35 PM, Gael Varoquaux
<[EMAIL PROTECTED]> wrote:
> On Thu, Mar 20, 2008 at 06:17:44PM +, James Philbin wrote:
> > Hi,
>
> > > This cannot work, because the inplace operation does not
> > > take place as a for loop.
> > Well, this would be fine if I was assigning
On Thu, Mar 20, 2008 at 06:17:44PM +, James Philbin wrote:
> Hi,
> > This cannot work, because the inplace operation does not
> > take place as a for loop.
> Well, this would be fine if I was assigning the values to tempories as
> you suggest. However, the operation should be performed inpla
Hi,
> This cannot work, because the inplace operation does not
> take place as a for loop.
Well, this would be fine if I was assigning the values to tempories as
you suggest. However, the operation should be performed inplace and
this is what I don't understand - why is there no for loop? I thin
On Thu, Mar 20, 2008 at 05:42:05PM +, James Philbin wrote:
> I was suprised to see this result:
> >>> import numpy as N
> >>> A = N.array([0,0,0])
> >>> A[[0,1,1,2]]+=1
> >>> A
> array([1, 1, 1])
> Is this expected? Working on the principle of least surprise I would
> expect [1,2,1] to be outp
Hi,
I was suprised to see this result:
>>> import numpy as N
>>> A = N.array([0,0,0])
>>> A[[0,1,1,2]]+=1
>>> A
array([1, 1, 1])
Is this expected? Working on the principle of least surprise I would
expect [1,2,1] to be output.
Thanks,
James
___
Numpy-d
Hi,
I was suprised to see this result:
>>> import numpy as N
>>> A = N.array([0,0,0])
>>> A[[0,1,1,2]]+=1
>>> A
array([1, 1, 1])
Is this expected? Working on the principle of least surprise I would
expect [1,2,1] to be output.
Thanks,
James
___
Numpy-d
10 matches
Mail list logo