* Added new option stack_solve_algo to simul
* Added solve_algo=5 for steady * Remove obsolete method option of simul * Added various checks to avoid unimplemented combinations of bytecode/block/solve_algo/stack_solve_algo git-svn-id: https://www.dynare.org/svn/dynare/trunk@2882 ac1d8469-bf42-47a9-8791-bf33cf982152issue#70
parent
ceae389dff
commit
5dc82b4eed
|
@ -1483,12 +1483,14 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
|
|||
mDynamicModelFile << " return;\n";
|
||||
mDynamicModelFile << " end;\n";
|
||||
mDynamicModelFile << " %it is the deterministic simulation of the block decomposed dynamic model\n";
|
||||
mDynamicModelFile << " if(options_.simulation_method==0)\n";
|
||||
mDynamicModelFile << " if(options_.stack_solve_algo==1)\n";
|
||||
mDynamicModelFile << " mthd='Sparse LU';\n";
|
||||
mDynamicModelFile << " elseif(options_.simulation_method==2)\n";
|
||||
mDynamicModelFile << " elseif(options_.stack_solve_algo==2)\n";
|
||||
mDynamicModelFile << " mthd='GMRES';\n";
|
||||
mDynamicModelFile << " elseif(options_.simulation_method==3)\n";
|
||||
mDynamicModelFile << " elseif(options_.stack_solve_algo==3)\n";
|
||||
mDynamicModelFile << " mthd='BICGSTAB';\n";
|
||||
mDynamicModelFile << " elseif(options_.stack_solve_algo==4)\n";
|
||||
mDynamicModelFile << " mthd='OPTIMPATH';\n";
|
||||
mDynamicModelFile << " else\n";
|
||||
mDynamicModelFile << " mthd='UNKNOWN';\n";
|
||||
mDynamicModelFile << " end;\n";
|
||||
|
@ -1594,7 +1596,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
|
|||
mDynamicModelFile << " y = solve_one_boundary('" << dynamic_basename << "_" << i + 1 << "'" <<
|
||||
", y, x, params, y_index, " << nze <<
|
||||
", options_.periods, " << 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, 1, 0);\n";
|
||||
", blck_num, y_kmin, options_.maxit_, options_.solve_tolf, options_.slowc, options_.cutoff, options_.stack_solve_algo, 1, 1, 0);\n";
|
||||
mDynamicModelFile << " tmp = y(:,M_.block_structure.block(" << i + 1 << ").variable);\n";
|
||||
mDynamicModelFile << " if(isnan(tmp) | isinf(tmp))\n";
|
||||
mDynamicModelFile << " disp(['Inf or Nan value during the resolution of block " << i <<"']);\n";
|
||||
|
@ -1625,7 +1627,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
|
|||
mDynamicModelFile << " y = solve_one_boundary('" << dynamic_basename << "_" << i + 1 << "'" <<
|
||||
", y, x, params, y_index, " << nze <<
|
||||
", options_.periods, " << 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, 1, 0);\n";
|
||||
", blck_num, y_kmin, options_.maxit_, options_.solve_tolf, options_.slowc, options_.cutoff, options_.stack_solve_algo, 1, 1, 0);\n";
|
||||
mDynamicModelFile << " tmp = y(:,M_.block_structure.block(" << i + 1 << ").variable);\n";
|
||||
mDynamicModelFile << " if(isnan(tmp) | isinf(tmp))\n";
|
||||
mDynamicModelFile << " disp(['Inf or Nan value during the resolution of block " << i <<"']);\n";
|
||||
|
@ -1657,7 +1659,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
|
|||
", options_.periods, " << block_triangular.ModelBlock->Block_List[i].Max_Lag <<
|
||||
", " << block_triangular.ModelBlock->Block_List[i].Max_Lead <<
|
||||
", " << block_triangular.ModelBlock->Block_List[i].is_linear <<
|
||||
", blck_num, y_kmin, options_.maxit_, options_.solve_tolf, options_.slowc, options_.cutoff, options_.simulation_method);\n";
|
||||
", blck_num, y_kmin, options_.maxit_, options_.solve_tolf, options_.slowc, options_.cutoff, options_.stack_solve_algo);\n";
|
||||
mDynamicModelFile << " tmp = y(:,M_.block_structure.block(" << i + 1 << ").variable);\n";
|
||||
mDynamicModelFile << " if(isnan(tmp) | isinf(tmp))\n";
|
||||
mDynamicModelFile << " disp(['Inf or Nan value during the resolution of block " << i <<"']);\n";
|
||||
|
|
|
@ -87,7 +87,7 @@ class ParsingDriver;
|
|||
%}
|
||||
|
||||
%token AR AUTOCORR
|
||||
%token BAYESIAN_IRF BETA_PDF BICGSTAB BLOCK
|
||||
%token BAYESIAN_IRF BETA_PDF BLOCK
|
||||
%token BVAR_DENSITY BVAR_FORECAST
|
||||
%token BVAR_PRIOR_DECAY BVAR_PRIOR_FLAT BVAR_PRIOR_LAMBDA
|
||||
%token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN
|
||||
|
@ -98,15 +98,15 @@ class ParsingDriver;
|
|||
%token FILENAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS
|
||||
%token <string_val> FLOAT_NUMBER
|
||||
%token FORECAST
|
||||
%token GAMMA_PDF GAUSSIAN_ELIMINATION GMRES GRAPH
|
||||
%token GAMMA_PDF GRAPH
|
||||
%token HISTVAL HOMOTOPY_SETUP HOMOTOPY_MODE HOMOTOPY_STEPS HP_FILTER HP_NGRID
|
||||
%token IDENTIFICATION INF_CONSTANT INITVAL INITVAL_FILE
|
||||
%token <string_val> INT_NUMBER
|
||||
%token INV_GAMMA_PDF INV_GAMMA1_PDF INV_GAMMA2_PDF IRF
|
||||
%token KALMAN_ALGO KALMAN_TOL
|
||||
%token LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_MH_FILE LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR LU
|
||||
%token LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_MH_FILE LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR
|
||||
%token MARKOWITZ MARGINAL_DENSITY MAX
|
||||
%token METHOD MFS MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN
|
||||
%token MFS MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN
|
||||
%token MODE_CHECK MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS
|
||||
%token MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER
|
||||
%token <string_val> NAME
|
||||
|
@ -118,7 +118,7 @@ class ParsingDriver;
|
|||
%token <string_val> QUOTED_STRING
|
||||
%token QZ_CRITERIUM
|
||||
%token RELATIVE_IRF REPLIC RPLOT SAVE_PARAMS_AND_STEADY_STATE
|
||||
%token SHOCKS SIGMA_E SIMUL SIMUL_ALGO SIMUL_SEED SMOOTHER SOLVE_ALGO
|
||||
%token SHOCKS SIGMA_E SIMUL SIMUL_ALGO SIMUL_SEED SMOOTHER STACK_SOLVE_ALGO SOLVE_ALGO
|
||||
%token STDERR STEADY STOCH_SIMUL
|
||||
%token TEX RAMSEY_POLICY PLANNER_DISCOUNT
|
||||
%token <string_val> TEX_NAME
|
||||
|
@ -678,7 +678,7 @@ simul_options_list : simul_options_list COMMA simul_options
|
|||
|
||||
simul_options : o_periods
|
||||
| o_datafile
|
||||
| o_method
|
||||
| o_stack_solve_algo
|
||||
| o_markowitz
|
||||
;
|
||||
|
||||
|
@ -1497,6 +1497,7 @@ o_dr_algo : DR_ALGO EQUAL INT_NUMBER {
|
|||
}
|
||||
o_solve_algo : SOLVE_ALGO EQUAL INT_NUMBER { driver.option_num("solve_algo", $3); };
|
||||
o_simul_algo : SIMUL_ALGO EQUAL INT_NUMBER { driver.option_num("simul_algo", $3); };
|
||||
o_stack_solve_algo : STACK_SOLVE_ALGO EQUAL INT_NUMBER { driver.option_num("stack_solve_algo", $3); };
|
||||
o_linear : LINEAR { driver.linear(); };
|
||||
o_order : ORDER EQUAL INT_NUMBER { driver.option_num("order", $3); };
|
||||
o_replic : REPLIC EQUAL INT_NUMBER { driver.option_num("replic", $3); };
|
||||
|
@ -1511,11 +1512,6 @@ o_hp_ngrid : HP_NGRID EQUAL INT_NUMBER { driver.option_num("hp_ngrid", $3); };
|
|||
o_periods : PERIODS EQUAL INT_NUMBER
|
||||
{ driver.option_num("periods", $3); driver.option_num("simul", "1"); };
|
||||
o_cutoff : CUTOFF EQUAL number { driver.option_num("cutoff", $3); }
|
||||
o_method : METHOD EQUAL INT_NUMBER { driver.option_num("simulation_method",$3);}
|
||||
| METHOD EQUAL LU { driver.option_num("simulation_method", "0"); }
|
||||
| METHOD EQUAL GAUSSIAN_ELIMINATION { driver.option_num("simulation_method", "1"); }
|
||||
| METHOD EQUAL GMRES { driver.option_num("simulation_method", "2"); }
|
||||
| METHOD EQUAL BICGSTAB { driver.option_num("simulation_method", "3"); };
|
||||
o_markowitz : MARKOWITZ EQUAL number { driver.option_num("markowitz", $3); };
|
||||
o_mfs : MFS EQUAL number { driver.option_num("mfs", $3); };
|
||||
o_simul : SIMUL { driver.option_num("simul", "1"); };
|
||||
|
|
|
@ -168,7 +168,6 @@ int sigma_e = 0;
|
|||
|
||||
/* Inside of a Dynare statement */
|
||||
<DYNARE_STATEMENT>datafile {return token::DATAFILE;}
|
||||
<DYNARE_STATEMENT>method {return token::METHOD;}
|
||||
<DYNARE_STATEMENT>nobs {return token::NOBS;}
|
||||
<DYNARE_STATEMENT>first_obs {return token::FIRST_OBS;}
|
||||
<DYNARE_STATEMENT>prefilter {return token::PREFILTER;}
|
||||
|
@ -332,6 +331,7 @@ int sigma_e = 0;
|
|||
<DYNARE_STATEMENT>solve_algo {return token::SOLVE_ALGO;}
|
||||
<DYNARE_STATEMENT>dr_algo {return token::DR_ALGO;}
|
||||
<DYNARE_STATEMENT>simul_algo {return token::SIMUL_ALGO;}
|
||||
<DYNARE_STATEMENT>stack_solve_algo {return token::STACK_SOLVE_ALGO;}
|
||||
<DYNARE_STATEMENT>drop {return token::DROP;}
|
||||
<DYNARE_STATEMENT>order {return token::ORDER;}
|
||||
<DYNARE_STATEMENT>replic {return token::REPLIC;}
|
||||
|
@ -353,14 +353,12 @@ int sigma_e = 0;
|
|||
<DYNARE_STATEMENT>[\\] {return Dynare::parser::token_type (yytext[0]);}
|
||||
<DYNARE_STATEMENT>[\'] {return Dynare::parser::token_type (yytext[0]);}
|
||||
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>use_dll {return token::USE_DLL;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>lu {return token::LU;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>gaussian_elimination {return token::GAUSSIAN_ELIMINATION;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>gmres {return token::GMRES;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>bicgstab {return token::BICGSTAB;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>block {return token::BLOCK;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>bytecode {return token::BYTECODE;}
|
||||
<DYNARE_BLOCK>use_dll {return token::USE_DLL;}
|
||||
<DYNARE_BLOCK>block {return token::BLOCK;}
|
||||
<DYNARE_BLOCK>bytecode {return token::BYTECODE;}
|
||||
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>linear {return token::LINEAR;}
|
||||
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>[,] {return token::COMMA;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>[:] {return Dynare::parser::token_type (yytext[0]);}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>[\(\)] {return Dynare::parser::token_type (yytext[0]);}
|
||||
|
|
|
@ -645,181 +645,6 @@ StaticDllModel::Write_Inf_To_Bin_File(const string &static_basename, const strin
|
|||
SaveCode.close();
|
||||
}
|
||||
|
||||
void
|
||||
StaticDllModel::writeSparseStaticMFile(const string &static_basename, const string &basename, const int mode) const
|
||||
{
|
||||
string sp;
|
||||
ofstream mStaticModelFile;
|
||||
ostringstream tmp, tmp1, tmp_eq;
|
||||
int prev_Simulation_Type;
|
||||
//SymbolicGaussElimination SGE;
|
||||
bool OK;
|
||||
chdir(basename.c_str());
|
||||
string filename = static_basename + ".m";
|
||||
mStaticModelFile.open(filename.c_str(), ios::out | ios::binary);
|
||||
if (!mStaticModelFile.is_open())
|
||||
{
|
||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
mStaticModelFile << "%\n";
|
||||
mStaticModelFile << "% " << filename << " : Computes static model for Dynare\n";
|
||||
mStaticModelFile << "%\n";
|
||||
mStaticModelFile << "% Warning : this file is generated automatically by Dynare\n";
|
||||
mStaticModelFile << "% from model file (.mod)\n\n";
|
||||
mStaticModelFile << "%/\n";
|
||||
|
||||
int i, k;
|
||||
|
||||
mStaticModelFile << "function [varargout] = " << static_basename << "(varargin)\n";
|
||||
mStaticModelFile << " global oo_ options_ M_ ;\n";
|
||||
//Temporary variables declaration
|
||||
OK=true;
|
||||
ostringstream tmp_output;
|
||||
for (temporary_terms_type::const_iterator it = temporary_terms.begin();
|
||||
it != temporary_terms.end(); it++)
|
||||
{
|
||||
if (OK)
|
||||
OK=false;
|
||||
else
|
||||
tmp_output << " ";
|
||||
(*it)->writeOutput(tmp_output, oMatlabStaticModelSparse, temporary_terms);
|
||||
}
|
||||
if (tmp_output.str().length()>0)
|
||||
mStaticModelFile << " global " << tmp_output.str() << " M_ ;\n";
|
||||
|
||||
mStaticModelFile << " T_init=0;\n";
|
||||
tmp_output.str("");
|
||||
for (temporary_terms_type::const_iterator it = temporary_terms.begin();
|
||||
it != temporary_terms.end(); it++)
|
||||
{
|
||||
tmp_output << " ";
|
||||
(*it)->writeOutput(tmp_output, oMatlabStaticModel, temporary_terms);
|
||||
tmp_output << "=T_init;\n";
|
||||
}
|
||||
if (tmp_output.str().length()>0)
|
||||
mStaticModelFile << tmp_output.str();
|
||||
|
||||
mStaticModelFile << " y_size=M_.endo_nbr;\n";
|
||||
mStaticModelFile << " %it is the deterministic simulation of the block decomposed static model\n";
|
||||
mStaticModelFile << " maxit_=options_.maxit_;\n";
|
||||
mStaticModelFile << " solve_tolf=options_.solve_tolf;\n";
|
||||
mStaticModelFile << " y=oo_.steady_state';\n";
|
||||
mStaticModelFile << " x=[oo_.exo_steady_state oo_.exo_det_steady_state];\n";
|
||||
|
||||
prev_Simulation_Type=-1;
|
||||
mStaticModelFile << " params=M_.params;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.status = 0;\n";
|
||||
for (i = 0;i < block_triangular.ModelBlock->Size;i++)
|
||||
{
|
||||
k = block_triangular.ModelBlock->Block_List[i].Simulation_Type;
|
||||
if ((k == EVALUATE_FORWARD) && (block_triangular.ModelBlock->Block_List[i].Size))
|
||||
{
|
||||
mStaticModelFile << " oo_.deterministic_simulation.status = 1;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.error = 0;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.iterations = 0;\n";
|
||||
mStaticModelFile << " if(isfield(oo_.deterministic_simulation,'block'))\n";
|
||||
mStaticModelFile << " blck_num = length(oo_.deterministic_simulation.block)+1;\n";
|
||||
mStaticModelFile << " else\n";
|
||||
mStaticModelFile << " blck_num = 1;\n";
|
||||
mStaticModelFile << " end;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.block(blck_num).status = 1;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.block(blck_num).error = 0;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.block(blck_num).iterations = 0;\n";
|
||||
//mStaticModelFile << " for it_ = y_kmin+1:(periods+y_kmin)\n";
|
||||
mStaticModelFile << " y=" << static_basename << "_" << i + 1 << "(y, x, params);\n";
|
||||
mStaticModelFile << " tmp = y(:,M_.block_structure.block(" << i + 1 << ").variable);\n";
|
||||
mStaticModelFile << " if(isnan(tmp) | isinf(tmp))\n";
|
||||
mStaticModelFile << " disp(['Inf or Nan value during the evaluation of block " << i <<"']);\n";
|
||||
mStaticModelFile << " return;\n";
|
||||
mStaticModelFile << " end;\n";
|
||||
}
|
||||
else if ((k == EVALUATE_BACKWARD) && (block_triangular.ModelBlock->Block_List[i].Size))
|
||||
{
|
||||
mStaticModelFile << " oo_.deterministic_simulation.status = 1;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.error = 0;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.iterations = 0;\n";
|
||||
mStaticModelFile << " if(isfield(oo_.deterministic_simulation,'block'))\n";
|
||||
mStaticModelFile << " blck_num = length(oo_.deterministic_simulation.block)+1;\n";
|
||||
mStaticModelFile << " else\n";
|
||||
mStaticModelFile << " blck_num = 1;\n";
|
||||
mStaticModelFile << " end;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.block(blck_num).status = 1;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.block(blck_num).error = 0;\n";
|
||||
mStaticModelFile << " oo_.deterministic_simulation.block(blck_num).iterations = 0;\n";
|
||||
mStaticModelFile << " " << static_basename << "_" << i + 1 << "(y, x, params);\n";
|
||||
mStaticModelFile << " tmp = y(:,M_.block_structure.block(" << i + 1 << ").variable);\n";
|
||||
mStaticModelFile << " if(isnan(tmp) | isinf(tmp))\n";
|
||||
mStaticModelFile << " disp(['Inf or Nan value during the evaluation of block " << i <<"']);\n";
|
||||
mStaticModelFile << " return;\n";
|
||||
mStaticModelFile << " end;\n";
|
||||
}
|
||||
else if ((k == SOLVE_FORWARD_COMPLETE || k == SOLVE_FORWARD_SIMPLE) && (block_triangular.ModelBlock->Block_List[i].Size))
|
||||
{
|
||||
/*mStaticModelFile << " g1=0;\n";
|
||||
mStaticModelFile << " r=0;\n";*/
|
||||
tmp.str("");
|
||||
for (int ik=block_triangular.ModelBlock->Block_List[i].Nb_Recursives ;ik<block_triangular.ModelBlock->Block_List[i].Size;ik++)
|
||||
{
|
||||
tmp << " " << block_triangular.ModelBlock->Block_List[i].Variable[ik]+1;
|
||||
}
|
||||
mStaticModelFile << " y_index = [" << tmp.str() << "];\n";
|
||||
/*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++)*/
|
||||
int nze=block_triangular.ModelBlock->Block_List[i].IM_lead_lag[0].size;
|
||||
mStaticModelFile << " if(isfield(oo_.deterministic_simulation,'block'))\n";
|
||||
mStaticModelFile << " blck_num = length(oo_.deterministic_simulation.block)+1;\n";
|
||||
mStaticModelFile << " else\n";
|
||||
mStaticModelFile << " blck_num = 1;\n";
|
||||
mStaticModelFile << " end;\n";
|
||||
mStaticModelFile << " y = solve_one_boundary('" << static_basename << "_" << i + 1 << "'" <<
|
||||
", y, x, params, y_index, " << nze <<
|
||||
", 1, " << block_triangular.ModelBlock->Block_List[i].is_linear <<
|
||||
", blck_num, 0, options_.maxit_, options_.solve_tolf, options_.slowc, options_.cutoff, options_.simulation_method, 1, 0, 0);\n";
|
||||
mStaticModelFile << " tmp = y(:,M_.block_structure.block(" << i + 1 << ").variable);\n";
|
||||
mStaticModelFile << " if(isnan(tmp) | isinf(tmp))\n";
|
||||
mStaticModelFile << " disp(['Inf or Nan value during the resolution of block " << i <<"']);\n";
|
||||
mStaticModelFile << " return;\n";
|
||||
mStaticModelFile << " end;\n";
|
||||
}
|
||||
else if ((k == SOLVE_BACKWARD_COMPLETE || k == SOLVE_BACKWARD_SIMPLE) && (block_triangular.ModelBlock->Block_List[i].Size))
|
||||
{
|
||||
/*mStaticModelFile << " g1=0;\n";
|
||||
mStaticModelFile << " r=0;\n";*/
|
||||
tmp.str("");
|
||||
for (int ik=block_triangular.ModelBlock->Block_List[i].Nb_Recursives ;ik<block_triangular.ModelBlock->Block_List[i].Size;ik++)
|
||||
{
|
||||
tmp << " " << block_triangular.ModelBlock->Block_List[i].Variable[ik]+1;
|
||||
}
|
||||
mStaticModelFile << " y_index = [" << tmp.str() << "];\n";
|
||||
/*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++)*/
|
||||
int nze=block_triangular.ModelBlock->Block_List[i].IM_lead_lag[0].size;
|
||||
mStaticModelFile << " if(isfield(oo_.deterministic_simulation,'block'))\n";
|
||||
mStaticModelFile << " blck_num = length(oo_.deterministic_simulation.block)+1;\n";
|
||||
mStaticModelFile << " else\n";
|
||||
mStaticModelFile << " blck_num = 1;\n";
|
||||
mStaticModelFile << " end;\n";
|
||||
mStaticModelFile << " y = solve_one_boundary('" << static_basename << "_" << i + 1 << "'" <<
|
||||
", y, x, params, y_index, " << nze <<
|
||||
", 0, " << 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 << " tmp = y(:,M_.block_structure.block(" << i + 1 << ").variable);\n";
|
||||
mStaticModelFile << " if(isnan(tmp) | isinf(tmp))\n";
|
||||
mStaticModelFile << " disp(['Inf or Nan value during the resolution of block " << i <<"']);\n";
|
||||
mStaticModelFile << " return;\n";
|
||||
mStaticModelFile << " end;\n";
|
||||
}
|
||||
}
|
||||
mStaticModelFile << " oo_.steady_state = y';\n";
|
||||
mStaticModelFile << "return;\n";
|
||||
|
||||
mStaticModelFile.close();
|
||||
|
||||
writeModelEquationsOrdered_M( block_triangular.ModelBlock, static_basename);
|
||||
|
||||
chdir("..");
|
||||
}
|
||||
|
||||
void
|
||||
StaticDllModel::evaluateJacobian(const eval_context_type &eval_context, jacob_map *j_m, bool dynamic)
|
||||
|
|
|
@ -77,8 +77,6 @@ private:
|
|||
//! Writes static model file (C version)
|
||||
/*! \todo add third derivatives handling */
|
||||
void writeStaticCFile(const string &static_basename) const;
|
||||
//! Writes static model file when SparseDLL option is on
|
||||
void writeSparseStaticMFile(const string &static_basename, const string &basename, const int mode) const;
|
||||
//! Writes the Block reordred structure of the model in M output
|
||||
void writeModelEquationsOrdered_M(Model_Block *ModelBlock, const string &static_basename) const;
|
||||
//! Writes the code of the Block reordred structure of the model in virtual machine bytecode
|
||||
|
|
Loading…
Reference in New Issue