[Numpy-discussion] question about in-place operations

Massimo DiPierro massimo.dipierro at gmail.com
Tue May 22 10:47:35 EDT 2012


Thank you. I will look into numexpr. 

Anyway, I do not need arbitrary expressions. If there were something like

numpy.add_scaled(a,scale,b)

with support for scale in int, float, complex, this would be sufficient for me.

Massimo

On May 22, 2012, at 9:32 AM, Dag Sverre Seljebotn wrote:

> On 05/22/2012 04:25 PM, Massimo DiPierro wrote:
>> hello everybody,
>> 
>> first of all thanks to the developed for bumpy which is very useful. I am building a software that uses numpy+pyopencl for lattice qcd computations. One problem that I am facing is that I need to perform most operations on arrays in place and I must avoid creating temporary arrays (because my arrays are many gigabyte large).
>> 
>> One typical operation is this
>> 
>> a[i] += const * b[i]
>> 
>> What is the efficient way to do is when a and b are arbitrary arrays?  const is usually a complex number.
>> a and b have the same shape but are not necessarily uni-dimensional.
> 
> I don't think NumPy support this; if you can't modify b[i] in-place, I 
> think your only option will be one of numexpr/Theano/Cython.
> 
> Dag
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion




More information about the NumPy-Discussion mailing list