On Thu, Jun 28, 2012 at 7:04 PM, Chris Barker wrote:
> On Thu, Jun 28, 2012 at 9:06 AM, Pierre Haessig
>
>> On the other hand, just like srean mentionned, I think I also misused
>> the "c[:] = a+b" syntax.
>> I feel it's a bit confusing since this way of writing the assignment
>> really feels like
On Thu, Jun 28, 2012 at 9:06 AM, Pierre Haessig
> On the other hand, just like srean mentionned, I think I also misused
> the "c[:] = a+b" syntax.
> I feel it's a bit confusing since this way of writing the assignment
> really feels likes it happens inplace. Good to know it's not the case.
well,
Hi,
Le 28/06/2012 15:35, Travis Oliphant a écrit :
> It really is inplace. As Nathaniel mentioned --- all ufuncs take an out
> keyword.
>
> The inplace mechanism uses this so that one input and the output are the same.
Thanks for the feedback about inplace assignment.
On the other hand, just
Hi Nathaniel,
Thanks for the clearing my understand. This is exactly what i needed.
Thanks,
Nathaniel Smith wrote:
>
> On Thu, Jun 28, 2012 at 12:38 AM, astronomer
> wrote:
>>
>> Hi All,
>> I am wondering if there any difference in memory overhead between the
>> following code.
>> a=numpy.ara
--
Travis Oliphant
(on a mobile)
512-826-7480
On Jun 28, 2012, at 1:20 AM, Pierre Haessig wrote:
> Le 28/06/2012 02:34, Nathaniel Smith a écrit :
>>
>> Yes it does. If you want to avoid this extra copy, and have a
>> pre-existing output array, you can do:
>>
>> np.add(a, b, out=c)
> And is
Yes, the creation of the tmp *is* the creation of a new NumPy array. So, it
is as expensive.
Travis
--
Travis Oliphant
(on a mobile)
512-826-7480
On Jun 28, 2012, at 12:44 AM, srean wrote:
>> Yes it does. If you want to avoid this extra copy, and have a
>> pre-existing output array, you c
Le 28/06/2012 02:34, Nathaniel Smith a écrit :
> Yes it does. If you want to avoid this extra copy, and have a
> pre-existing output array, you can do:
>
> np.add(a, b, out=c)
And is there a temporary copy when using inplace operators like:
c = a.copy()
c += b
Is there a temporary (c+b) array wh
> Yes it does. If you want to avoid this extra copy, and have a
> pre-existing output array, you can do:
>
> np.add(a, b, out=c)
>
> ('+' on numpy array's is just a synonym for np.add; np.add is a ufunc,
> and all ufunc's accept this syntax:
> http://docs.scipy.org/doc/numpy/reference/ufuncs.html
On Thu, Jun 28, 2012 at 12:38 AM, astronomer wrote:
>
> Hi All,
> I am wondering if there any difference in memory overhead between the
> following code.
> a=numpy.arange(10)
> b=numpy.arange(10)
> c=a+b
>
> and
> a=numpy.arange(10)
> b=numpy.arange(10)
> c=numpy.empty_likes(a)
> c[:]=a+b
>
> Does
Hi All,
I am wondering if there any difference in memory overhead between the
following code.
a=numpy.arange(10)
b=numpy.arange(10)
c=a+b
and
a=numpy.arange(10)
b=numpy.arange(10)
c=numpy.empty_likes(a)
c[:]=a+b
Does the later code make a temproray array for the result of (a+b) and then
copy it
10 matches
Mail list logo