def constrain_stationary_multivariate_python(unconstrained, error_variance, transform_variance=False, prefix=None):
 use_list = (type(unconstrained) == list)
 if (not use_list):
  (k_endog, order) = unconstrained.shape
  order //= k_endog
  unconstrained = [unconstrained[:k_endog, (i * k_endog):((i + 1) * k_endog)] for i in range(order)]
 order = len(unconstrained)
 k_endog = unconstrained[0].shape[0]
 sv_constrained = _constrain_sv_less_than_one_python(unconstrained, order, k_endog)
 (constrained, var) = _compute_coefficients_from_multivariate_pacf_python(sv_constrained, error_variance, transform_variance, order, k_endog)
 if (not use_list):
  constrained = np.concatenate(constrained, axis=1).reshape(k_endog, (k_endog * order))
 return (constrained, var)

def constrain_stationary_multivariate_python ( unconstrained , error_variance , transform_variance = False , prefix = None ) : use_list = ( type ( unconstrained ) == list ) if ( not use_list ) : ( k_endog , order ) = unconstrained . shape order //= k_endog unconstrained = [ unconstrained [ : k_endog , ( i * k_endog ) : ( ( i + 1 ) * k_endog ) ] for i in range ( order ) ] order = len ( unconstrained ) k_endog = unconstrained [ 0 ] . shape [ 0 ] sv_constrained = _constrain_sv_less_than_one_python ( unconstrained , order , k_endog ) ( constrained , var ) = _compute_coefficients_from_multivariate_pacf_python ( sv_constrained , error_variance , transform_variance , order , k_endog ) if ( not use_list ) : constrained = np . concatenate ( constrained , axis = 1 ) . reshape ( k_endog , ( k_endog * order ) ) return ( constrained , var )
transform unconstrained parameters used by the optimizer to constrained parameters used in likelihood evaluation for a vector autoregression .