Commit 8cb51e26 authored by Sébastien Villemot's avatar Sébastien Villemot

options_.instruments is now a cell array

This fixes crashes under Octave (while MATLAB seems to accept array-indexing
with cell arrays).
parent 460dba40
......@@ -336,7 +336,7 @@ options_.conditional_variance_decomposition = [];
% Ramsey policy
options_.ramsey_policy = 0;
options_.instruments = [];
options_.instruments = {};
options_.timeless = 0;
options_.ramsey.maxit = 500;
......
......@@ -115,7 +115,7 @@ end
instr_id=nan(instr_nbr,1);
for j=1:instr_nbr
vj=deblank(Instruments(j,:));
vj=deblank(Instruments{j});
vj_id=strmatch(vj, endo_names, 'exact');
if ~isempty(vj_id)
instr_id(j)=vj_id;
......
......@@ -50,7 +50,7 @@ elseif options_.steadystate_flag
k_inst = [];
inst_nbr = size(options_.instruments,1);
for i = 1:inst_nbr
k_inst = [k_inst; strmatch(options_.instruments(i,:), M.endo_names, 'exact')];
k_inst = [k_inst; strmatch(options_.instruments{i}, M.endo_names, 'exact')];
end
if inst_nbr == 1
%solve for instrument, using univariate solver, starting at initial value for instrument
......@@ -112,7 +112,7 @@ if options_.steadystate_flag
k_inst = [];
instruments = options_.instruments;
for i = 1:size(instruments,1)
k_inst = [k_inst; strmatch(instruments(i,:), endo_names, 'exact')];
k_inst = [k_inst; strmatch(instruments{i}, endo_names, 'exact')];
end
ys_init=zeros(size(oo.steady_state)); %create starting vector for steady state computation as only instrument value is handed over
ys_init(k_inst) = x; %set instrument, the only value required for steady state computation, to current value
......
......@@ -66,7 +66,7 @@ if options.ramsey_policy
fprintf('\nevaluate_steady_state: The steady state file computation for the Ramsey problem resulted in NaNs.\n')
fprintf('evaluate_steady_state: The steady state was computed conditional on the following initial instrument values: \n')
for ii = 1:size(options.instruments,1)
fprintf('\t %s \t %f \n',options.instruments(ii,:),ys_init(strmatch(options.instruments(ii,:),M.endo_names,'exact')))
fprintf('\t %s \t %f \n',options.instruments{ii},ys_init(strmatch(options.instruments{ii},M.endo_names,'exact')))
end
fprintf('evaluate_steady_state: The problem occured in the following equations: \n')
fprintf('\t Equation(s): ')
......@@ -87,7 +87,7 @@ if options.ramsey_policy
fprintf('\nevaluate_steady_state: The steady state file computation for the Ramsey problem resulted in complex numbers.\n')
fprintf('evaluate_steady_state: The steady state was computed conditional on the following initial instrument values: \n')
for ii = 1:size(options.instruments,1)
fprintf('\t %s \t %f \n',options.instruments(ii,:),ys_init(strmatch(options.instruments(ii,:),M.endo_names,'exact')))
fprintf('\t %s \t %f \n',options.instruments{ii},ys_init(strmatch(options.instruments{ii},M.endo_names,'exact')))
end
fprintf('evaluate_steady_state: If those initial values are not admissable, change them using an initval-block.\n')
skipline(2)
......@@ -102,7 +102,7 @@ if options.ramsey_policy
fprintf('\nevaluate_steady_state: The steady state file does not solve the steady state for the Ramsey problem.\n')
fprintf('evaluate_steady_state: Conditional on the following instrument values: \n')
for ii = 1:size(options.instruments,1)
fprintf('\t %s \t %f \n',options.instruments(ii,:),ys_init(strmatch(options.instruments(ii,:),M.endo_names,'exact')))
fprintf('\t %s \t %f \n',options.instruments{ii},ys_init(strmatch(options.instruments{ii},M.endo_names,'exact')))
end
fprintf('evaluate_steady_state: the following equations have non-zero residuals: \n')
for ii=n_multipliers+1:M.endo_nbr
......@@ -150,7 +150,7 @@ if options.ramsey_policy
fprintf('\nevaluate_steady_state: The steady state computation for the Ramsey problem resulted in NaNs.\n')
fprintf('evaluate_steady_state: The steady state computation resulted in the following instrument values: \n')
for i = 1:size(options.instruments,1)
fprintf('\t %s \t %f \n',options.instruments(i,:),ys(strmatch(options.instruments(i,:),M.endo_names,'exact')))
fprintf('\t %s \t %f \n',options.instruments{i},ys(strmatch(options.instruments{i},M.endo_names,'exact')))
end
fprintf('evaluate_steady_state: The problem occured in the following equations: \n')
fprintf('\t Equation(s): ')
......@@ -168,7 +168,7 @@ if options.ramsey_policy
fprintf('\nevaluate_steady_state: The steady state computation for the Ramsey problem resulted in NaNs in the auxiliary equations.\n')
fprintf('evaluate_steady_state: The steady state computation resulted in the following instrument values: \n')
for i = 1:size(options.instruments,1)
fprintf('\t %s \t %f \n',options.instruments(i,:),ys(strmatch(options.instruments(i,:),M.endo_names,'exact')))
fprintf('\t %s \t %f \n',options.instruments{i},ys(strmatch(options.instruments{i},M.endo_names,'exact')))
end
fprintf('evaluate_steady_state: The problem occured in the following equations: \n')
fprintf('\t Auxiliary equation(s): ')
......@@ -186,7 +186,7 @@ if options.ramsey_policy
fprintf('\nevaluate_steady_state: The steady state for the Ramsey problem could not be computed.\n')
fprintf('evaluate_steady_state: The steady state computation stopped with the following instrument values:: \n')
for i = 1:size(options.instruments,1)
fprintf('\t %s \t %f \n',options.instruments(i,:),ys(strmatch(options.instruments(i,:),M.endo_names,'exact')))
fprintf('\t %s \t %f \n',options.instruments{i},ys(strmatch(options.instruments{i},M.endo_names,'exact')))
end
fprintf('evaluate_steady_state: The following equations have non-zero residuals: \n')
for ii=1:n_multipliers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment