Revert "preprocessor: write auxiliary variable definitions to matlab function"
This reverts commit ad81129a9b
.
time-shift
parent
9c42ebaa56
commit
4ff17d6191
|
@ -1515,42 +1515,6 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
|
||||||
code_file.close();
|
code_file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
DynamicModel::writeDynamicAuxMFile(const string &dynamic_basename) const
|
|
||||||
{
|
|
||||||
string filename = dynamic_basename + "_aux.m";
|
|
||||||
ofstream mDynamicAuxFile;
|
|
||||||
mDynamicAuxFile.open(filename.c_str(), ios::out | ios::binary);
|
|
||||||
if (!mDynamicAuxFile.is_open())
|
|
||||||
{
|
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
mDynamicAuxFile << "function auxvars = " << dynamic_basename << "_aux(y, x, params, steady_state, it_)"
|
|
||||||
<< endl
|
|
||||||
<< "%" << endl
|
|
||||||
<< "% Status : Computes auxiliary variables for Dynare" << endl
|
|
||||||
<< "%" << endl
|
|
||||||
<< "% Inputs :" << endl
|
|
||||||
<< "% y [#dynamic variables by 1] double vector of endogenous variables in the order stored" << endl
|
|
||||||
<< "% in M_.lead_lag_incidence; see the Manual" << endl
|
|
||||||
<< "% x [nperiods by M_.exo_nbr] double matrix of exogenous variables (in declaration order)" << endl
|
|
||||||
<< "% for all simulation periods" << endl
|
|
||||||
<< "% params [M_.param_nbr by 1] double vector of parameter values in declaration order" << endl
|
|
||||||
<< "% it_ scalar double time period for exogenous variables for which to evaluate the model" << endl
|
|
||||||
<< "%" << endl
|
|
||||||
<< "% Outputs:" << endl
|
|
||||||
<< "% auxvars [length(M_.aux_vars) by 1] definitions of auxiliary variables" << endl
|
|
||||||
<< "%" << endl
|
|
||||||
<< "%" << endl
|
|
||||||
<< "% Warning : this file is generated automatically by Dynare" << endl
|
|
||||||
<< "% from the model file (.mod)" << endl << endl;
|
|
||||||
|
|
||||||
writeModelAuxEquations(mDynamicAuxFile, oMatlabDynamicModel);
|
|
||||||
mDynamicAuxFile << "end" << endl;
|
|
||||||
mDynamicAuxFile.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DynamicModel::writeDynamicMFile(const string &dynamic_basename) const
|
DynamicModel::writeDynamicMFile(const string &dynamic_basename) const
|
||||||
{
|
{
|
||||||
|
@ -3559,10 +3523,7 @@ DynamicModel::writeDynamicFile(const string &basename, bool block, bool bytecode
|
||||||
else if (julia)
|
else if (julia)
|
||||||
writeDynamicJuliaFile(basename);
|
writeDynamicJuliaFile(basename);
|
||||||
else
|
else
|
||||||
{
|
writeDynamicMFile(t_basename);
|
||||||
writeDynamicMFile(t_basename);
|
|
||||||
writeDynamicAuxMFile(t_basename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -73,8 +73,7 @@ private:
|
||||||
//! Store the derivatives or the chainrule derivatives:map<pair< equation, pair< variable, lead_lag >, expr_t>
|
//! Store the derivatives or the chainrule derivatives:map<pair< equation, pair< variable, lead_lag >, expr_t>
|
||||||
typedef map< pair< int, pair< int, int> >, expr_t> first_chain_rule_derivatives_t;
|
typedef map< pair< int, pair< int, int> >, expr_t> first_chain_rule_derivatives_t;
|
||||||
first_chain_rule_derivatives_t first_chain_rule_derivatives;
|
first_chain_rule_derivatives_t first_chain_rule_derivatives;
|
||||||
//! Writes auxiliary equations file (Matlab version)
|
|
||||||
void writeDynamicAuxMFile(const string &dynamic_basename) const;
|
|
||||||
//! Writes dynamic model file (Matlab version)
|
//! Writes dynamic model file (Matlab version)
|
||||||
void writeDynamicMFile(const string &dynamic_basename) const;
|
void writeDynamicMFile(const string &dynamic_basename) const;
|
||||||
//! Writes dynamic model file (Julia version)
|
//! Writes dynamic model file (Julia version)
|
||||||
|
|
|
@ -1264,26 +1264,6 @@ ModelTree::writeModelEquations(ostream &output, ExprNodeOutputType output_type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ModelTree::writeModelAuxEquations(ostream &output, ExprNodeOutputType output_type) const
|
|
||||||
{
|
|
||||||
int eq_ind = 0, av_ind = 0;
|
|
||||||
for (vector<int>::const_iterator it = equations_lineno.begin();
|
|
||||||
it != equations_lineno.end(); it++, eq_ind++)
|
|
||||||
if (*it == -1)
|
|
||||||
{
|
|
||||||
expr_t rhs = equations[eq_ind]->get_arg2();
|
|
||||||
if (IS_JULIA(output_type))
|
|
||||||
output << " @inbounds ";
|
|
||||||
output << "auxvars" << LEFT_ARRAY_SUBSCRIPT(output_type)
|
|
||||||
<< av_ind++ + ARRAY_SUBSCRIPT_OFFSET(output_type)
|
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type)
|
|
||||||
<< " = ";
|
|
||||||
rhs->writeOutput(output, output_type, temporary_terms_t());
|
|
||||||
output << ";" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::compileModelEquations(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const
|
ModelTree::compileModelEquations(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -173,11 +173,10 @@ protected:
|
||||||
void compileTemporaryTerms(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, map_idx_t map_idx, bool dynamic, bool steady_dynamic) const;
|
void compileTemporaryTerms(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, map_idx_t map_idx, bool dynamic, bool steady_dynamic) const;
|
||||||
//! Adds informations for simulation in a binary file
|
//! Adds informations for simulation in a binary file
|
||||||
void Write_Inf_To_Bin_File(const string &basename, int &u_count_int, bool &file_open, bool is_two_boundaries, int block_mfs) const;
|
void Write_Inf_To_Bin_File(const string &basename, int &u_count_int, bool &file_open, bool is_two_boundaries, int block_mfs) const;
|
||||||
|
|
||||||
//! Writes model local variables
|
//! Writes model local variables
|
||||||
/*! No temporary term is used in the output, so that local parameters declarations can be safely put before temporary terms declaration in the output files */
|
/*! No temporary term is used in the output, so that local parameters declarations can be safely put before temporary terms declaration in the output files */
|
||||||
void writeModelLocalVariables(ostream &output, ExprNodeOutputType output_type, deriv_node_temp_terms_t &tef_terms) const;
|
void writeModelLocalVariables(ostream &output, ExprNodeOutputType output_type, deriv_node_temp_terms_t &tef_terms) const;
|
||||||
//! Writes model auxiliary equations
|
|
||||||
void writeModelAuxEquations(ostream &output, ExprNodeOutputType output_type) const;
|
|
||||||
//! Writes model equations
|
//! Writes model equations
|
||||||
void writeModelEquations(ostream &output, ExprNodeOutputType output_type) const;
|
void writeModelEquations(ostream &output, ExprNodeOutputType output_type) const;
|
||||||
//! Compiles model equations
|
//! Compiles model equations
|
||||||
|
|
Loading…
Reference in New Issue