My goal is to vectorize the following operation in numpy,
y[n] = c1*x[n] + c2*x[n-1] + c3*y[n-1]
c1 = 1.001
c2 = -1
c3 = 1
One may use an IIR filter to do this.
scipy.signal.filter is the correct choice in this case.
For my specific constants, the following code snippet would do -
from scipy import signal inital = signal.lfiltic([1.0001,-1], [1, -1], [y_0], [x_0]) output, _ = signal.lfilter([1.0001,-1], [1, -1], input, zi=inital)
signal.lfiltic is used to to specify the initial conditions.