@@ -1046,7 +1029,7 @@ SparseMatrix::simulate_NG(int blck, int y_size, int it_, int y_kmin, int y_kmax,
else
mexPrintf(" variable %d at time %d = %f direction = %f\n",j+1,it_,y[j+it_*y_size],direction[j+it_*y_size]);
}
mexPrintf("res1=%5.25\n",res1);
mexPrintf("res1=%5.10f\n",res1);
mexPrintf("The initial values of endogenous variables are too far from the solution.\n");
mexPrintf("Change them!\n");
mexEvalString("drawnow;");
...
...
@@ -1063,35 +1046,40 @@ SparseMatrix::simulate_NG(int blck, int y_size, int it_, int y_kmin, int y_kmax,
mexErrMsgTxt(filename.c_str());
}
}
if(slowc_save<1e-8)
if(fabs(slowc_save)<1e-8)
{
for(j=0;j<y_size;j++)
{
boolselect=false;
for(inti=0;i<Size;i++)
if(j==index_vara[i])
{
select=true;
break;
}
if(select)
mexPrintf("-> variable %d at time %d = %f direction = %f\n",j+1,it_,y[j+it_*y_size],direction[j+it_*y_size]);
else
mexPrintf(" variable %d at time %d = %f direction = %f\n",j+1,it_,y[j+it_*y_size],direction[j+it_*y_size]);
}
mexPrintf("Dynare cannot improve the simulation in block %d at time %d (variable %d)\n",blck+1,it_+1,max_res_idx);
mexEvalString("drawnow;");
mxFree(piv_v);
mxFree(pivj_v);
mxFree(pivk_v);
mxFree(NR);
if(steady_state)
returnfalse;
if(slowc_save>0)
slowc_save=-slowc;
else
{
mexEvalString("st=fclose('all');clear all;");
filename+=" stopped";
mexErrMsgTxt(filename.c_str());
for(j=0;j<y_size;j++)
{
boolselect=false;
for(inti=0;i<Size;i++)
if(j==index_vara[i])
{
select=true;
break;
}
if(select)
mexPrintf("-> variable %d at time %d = %f direction = %f\n",j+1,it_,y[j+it_*y_size],direction[j+it_*y_size]);
else
mexPrintf(" variable %d at time %d = %f direction = %f\n",j+1,it_,y[j+it_*y_size],direction[j+it_*y_size]);
}
mexPrintf("Dynare cannot improve the simulation in block %d at time %d (variable %d)\n",blck+1,it_+1,max_res_idx);
mexEvalString("drawnow;");
mxFree(piv_v);
mxFree(pivj_v);
mxFree(pivk_v);
mxFree(NR);
if(steady_state)
returnfalse;
else
{
mexEvalString("st=fclose('all');clear all;");
filename+=" stopped";
mexErrMsgTxt(filename.c_str());
}
}
}
slowc_save/=2;
...
...
@@ -1484,8 +1472,8 @@ SparseMatrix::simulate_NG1(int blck, int y_size, int it_, int y_kmin, int y_kmax
{
mexPrintf("slowc_save=%g\n",slowc_save);
for(j=0;j<y_size;j++)
mexPrintf("variable %d at time %d = %f\n",j+1,it_,y[j+it_*y_size]);
mexPrintf("Dynare cannot improve the simulation in block %d at time %d (variable %d)\n",blck+1,it_+1,max_res_idx);
mexPrintf("variable %d at time %d = %f direction = %f variable at last step = %f b = %f\n",j+1,it_+1,y[j+it_*y_size],direction[j+it_*y_size],ya[j+it_*y_size],u[pivot[j+it_*y_size]]);
mexPrintf("Dynare cannot improve the simulation in block %d at time %d (variable %d max_res = %f, res1 = %f)\n",blck+1,it_+1,max_res_idx,max_res,res1);