# ==========================================================================
# SOLVE_SGU.m
#
#Solve Log-Linearized model using SGU algorithm.
#
#This program computes a first-order  approximation to the policy functions
#of the New Keynesian Model in ACS(2017) using SGU Toolbox.
#
#The equilibrium conditions of the model can be written as: %E_t[f(yp,y,xp,x)=0,
#The solution is of the form
#xp = h(x,sigma) + sigma* eta * ep
#y = g(x,sigma)
#
# DEFINITIONS:
# nx = Number of state variables (endogenous + exogenous)
# ny = Number of control variables
# ne = Number of exogenous shocks
#
# MATRIX DIMENSIONS:
# hx is nx by nx
# gx is ny by nx
# eta is nx by ne
# gss is ny by 1
# hss is nx by 1
# sigma is a positive scalar
#
#
# Written by: Pablo Cuba-Borda, Federal Reserve Board
# Created: November 17, 2017. Washington D.C.
# Lat edited: December 30, 2017.
# ==========================================================================

function solve_sgu(params_in::Dict{String}{Float64})

# Compute derivatives of f (equilibrium conditions)
nfx, nfxp, nfy, nfyp =  get_order1_sgu(params_in);

#Compute first-order approximation
gx,hx = gx_hx(nfy,nfx,nfyp,nfxp);

return gx,hx
end
