evaluate_static_model: fix crash under Octave with bytecode
Octave does not want to create a function handle to a nonexistent function (<MODFILE>_static.m) in that casetime-shift
parent
4e0801a92d
commit
6bfeb91e99
|
@ -38,22 +38,24 @@ function [residuals,check1,jacob] = evaluate_static_model(ys,exo_ss,params,M,opt
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
check1 = 0;
|
check1 = 0;
|
||||||
fh_static = str2func([M.fname '_static']);
|
|
||||||
if options.bytecode
|
if options.bytecode
|
||||||
[check1, residuals] = bytecode('evaluate','static',ys,...
|
[check1, residuals] = bytecode('evaluate','static',ys,...
|
||||||
exo_ss, params, ys, 1);
|
exo_ss, params, ys, 1);
|
||||||
mexErrCheck('bytecode', check1);
|
mexErrCheck('bytecode', check1);
|
||||||
elseif options.block
|
|
||||||
residuals = zeros(M.endo_nbr,1);
|
|
||||||
mfs = M.blocksMFS;
|
|
||||||
for b = 1:size(mfs,1)
|
|
||||||
mfsb = mfs{b};
|
|
||||||
% blocks that can be directly evaluated (mfsb is empty)
|
|
||||||
% have zero residuals by construction
|
|
||||||
if ~isempty(mfsb)
|
|
||||||
residuals(mfsb) = feval(fh_static,b,ys,exo_ss,params);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
residuals = feval(fh_static,ys,exo_ss,params);
|
fh_static = str2func([M.fname '_static']);
|
||||||
|
if options.block
|
||||||
|
residuals = zeros(M.endo_nbr,1);
|
||||||
|
mfs = M.blocksMFS;
|
||||||
|
for b = 1:size(mfs,1)
|
||||||
|
mfsb = mfs{b};
|
||||||
|
% blocks that can be directly evaluated (mfsb is empty)
|
||||||
|
% have zero residuals by construction
|
||||||
|
if ~isempty(mfsb)
|
||||||
|
residuals(mfsb) = feval(fh_static,b,ys,exo_ss,params);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
residuals = feval(fh_static,ys,exo_ss,params);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue