Preprocessor: actually obey the “mfs” option for the static model
As a consequence, fix steady state computation when mfs > 0.silicon
parent
8200c356a7
commit
cfaf5a685d
|
@ -361,20 +361,19 @@ elseif ~options.bytecode && options.block
|
||||||
fh_static = str2func(sprintf('%s.sparse.block.static_%d', M.fname, b));
|
fh_static = str2func(sprintf('%s.sparse.block.static_%d', M.fname, b));
|
||||||
if M.block_structure_stat.block(b).Simulation_Type ~= 1 && ...
|
if M.block_structure_stat.block(b).Simulation_Type ~= 1 && ...
|
||||||
M.block_structure_stat.block(b).Simulation_Type ~= 2
|
M.block_structure_stat.block(b).Simulation_Type ~= 2
|
||||||
|
mfs_idx = M.block_structure_stat.block(b).variable(end-M.block_structure_stat.block(b).mfs+1:end);
|
||||||
if options.solve_algo <= 4 || options.solve_algo >= 9
|
if options.solve_algo <= 4 || options.solve_algo >= 9
|
||||||
[z, errorflag] = dynare_solve(@block_mfs_steadystate, ...
|
[ys(mfs_idx), errorflag] = dynare_solve(@block_mfs_steadystate, ys(mfs_idx), ...
|
||||||
ys(M.block_structure_stat.block(b).variable), ...
|
options.simul.maxit, options.solve_tolf, options.solve_tolx, ...
|
||||||
options.simul.maxit, options.solve_tolf, options.solve_tolx, ...
|
options, fh_static, b, ys, exo_ss, params, T, M);
|
||||||
options, fh_static, b, ys, exo_ss, params, T, M);
|
|
||||||
if errorflag
|
if errorflag
|
||||||
check = 1;
|
check = 1;
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
ys(M.block_structure_stat.block(b).variable) = z;
|
|
||||||
else
|
else
|
||||||
n = length(M.block_structure_stat.block(b).variable);
|
nze = length(M.block_structure_stat.block(b).g1_sparse_rowval);
|
||||||
[ys, T, ~, info2] = solve_one_boundary(fh_static, ys, exo_ss, ...
|
[ys, T, ~, info2] = solve_one_boundary(fh_static, ys, exo_ss, ...
|
||||||
params, [], T, M.block_structure_stat.block(b).variable, n, 1, false, b, 0, options.simul.maxit, ...
|
params, [], T, mfs_idx, nze, 1, false, b, 0, options.simul.maxit, ...
|
||||||
options.solve_tolf, ...
|
options.solve_tolf, ...
|
||||||
0, options.solve_algo, true, false, false, M, options, []);
|
0, options.solve_algo, true, false, false, M, options, []);
|
||||||
if info2
|
if info2
|
||||||
|
@ -407,15 +406,15 @@ elseif options.bytecode
|
||||||
for b = 1:length(M.block_structure_stat.block)
|
for b = 1:length(M.block_structure_stat.block)
|
||||||
if M.block_structure_stat.block(b).Simulation_Type ~= 1 && ...
|
if M.block_structure_stat.block(b).Simulation_Type ~= 1 && ...
|
||||||
M.block_structure_stat.block(b).Simulation_Type ~= 2
|
M.block_structure_stat.block(b).Simulation_Type ~= 2
|
||||||
[z, errorflag] = dynare_solve(@block_bytecode_mfs_steadystate, ...
|
mfs_idx = M.block_structure_stat.block(b).variable(end-M.block_structure_stat.block(b).mfs+1:end);
|
||||||
ys(M.block_structure_stat.block(b).variable), ...
|
[ys(mfs_idx), errorflag] = dynare_solve(@block_bytecode_mfs_steadystate, ...
|
||||||
options.simul.maxit, options.solve_tolf, options.solve_tolx, ...
|
ys(mfs_idx), options.simul.maxit, ...
|
||||||
options, b, ys, exo_ss, params, T, M);
|
options.solve_tolf, options.solve_tolx, ...
|
||||||
|
options, b, ys, exo_ss, params, T, M);
|
||||||
if errorflag
|
if errorflag
|
||||||
check = 1;
|
check = 1;
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
ys(M.block_structure_stat.block(b).variable) = z;
|
|
||||||
end
|
end
|
||||||
% Compute endogenous if the block is of type evaluate forward/backward or if there are recursive variables in a solve block.
|
% Compute endogenous if the block is of type evaluate forward/backward or if there are recursive variables in a solve block.
|
||||||
% Also update the temporary terms vector (needed for the dynare_solve case)
|
% Also update the temporary terms vector (needed for the dynare_solve case)
|
||||||
|
@ -496,13 +495,14 @@ jac = j(eq_index,1:nvar);
|
||||||
|
|
||||||
function [r, g1] = block_mfs_steadystate(y, fh_static, b, y_all, exo, params, T, M)
|
function [r, g1] = block_mfs_steadystate(y, fh_static, b, y_all, exo, params, T, M)
|
||||||
% Wrapper around the static files, for block without bytecode
|
% Wrapper around the static files, for block without bytecode
|
||||||
y_all(M.block_structure_stat.block(b).variable) = y;
|
mfs_idx = M.block_structure_stat.block(b).variable(end-M.block_structure_stat.block(b).mfs+1:end);
|
||||||
|
y_all(mfs_idx) = y;
|
||||||
[~,~,r,g1] = fh_static(y_all, exo, params, M.block_structure_stat.block(b).g1_sparse_rowval, ...
|
[~,~,r,g1] = fh_static(y_all, exo, params, M.block_structure_stat.block(b).g1_sparse_rowval, ...
|
||||||
M.block_structure_stat.block(b).g1_sparse_colval, ...
|
M.block_structure_stat.block(b).g1_sparse_colval, ...
|
||||||
M.block_structure_stat.block(b).g1_sparse_colptr, T);
|
M.block_structure_stat.block(b).g1_sparse_colptr, T);
|
||||||
|
|
||||||
function [r, g1] = block_bytecode_mfs_steadystate(y, b, y_all, exo, params, T, M)
|
function [r, g1] = block_bytecode_mfs_steadystate(y, b, y_all, exo, params, T, M)
|
||||||
% Wrapper around the static files, for block without bytecode
|
% Wrapper around the static files, for block without bytecode
|
||||||
indx = M.block_structure_stat.block(b).variable;
|
mfs_idx = M.block_structure_stat.block(b).variable(end-M.block_structure_stat.block(b).mfs+1:end);
|
||||||
y_all(indx) = y;
|
y_all(mfs_idx) = y;
|
||||||
[r, g1] = bytecode(y_all, exo, params, y_all, 1, y_all, T, 'evaluate', 'static', 'block_decomposed', ['block = ' int2str(b) ]);
|
[r, g1] = bytecode(y_all, exo, params, y_all, 1, y_all, T, 'evaluate', 'static', 'block_decomposed', ['block = ' int2str(b) ]);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4bba274f3931222df89f3a04b016340f6b2222df
|
Subproject commit 7db02b23e9408983758bb38ba844b4959670b8b5
|
Loading…
Reference in New Issue