Commit 7b990f45 authored by ferhat's avatar ferhat
Browse files

The sparse option in model is now compatible with homotopy => preprocessor commit

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2588 ac1d8469-bf42-47a9-8791-bf33cf982152
parent dca1c2c8
......@@ -619,6 +619,7 @@ BlockTriangular::Normalize_and_BlockDecompose(bool* IM, Model_Block* ModelBlock,
for (i = 0;i < n;i++)
cout << "Index_Var_IM[" << i << "]=" << Index_Var_IM[i].index << " Index_Equ_IM[" << i << "]=" << Index_Equ_IM[i].index << "\n";
}
int counted=0;
if (*prologue+*epilogue<n)
{
if (Do_Normalization)
......@@ -673,7 +674,9 @@ BlockTriangular::Normalize_and_BlockDecompose(bool* IM, Model_Block* ModelBlock,
}
suppressed=suppress;
if (!OK)
bi/=1.07;
//bi/=1.07;
bi/=3;
counted++;
if (bi>1e-14)
free(SIM00);
}
......@@ -691,6 +694,7 @@ BlockTriangular::Normalize_and_BlockDecompose(bool* IM, Model_Block* ModelBlock,
else
normalization.Gr_to_IM_basic(n, *prologue, *epilogue, IM, Equation_gr, false);
}
//cout << "Finding the optimal block decomposition of the model ..." << counted << "\n";
cout << "Finding the optimal block decomposition of the model ...\n";
if (*prologue+*epilogue<n)
{
......
......@@ -47,7 +47,8 @@ void
SteadySparseStatement::writeOutput(ostream &output, const string &basename) const
{
options_list.writeOutput(output);
output << basename << "_static;\n";
//output << basename << "_static;\n";
output << "steady;\n";
}
CheckStatement::CheckStatement(const OptionsList &options_list_arg) :
......
......@@ -2060,7 +2060,7 @@ ModelTree::writeSparseStaticMFile(const string &static_basename, const string &b
{
mStaticModelFile << " end\n";
}
mStaticModelFile << " y=" << static_basename << "_" << i + 1 << "(y, x, params, 0);\n";
mStaticModelFile << " y = " << static_basename << "_" << i + 1 << "(y, x, params, 0);\n";
}
open_par=false;
}
......@@ -2084,10 +2084,15 @@ ModelTree::writeSparseStaticMFile(const string &static_basename, const string &b
int nze, m;
for (nze=0,m=0;m<=block_triangular.ModelBlock->Block_List[i].Max_Lead+block_triangular.ModelBlock->Block_List[i].Max_Lag;m++)
nze+=block_triangular.ModelBlock->Block_List[i].IM_lead_lag[m].size;
mStaticModelFile << " y = solve_one_boundary('" << static_basename << "_" << i + 1 << "'" <<
mStaticModelFile << " [y, info] = solve_one_boundary('" << static_basename << "_" << i + 1 << "'" <<
", y, x, params, y_index, " << nze <<
", 1, " << block_triangular.ModelBlock->Block_List[i].is_linear <<
", " << Blck_Num << ", y_kmin, options_.maxit_, options_.solve_tolf, options_.slowc, options_.cutoff, options_.simulation_method, 1, 0, 0);\n";
mStaticModelFile << " if(info<=0)\n"
<< " varagout(2) = 0;\n"
<< " varagout(1) = i+1;\n"
<< " return;\n"
<< " end;\n";
}
prev_Simulation_Type=k;
......@@ -2098,9 +2103,11 @@ ModelTree::writeSparseStaticMFile(const string &static_basename, const string &b
mStaticModelFile << " if isempty(ys0_)\n";
mStaticModelFile << " oo_.endo_simul(:,1:M_.maximum_lag) = oo_.steady_state * ones(1,M_.maximum_lag);\n";
mStaticModelFile << " end;\n";
mStaticModelFile << " disp('Steady State value');\n";
mStaticModelFile << " disp([strcat(M_.endo_names,' : ') num2str(oo_.steady_state,'%f')]);\n";
mStaticModelFile << " varargout{2}=0;\n";
mStaticModelFile << " if(~options_.homotopy_mode)\n";
mStaticModelFile << " disp('Steady State value');\n";
mStaticModelFile << " disp([strcat(M_.endo_names,' : ') num2str(oo_.steady_state,'%f')]);\n";
mStaticModelFile << " end;\n";
mStaticModelFile << " varargout{2}=info;\n";
mStaticModelFile << " varargout{1}=oo_.steady_state;\n";
mStaticModelFile << "return;\n";
writeModelStaticEquationsOrdered_M(block_triangular.ModelBlock, static_basename);
......
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