Re: [Numpy-discussion] question about in-place operations

2012-05-24 Thread Francesc Alted
On 5/22/12 9:08 PM, Massimo Di Pierro wrote: This problem is linear so probably Ram IO bound. I do not think I would benefit much for multiple cores. But I will give it a try. In the short term this is good enough for me. Yeah, this what common sense seems to indicate, that RAM IO bound

[Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo DiPierro
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

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Dag Sverre Seljebotn
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

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo DiPierro
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

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo DiPierro
For now I will be doing this: import numpy import time a=numpy.zeros(200) b=numpy.zeros(200) c=1.0 # naive solution t0 = time.time() for i in xrange(len(a)): a[i] += c*b[i] print time.time()-t0 # possible solution n=10 t0 = time.time() for i in xrange(0,len(a),n): a[i:i+n]

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Robert Kern
On Tue, May 22, 2012 at 3:47 PM, Massimo DiPierro massimo.dipie...@gmail.com wrote: 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

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo DiPierro
Thank you this does it. On May 22, 2012, at 9:59 AM, Robert Kern wrote: On Tue, May 22, 2012 at 3:47 PM, Massimo DiPierro massimo.dipie...@gmail.com wrote: Thank you. I will look into numexpr. Anyway, I do not need arbitrary expressions. If there were something like

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Dag Sverre Seljebotn
On 05/22/2012 04:54 PM, Massimo DiPierro wrote: For now I will be doing this: import numpy import time a=numpy.zeros(200) b=numpy.zeros(200) c=1.0 # naive solution t0 = time.time() for i in xrange(len(a)): a[i] += c*b[i] print time.time()-t0 # possible solution

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Francesc Alted
On 5/22/12 8:47 PM, Dag Sverre Seljebotn wrote: On 05/22/2012 04:54 PM, Massimo DiPierro wrote: For now I will be doing this: import numpy import time a=numpy.zeros(200) b=numpy.zeros(200) c=1.0 # naive solution t0 = time.time() for i in xrange(len(a)): a[i] += c*b[i]

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo Di Pierro
Thank you Dag, I will look into it. Is there any documentation about ufunc? Is this the file core/src/umath/ufunc_object.c Massimo On May 22, 2012, at 1:47 PM, Dag Sverre Seljebotn wrote: On 05/22/2012 04:54 PM, Massimo DiPierro wrote: For now I will be doing this: import numpy import

Re: [Numpy-discussion] question about in-place operations

2012-05-22 Thread Massimo Di Pierro
This problem is linear so probably Ram IO bound. I do not think I would benefit much for multiple cores. But I will give it a try. In the short term this is good enough for me. On May 22, 2012, at 1:57 PM, Francesc Alted wrote: On 5/22/12 8:47 PM, Dag Sverre Seljebotn wrote: On 05/22/2012