def comp_matrix(coefs):
 (p, k, k2) = coefs.shape
 assert (k == k2)
 kp = (k * p)
 result = np.zeros((kp, kp))
 result[:k] = np.concatenate(coefs, axis=1)
 if (p > 1):
  result[(np.arange(k, kp), np.arange((kp - k)))] = 1
 return result

def comp_matrix ( coefs ) : ( p , k , k2 ) = coefs . shape assert ( k == k2 ) kp = ( k * p ) result = np . zeros ( ( kp , kp ) ) result [ : k ] = np . concatenate ( coefs , axis = 1 ) if ( p > 1 ) : result [ ( np . arange ( k , kp ) , np . arange ( ( kp - k ) ) ) ] = 1 return result
return compansion matrix for the var(1) representation for a var(p) process a = [a_1 a_2 .