@jit
def simulate_linear_model(A, x0, v, ts_length):
 A = np.asarray(A)
 n = A.shape[0]
 x = np.empty((n, ts_length))
 x[:, 0] = x0
 for t in range((ts_length - 1)):
  for i in range(n):
   x[(i, (t + 1))] = v[(i, t)]
   for j in range(n):
    x[(i, (t + 1))] += (A[(i, j)] * x[(j, t)])
 return x

@ jit def simulate_linear_model ( A , x0 , v , ts_length ) : A = np . asarray ( A ) n = A . shape [ 0 ] x = np . empty ( ( n , ts_length ) ) x [ : , 0 ] = x0 for t in range ( ( ts_length - 1 ) ) : for i in range ( n ) : x [ ( i , ( t + 1 ) ) ] = v [ ( i , t ) ] for j in range ( n ) : x [ ( i , ( t + 1 ) ) ] += ( A [ ( i , j ) ] * x [ ( j , t ) ] ) return x
this is a separate function for simulating a vector linear system of the form x_{t+1} = a x_t + v_t given x_0 = x0 here x_t and v_t are both n x 1 and a is n x n .