iterate#
- swordfish.function.iterate()#
If init, coeffs and input are all scalars, return a geometric sequence [init*coeffs, init*coeffs^2, init*coeffs^3, …]. The length of the sequence is input.
If init and coeffs are scalars and input is a vector, return an array x with x[0]=init*coeffs + input[0] and x[n]=x[n-1]* coeffs + input[n].
If init and coeffs are vectors and input is a scalar, return an array x with x[n]=y(n)** coeffs, y(n)=y(n-1)[1:].append_(x[n-1]), y(0)= init. The length of x is input. ** returns the inner product of 2 vectors.
If init, coeffs and input are all vectors, return an array x with x[n]=y(n)** coeffs + input[n], y(n)=y(n-1)[1:].append_(x[n-1]), y(0)= init. The length of x is input. ** returns the inner product of 2 vectors.
- Parameters:
init (Constant) – A scalar or a vector.
coeffs (Constant) – A scalar or a vector. init and coeffs have the same length.
input (Constant) – A scalar or a vector. If input is a scalar, it must be an integer and it means the number of iterations; if input is a vector, its length means the number of iterations and each element of input is added to the result of the corresponding iteration.