Bytecode: safer handling of block= option
parent
25000ca693
commit
f6adb1d9ad
|
@ -426,7 +426,7 @@ elseif options_.bytecode
|
|||
% Also update the temporary terms vector (needed for the dynare_solve case)
|
||||
try
|
||||
[~, ~, ys, T] = bytecode(M_, options_, ys, exo_ss, params, ys, 1, ys, T, 'evaluate', 'static', ...
|
||||
'block_decomposed', ['block = ' int2str(b)]);
|
||||
'block_decomposed', ['block=' int2str(b)]);
|
||||
catch ME
|
||||
if options_.verbosity >= 1
|
||||
disp(ME.message);
|
||||
|
@ -521,5 +521,5 @@ function [r, g1] = block_bytecode_mfs_steadystate(y, b, y_all, exo, params, T, M
|
|||
% Wrapper around the static files, for bytecode with block
|
||||
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] = bytecode(M_, options_, y_all, exo, params, y_all, 1, y_all, T, 'evaluate', 'static', 'block_decomposed', ['block = ' int2str(b) ]);
|
||||
[r, g1] = bytecode(M_, options_, y_all, exo, params, y_all, 1, y_all, T, 'evaluate', 'static', 'block_decomposed', ['block=' int2str(b) ]);
|
||||
g1 = g1(:,end-M_.block_structure_stat.block(b).mfs+1:end); % Make Jacobian square if mfs>0
|
||||
|
|
|
@ -65,7 +65,6 @@ Get_Arguments_and_global_variables(int nrhs,
|
|||
bool *extended_path, mxArray **ep_struct)
|
||||
{
|
||||
int count_array_argument {0};
|
||||
size_t pos;
|
||||
*extended_path = false;
|
||||
for (int i = 0; i < nrhs; i++)
|
||||
{
|
||||
|
@ -132,15 +131,16 @@ Get_Arguments_and_global_variables(int nrhs,
|
|||
print = true;
|
||||
else
|
||||
{
|
||||
pos = 0;
|
||||
if (Get_Argument(prhs[i]).substr(0, 5) == "block")
|
||||
if (Get_Argument(prhs[i]).substr(0, 6) == "block=")
|
||||
{
|
||||
size_t pos1 = Get_Argument(prhs[i]).find("=", pos + 5);
|
||||
if (pos1 != string::npos)
|
||||
pos = pos1 + 1;
|
||||
else
|
||||
pos += 5;
|
||||
block = atoi(Get_Argument(prhs[i]).substr(pos, string::npos).c_str())-1;
|
||||
try
|
||||
{
|
||||
block = stoi(Get_Argument(prhs[i]).substr(6))-1;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw FatalException{"ERROR: incorrect syntax for the 'block=' option"};
|
||||
}
|
||||
}
|
||||
else if (Get_Argument(prhs[i]).substr(0, 13) == "extended_path")
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue