[Numpy-discussion] question about in-place operations

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


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.

Massimo




More information about the NumPy-Discussion mailing list