% computes the steady state of dog.mod (growthless deterministic growth model). 
% stephane [DOT] adjemian [AT] ens [DOT] fr

function [ys,check] = uribefinanssfile_steadystate(ys,exe)
global M_lgy_

%% DO NOT CHANGE THIS PART.
%%
%% Here we load the values of the deep parameters in a loop.
%%
if isfield(M_,'param_nbr') == 1
    NumberOfParameters = M_.param_nbr;                            % Number of deep parameters.
for i = 1:NumberOfParameters                                  % Loop...
  paramname = deblank(M_.param_names(i,:));                   %    Get the name of parameter i. 
  eval([ paramname ' = M_.params(' int2str(i) ');']);         %    Get the value of parameter i.
end                                                           % End of the loop.  
check = 0;
end
%%
%% END OF THE FIRST MODEL INDEPENDENT BLOCK.


%% THIS BLOCK IS MODEL SPECIFIC.
%%
%% Here the user has to define the steady state.
%%
rstar  = ((1/beta)*(gd^(gamma)))-1; % world interest rate
k_over_ghss=((((gd^(gamma))/beta)-1+delta)/alpha)^(1/(alpha-1)); %(K/GH) from egn 4                                              // productivity shock 
hss= (((1-alpha)* gd * ((k_over_ghss)^alpha ))/ theta)^(1/(w-1));  %hours
kss = k_over_ghss * gd * hss;                                 %capital

yss= (kss^(alpha)) * ((hss*gd)^(1-alpha));               %output
iss = kss*(gd-1+delta);                                   
css = ((gd/(1+rstar))-1) * dbar + yss - iss-sd;                    
lamdass=(css-theta*(w^(-1))*hss^(w))^(-gamma);    
tbss=yss-css-iss-sd;
sd= yss*share_s;

d  = dbar;                                              
r  = rstar;                                            
g  = gd;                                               
a  = 1;  
mu = 1;
v  = 1;
s = sd;
k_over_gh=  k_over_ghss ;                                        
h = hss;
k =kss ;                         


lamda=lamdass;
y= yss;                
i=iss;
c=css;
tb=tbss;
tby=tbss/yss;

gy=gd;
gc=gd;
gi=gd;



%%
%% END OF THE MODEL SPECIFIC BLOCK.


%% DO NOT CHANGE THIS PART.
%%
%% Here we define the steady state values of the endogenous variables of
%% the model.
%%

for iter = 1:length(M_.params)
  eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])
end

if isfield(M_,'param_nbr') == 1

if isfield(M_,'orig_endo_nbr') == 1
NumberOfEndogenousVariables = M_.orig_endo_nbr;
else
NumberOfEndogenousVariables = M_.endo_nbr;                   % Number of endogenous variables.
end
ys = zeros(NumberOfEndogenousVariables,1);                   % Initialization of ys (steady state).
for i = 1:NumberOfEndogenousVariables                        % Loop...
  varname = deblank(M_.endo_names(i,:));                     % Get the name of endogenous variable i
  eval(['ys(' int2str(i) ') = ' varname ';']);               % Get the steady state value of this variable.
end                                                          % End of the loop.
else
ys=zeros(length(lgy_),1);
for i = 1:length(lgy_)
    ys(i) = eval(lgy_(i,:));
end
check = 0;
end
end

%%
%% END OF THE SECOND MODEL INDEPENDENT BLOCK.