def constrain_stationary_univariate(unconstrained):
 n = unconstrained.shape[0]
 y = np.zeros((n, n), dtype=unconstrained.dtype)
 r = (unconstrained / ((1 + (unconstrained ** 2)) ** 0.5))
 for k in range(n):
  for i in range(k):
   y[(k, i)] = (y[((k - 1), i)] + (r[k] * y[((k - 1), ((k - i) - 1))]))
  y[(k, k)] = r[k]
 return (- y[(n - 1), :])

def constrain_stationary_univariate ( unconstrained ) : n = unconstrained . shape [ 0 ] y = np . zeros ( ( n , n ) , dtype = unconstrained . dtype ) r = ( unconstrained / ( ( 1 + ( unconstrained ** 2 ) ) ** 0.5 ) ) for k in range ( n ) : for i in range ( k ) : y [ ( k , i ) ] = ( y [ ( ( k - 1 ) , i ) ] + ( r [ k ] * y [ ( ( k - 1 ) , ( ( k - i ) - 1 ) ) ] ) ) y [ ( k , k ) ] = r [ k ] return ( - y [ ( n - 1 ) , : ] )
transform unconstrained parameters used by the optimizer to constrained parameters used in likelihood evaluation parameters unconstrained : array unconstrained parameters used by the optimizer .