Re: [Numpy-discussion] Correlate with small arrays

2008-03-20 Thread Robert Kern
On Thu, Mar 20, 2008 at 5:44 AM, Peter Creasey <[EMAIL PROTECTED]> wrote: > > > I'm trying to do a PDE style calculation with numpy arrays > > > > > > y = a * x[:-2] + b * x[1:-1] + c * x[2:] > > > > > > with a,b,c constants. I realise I could use correlate for this, i.e > > > > > >

Re: [Numpy-discussion] Correlate with small arrays

2008-03-20 Thread Peter Creasey
> > I'm trying to do a PDE style calculation with numpy arrays > > > > y = a * x[:-2] + b * x[1:-1] + c * x[2:] > > > > with a,b,c constants. I realise I could use correlate for this, i.e > > > > y = numpy.correlate(x, array((a, b, c))) > > The relative performance seems to vary dependi

Re: [Numpy-discussion] Correlate with small arrays

2008-03-19 Thread Robert Kern
On Wed, Mar 19, 2008 at 12:57 PM, Peter Creasey <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to do a PDE style calculation with numpy arrays > > y = a * x[:-2] + b * x[1:-1] + c * x[2:] > > with a,b,c constants. I realise I could use correlate for this, i.e > > y = numpy.correlate(x, array((

[Numpy-discussion] Correlate with small arrays

2008-03-19 Thread Peter Creasey
Hi, I'm trying to do a PDE style calculation with numpy arrays y = a * x[:-2] + b * x[1:-1] + c * x[2:] with a,b,c constants. I realise I could use correlate for this, i.e y = numpy.correlate(x, array((a, b, c))) however the performance doesn't seem as good (I suspect correlate is optimised fo