I have the following problem. There is a matrix X and I need to generate a matrix H such that values of i_th row in matrix H are determined by i_th row of the matrix X and (i-1)_th row of matrix H.
H_{i} = F(X_{i}, H_{i-1})
To calculate the first row of matrix H we use a special out-of-the-matrix row (row zero, so to say).
Is there a way to implement this recurrence efficiently, in a vectorized form, without using for loops?
F, really. I doubt there is a general method.vectoris introduced as a way of thread the coordinates of a point as one object as opposed to 3 numbers. That idea carries over intonumpy. In proper vectorization we don't usually care about the order of evaluation -numpyis supposed take care of those details. So a calculation that depends on the order of evaluation doesn't neatly fit. Operations likecumsumare closest we get to a compiled sequential operation.