Commit d264b7b2 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Reindentation of the preprocessor

parent 5ddc0a59
This diff is collapsed.
......@@ -257,16 +257,16 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct)
it = options_list.num_options.find("dsge_varlag");
if (it != options_list.num_options.end())
if (mod_file_struct.dsge_var_calibrated.empty() &&
!mod_file_struct.dsge_var_estimated)
if (mod_file_struct.dsge_var_calibrated.empty()
&& !mod_file_struct.dsge_var_estimated)
{
cerr << "ERROR: The estimation statement requires a dsge_var option to be passed "
<< "if the dsge_varlag option is passed." << endl;
exit(EXIT_FAILURE);
}
if (!mod_file_struct.dsge_var_calibrated.empty() &&
mod_file_struct.dsge_var_estimated)
if (!mod_file_struct.dsge_var_calibrated.empty()
&& mod_file_struct.dsge_var_estimated)
{
cerr << "ERROR: An estimation statement cannot take more than one dsge_var option." << endl;
exit(EXIT_FAILURE);
......@@ -375,8 +375,8 @@ EstimatedParamsStatement::checkPass(ModFileStructure &mod_file_struct)
if (it->prior == "1") //BETA_PDF is associated with "1" in DynareBison.yy
try
{
if (it->mean->eval(eval_context_t()) == 0.5 &&
it->std->eval(eval_context_t()) == 0.5)
if (it->mean->eval(eval_context_t()) == 0.5
&& it->std->eval(eval_context_t()) == 0.5)
{
cerr << "ERROR: The prior density is not defined for the beta distribution when the mean = standard deviation = 0.5." << endl;
exit(EXIT_FAILURE);
......@@ -1012,20 +1012,20 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename
if (!upper_cholesky_present && !lower_cholesky_present)
{
int n = symbol_table.endo_nbr();
// int m = symbol_table.exo_nbr();
// int m = symbol_table.exo_nbr();
int m = 1; // this is the constant, not the shocks
int r = getMaxLag();
int k = r*n+m;
if (k < 1)
{
cerr << "ERROR: lag = " << r
<< ", number of endogenous variables = " << n
<< ", number of exogenous variables = " << m
<< ". If this is not a logical error in the specification"
<< " of the .mod file, please report it to the Dynare Team." << endl;
exit(EXIT_FAILURE);
}
{
cerr << "ERROR: lag = " << r
<< ", number of endogenous variables = " << n
<< ", number of exogenous variables = " << m
<< ". If this is not a logical error in the specification"
<< " of the .mod file, please report it to the Dynare Team." << endl;
exit(EXIT_FAILURE);
}
if (n < 1)
{
cerr << "ERROR: Number of endogenous variables = " << n << "< 1. If this is not a logical "
......
......@@ -73,20 +73,20 @@ ConfigFile::getConfigFileInfo(const string &parallel_config_file)
{
// Test OS and try to open default file
#if defined(_WIN32) || defined(__CYGWIN32__)
if (getenv("APPDATA")==NULL)
if (getenv("APPDATA") == NULL)
{
cerr << "ERROR: APPDATA environment variable not found." << endl;
exit(EXIT_FAILURE);
}
string defaultConfigFile (getenv("APPDATA"));
string defaultConfigFile(getenv("APPDATA"));
defaultConfigFile += "\\dynare.ini";
#else
if (getenv("HOME")==NULL)
if (getenv("HOME") == NULL)
{
cerr << "ERROR: HOME environment variable not found." << endl;
exit(EXIT_FAILURE);
}
string defaultConfigFile (getenv("HOME"));
string defaultConfigFile(getenv("HOME"));
defaultConfigFile += "/.dynare";
#endif
configFile = new ifstream(defaultConfigFile.c_str(), fstream::in);
......@@ -125,9 +125,9 @@ ConfigFile::getConfigFileInfo(const string &parallel_config_file)
if (!line.compare("[node]") || !line.compare("[cluster]"))
{
addConfFileElement(inNode, inCluster, member_nodes, name,
computerName, minCpuNbr, maxCpuNbr, userName,
password, remoteDrive, remoteDirectory,
dynarePath, matlabOctavePath, singleCompThread);
computerName, minCpuNbr, maxCpuNbr, userName,
password, remoteDrive, remoteDirectory,
dynarePath, matlabOctavePath, singleCompThread);
//! Reset communication vars / option defaults
if (!line.compare("[node]"))
......@@ -141,8 +141,8 @@ ConfigFile::getConfigFileInfo(const string &parallel_config_file)
inCluster = true;
}
name = userName = computerName = password = remoteDrive =
remoteDirectory = dynarePath = matlabOctavePath = "";
name = userName = computerName = password = remoteDrive
= remoteDirectory = dynarePath = matlabOctavePath = "";
minCpuNbr = maxCpuNbr = 0;
singleCompThread = true;
member_nodes.clear();
......@@ -172,17 +172,17 @@ ConfigFile::getConfigFileInfo(const string &parallel_config_file)
minCpuNbr = 1;
maxCpuNbr = boost::lexical_cast< int >(tokenizedCpuNbr.front());
}
else if (tokenizedCpuNbr.size() == 2 &&
tokenizedCpuNbr[0].at(0) == '[' &&
tokenizedCpuNbr[1].at(tokenizedCpuNbr[1].size()-1) == ']')
else if (tokenizedCpuNbr.size() == 2
&& tokenizedCpuNbr[0].at(0) == '['
&& tokenizedCpuNbr[1].at(tokenizedCpuNbr[1].size()-1) == ']')
{
tokenizedCpuNbr[0].erase(0,1);
tokenizedCpuNbr[1].erase(tokenizedCpuNbr[1].size()-1,1);
tokenizedCpuNbr[0].erase(0, 1);
tokenizedCpuNbr[1].erase(tokenizedCpuNbr[1].size()-1, 1);
minCpuNbr = boost::lexical_cast< int >(tokenizedCpuNbr[0]);
maxCpuNbr = boost::lexical_cast< int >(tokenizedCpuNbr[1]);
}
}
catch( const boost::bad_lexical_cast & )
catch (const boost::bad_lexical_cast &)
{
cerr << "ERROR: Could not convert value to integer for CPUnbr." << endl;
exit(EXIT_FAILURE);
......@@ -234,8 +234,8 @@ ConfigFile::getConfigFileInfo(const string &parallel_config_file)
{
vector<string> tmp_member_nodes;
boost::split(tmp_member_nodes, tokenizedLine.back(), boost::is_any_of(";, "));
for ( vector<string>::iterator it = tmp_member_nodes.begin();
it < tmp_member_nodes.end(); it++ )
for (vector<string>::iterator it = tmp_member_nodes.begin();
it < tmp_member_nodes.end(); it++)
{
boost::trim(*it);
if (!it->empty())
......@@ -283,9 +283,9 @@ ConfigFile::addConfFileElement(bool inNode, bool inCluster, vector<string> membe
matlabOctavePath, singleCompThread);
//! ADD CLUSTER
else if (inCluster)
if ( minCpuNbr > 0 || maxCpuNbr > 0 || !userName.empty() ||
!password.empty() || !remoteDrive.empty() || !remoteDirectory.empty() ||
!dynarePath.empty() || !matlabOctavePath.empty())
if (minCpuNbr > 0 || maxCpuNbr > 0 || !userName.empty()
|| !password.empty() || !remoteDrive.empty() || !remoteDirectory.empty()
|| !dynarePath.empty() || !matlabOctavePath.empty())
{
cerr << "Invalid option passed to [cluster]." << endl;
exit(EXIT_FAILURE);
......@@ -415,7 +415,7 @@ ConfigFile::writeCluster(ostream &output) const
if (!parallel && !parallel_test)
return;
map<string, Cluster *>::const_iterator cluster_it ;
map<string, Cluster *>::const_iterator cluster_it;
if (cluster_name.empty())
cluster_it = clusters.find(firstClusterName);
else
......@@ -464,10 +464,10 @@ ConfigFile::writeCluster(ostream &output) const
output << "InitializeComputationalEnvironment();" << endl;
if (parallel_test)
output << "ErrorCode = AnalyseComputationalEnvironment(options_.parallel, options_.parallel_info);" << endl
<< "disp(['AnalyseComputationalEnvironment returned with Error Code: ' num2str(ErrorCode)]);" << endl
<< "diary off;" << endl
<< "return;" << endl;
output << "ErrorCode = AnalyseComputationalEnvironment(options_.parallel, options_.parallel_info);" << endl
<< "disp(['AnalyseComputationalEnvironment returned with Error Code: ' num2str(ErrorCode)]);" << endl
<< "diary off;" << endl
<< "return;" << endl;
}
void
......
......@@ -500,9 +500,9 @@ DataTree::AddFirstDerivExternalFunctionNode(int top_level_symb_id, const vector<
{
assert(symbol_table.getType(top_level_symb_id) == eExternalFunction);
first_deriv_external_function_node_map_t::iterator it =
first_deriv_external_function_node_map.find(make_pair(make_pair(arguments, input_index),
top_level_symb_id));
first_deriv_external_function_node_map_t::iterator it
= first_deriv_external_function_node_map.find(make_pair(make_pair(arguments, input_index),
top_level_symb_id));
if (it != first_deriv_external_function_node_map.end())
return it->second;
......@@ -514,10 +514,10 @@ DataTree::AddSecondDerivExternalFunctionNode(int top_level_symb_id, const vector
{
assert(symbol_table.getType(top_level_symb_id) == eExternalFunction);
second_deriv_external_function_node_map_t::iterator it =
second_deriv_external_function_node_map.find(make_pair(make_pair(arguments,
make_pair(input_index1, input_index2)),
top_level_symb_id));
second_deriv_external_function_node_map_t::iterator it
= second_deriv_external_function_node_map.find(make_pair(make_pair(arguments,
make_pair(input_index1, input_index2)),
top_level_symb_id));
if (it != second_deriv_external_function_node_map.end())
return it->second;
......
......@@ -88,7 +88,7 @@ private:
int node_counter;
inline expr_t AddPossiblyNegativeConstant(double val);
inline expr_t AddUnaryOp(UnaryOpcode op_code, expr_t arg, int arg_exp_info_set = 0, const string &arg_exp_info_set_name="", int param1_symb_id = 0, int param2_symb_id = 0);
inline expr_t AddUnaryOp(UnaryOpcode op_code, expr_t arg, int arg_exp_info_set = 0, const string &arg_exp_info_set_name = "", int param1_symb_id = 0, int param2_symb_id = 0);
inline expr_t AddBinaryOp(expr_t arg1, BinaryOpcode op_code, expr_t arg2, int powerDerivOrder = 0);
inline expr_t AddTrinaryOp(expr_t arg1, TrinaryOpcode op_code, expr_t arg2, expr_t arg3);
......
This diff is collapsed.
......@@ -225,18 +225,17 @@ private:
//!List for each block the exogenous variables
vector<pair<var_t, int> > block_var_exo;
map< int, map<int , int> > block_exo_index, block_det_exo_index, block_other_endo_index;
map< int, map<int, int> > block_exo_index, block_det_exo_index, block_other_endo_index;
//! for each block described the number of static, forward, backward and mixed variables in the block
/*! pair< pair<static, forward>, pair<backward,mixed> > */
vector<pair< pair<int, int>, pair<int,int> > > block_col_type;
vector<pair< pair<int, int>, pair<int, int> > > block_col_type;
//! List for each variable its block number and its maximum lag and lead inside the block
vector<pair<int, pair<int, int> > > variable_block_lead_lag;
//! List for each equation its block number
vector<int> equation_block;
//!Maximum lead and lag for each block on endogenous of the block, endogenous of the previous blocks, exogenous and deterministic exogenous
vector<pair<int, int> > endo_max_leadlag_block, other_endo_max_leadlag_block, exo_max_leadlag_block, exo_det_max_leadlag_block, max_leadlag_block;
......@@ -272,7 +271,7 @@ public:
//! Adds informations for simulation in a binary file
void Write_Inf_To_Bin_File_Block(const string &dynamic_basename, const string &bin_basename,
const int &num, int &u_count_int, bool &file_open, bool is_two_boundaries) const;
const int &num, int &u_count_int, bool &file_open, bool is_two_boundaries) const;
//! Writes dynamic model file
void writeDynamicFile(const string &basename, bool block, bool bytecode, bool use_dll, int order) const;
//! Writes file containing parameters derivatives
......@@ -447,7 +446,7 @@ public:
int
getBlockVariableID(int variable_number) const
{
return(variable_block_lead_lag[variable_number].first);
return (variable_block_lead_lag[variable_number].first);
};
//! Return the position of the exogenous variable_number in the block number belonging to the block block_number
virtual int
......@@ -457,7 +456,7 @@ public:
if (it != block_exo_index.end())
{
map<int, int>::const_iterator it1 = it->second.find(variable_number);
if( it1 != it->second.end())
if (it1 != it->second.end())
return it1->second;
else
return -1;
......@@ -473,7 +472,7 @@ public:
if (it != block_det_exo_index.end())
{
map<int, int>::const_iterator it1 = it->second.find(variable_number);
if( it1 != it->second.end())
if (it1 != it->second.end())
return it1->second;
else
return -1;
......@@ -489,7 +488,7 @@ public:
if (it != block_other_endo_index.end())
{
map<int, int>::const_iterator it1 = it->second.find(variable_number);
if( it1 != it->second.end())
if (it1 != it->second.end())
return it1->second;
else
return -1;
......
......@@ -38,7 +38,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tm
// Do parsing and construct internal representation of mod file
ModFile *mod_file = p.parse(in, debug);
ConfigFile config_file (parallel, parallel_test, parallel_slave_open_mode, cluster_name);
ConfigFile config_file(parallel, parallel_test, parallel_slave_open_mode, cluster_name);
config_file.getConfigFileInfo(parallel_config_file);
// Run checking pass
......
This diff is collapsed.
......@@ -107,7 +107,6 @@ enum ExprNodeOutputType
#define MIN_COST_C (40*4)
#define MIN_COST(is_matlab) ((is_matlab) ? MIN_COST_MATLAB : MIN_COST_C)
//! Base class for expression nodes
class ExprNode
{
......@@ -198,9 +197,9 @@ public:
deriv_node_temp_terms_t &tef_terms) const;
virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number,
bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const;
bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const;
//! Computes the set of all variables of a given symbol type in the expression
/*!
......@@ -252,7 +251,7 @@ public:
{
};
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException ) = 0;
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) = 0;
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const = 0;
void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const;
//! Creates a static version of this node
......@@ -358,14 +357,14 @@ public:
/*!
\param[in] value of the numerical constante
\param[out] the boolean equal to true if NodeId is a constant equal to value
*/
*/
virtual bool isNumConstNodeEqualTo(double value) const = 0;
//! Return true if the nodeID is a variable withe a type equal to type_arg, a specific variable id aqual to varfiable_id and a lag equal to lag_arg and false otherwise
/*!
\param[in] the type (type_arg), specifique variable id (variable_id and the lag (lag_arg)
\param[out] the boolean equal to true if NodeId is the variable
*/
*/
virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const = 0;
//! Replaces the Trend var with datatree.One
......@@ -415,7 +414,7 @@ public:
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const;
virtual void collectVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException );
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
virtual expr_t toStatic(DataTree &static_datatree) const;
virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const;
......@@ -462,7 +461,7 @@ public:
vector< vector<temporary_terms_t> > &v_temporary_terms,
int equation) const;
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException );
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
virtual expr_t toStatic(DataTree &static_datatree) const;
SymbolType
......@@ -533,8 +532,8 @@ public:
int equation) const;
virtual void collectVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
static double eval_opcode(UnaryOpcode op_code, double v) throw (EvalException, EvalExternalFunctionException );
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException );
static double eval_opcode(UnaryOpcode op_code, double v) throw (EvalException, EvalExternalFunctionException);
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
//! Returns operand
expr_t
......@@ -607,8 +606,8 @@ public:
int equation) const;
virtual void collectVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
static double eval_opcode(double v1, BinaryOpcode op_code, double v2, int derivOrder) throw (EvalException, EvalExternalFunctionException );
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException );
static double eval_opcode(double v1, BinaryOpcode op_code, double v2, int derivOrder) throw (EvalException, EvalExternalFunctionException);
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
virtual expr_t Compute_RHS(expr_t arg1, expr_t arg2, int op, int op_type) const;
//! Returns first operand
......@@ -693,8 +692,8 @@ public:
int equation) const;
virtual void collectVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
static double eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v3) throw (EvalException, EvalExternalFunctionException );
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException );
static double eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v3) throw (EvalException, EvalExternalFunctionException);
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
virtual expr_t toStatic(DataTree &static_datatree) const;
virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const;
......@@ -741,7 +740,7 @@ protected:
void writeExternalFunctionArguments(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const;
public:
ExternalFunctionNode(DataTree &datatree_arg, int symb_id_arg,
const vector<expr_t> &arguments_arg);
const vector<expr_t> &arguments_arg);
virtual void prepareForDerivation();
virtual void computeTemporaryTerms(map<expr_t, int> &reference_count, temporary_terms_t &temporary_terms, bool is_matlab) const;
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const;
......@@ -749,9 +748,9 @@ public:
const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const;
virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number,
bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const;
bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const;
virtual void computeTemporaryTerms(map<expr_t, int> &reference_count,
temporary_terms_t &temporary_terms,
map<expr_t, pair<int, int> > &first_occurence,
......@@ -760,11 +759,11 @@ public:
int equation) const;
virtual void collectVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException );
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
unsigned int compileExternalFunctionArguments(ostream &CompileCode, unsigned int &instruction_number,
bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const;
bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const;
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
virtual expr_t toStatic(DataTree &static_datatree) const;
......@@ -810,16 +809,16 @@ public:
int equation) const;
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const;
virtual void compile(ostream &CompileCode, unsigned int &instruction_number,
bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const;
bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const;
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const;
virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number,
bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const;
bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const;
};
class SecondDerivExternalFunctionNode : public ExternalFunctionNode
......
......@@ -48,33 +48,33 @@ ExternalFunctionsTable::addExternalFunction(int symb_id, const external_function
external_function_options_chng.nargs = eExtFunNotSet;
// Ensure 1st & 2nd deriv option consistency
if (external_function_options_chng.secondDerivSymbID == symb_id &&
external_function_options_chng.firstDerivSymbID != symb_id)
if (external_function_options_chng.secondDerivSymbID == symb_id
&& external_function_options_chng.firstDerivSymbID != symb_id)
{
cerr << "ERROR: If the second derivative is provided by the top-level function "
<< "the first derivative must also be provided by the same function." << endl;
exit(EXIT_FAILURE);
}
if ((external_function_options_chng.secondDerivSymbID != symb_id &&
external_function_options_chng.firstDerivSymbID == symb_id) &&
external_function_options_chng.secondDerivSymbID != eExtFunNotSet)
if ((external_function_options_chng.secondDerivSymbID != symb_id
&& external_function_options_chng.firstDerivSymbID == symb_id)
&& external_function_options_chng.secondDerivSymbID != eExtFunNotSet)
{
cerr << "ERROR: If the first derivative is provided by the top-level function, the "
<< "second derivative cannot be provided by any other external function." << endl;
exit(EXIT_FAILURE);
}
if (external_function_options_chng.secondDerivSymbID != eExtFunNotSet&&
external_function_options_chng.firstDerivSymbID == eExtFunNotSet)
if (external_function_options_chng.secondDerivSymbID != eExtFunNotSet
&& external_function_options_chng.firstDerivSymbID == eExtFunNotSet)
{
cerr << "ERROR: If the second derivative is provided, the first derivative must also be provided." << endl;
exit(EXIT_FAILURE);
}
if (external_function_options_chng.secondDerivSymbID == external_function_options_chng.firstDerivSymbID &&
external_function_options_chng.firstDerivSymbID != symb_id &&
external_function_options_chng.firstDerivSymbID != eExtFunNotSet)
if (external_function_options_chng.secondDerivSymbID == external_function_options_chng.firstDerivSymbID
&& external_function_options_chng.firstDerivSymbID != symb_id
&& external_function_options_chng.firstDerivSymbID != eExtFunNotSet)
{
cerr << "ERROR: If the Jacobian and Hessian are provided by the same function, that "
<< "function must be the top-level function." << endl;
......@@ -90,7 +90,7 @@ ExternalFunctionsTable::addExternalFunction(int symb_id, const external_function
if (!ok_to_overwrite) // prevents multiple non-compatible calls to external_function(name=funcname)
{ // e.g. e_f(name=a,nargs=1,fd,sd) and e_f(name=a,nargs=2,fd=b,sd=c) should cause an error
if (external_function_options_chng.nargs != getNargs(symb_id))
if (external_function_options_chng.nargs != getNargs(symb_id))
{
cerr << "ERROR: The number of arguments passed to the external_function() statement do not "
<< "match the number of arguments passed to a previous call or declaration of the top-level function."<< endl;
......
......@@ -69,7 +69,7 @@ public:
//! See if the function exists in the External Functions Table
inline bool exists(int symb_id) const;
//! Get the number of arguments for a given external function
inline int getNargs( int symb_id) const throw (UnknownExternalFunctionSymbolIDException);
inline int getNargs(int symb_id) const throw (UnknownExternalFunctionSymbolIDException);
//! Get the symbol_id of the first derivative function
inline int getFirstDerivSymbID(int symb_id) const throw (UnknownExternalFunctionSymbolIDException);
//! Get the symbol_id of the second derivative function
......
......@@ -175,7 +175,7 @@ namespace MFS
if (in_degree(vertex, G) > 0 && out_degree(vertex, G) > 0)
for (tie(it_in, in_end) = in_edges(vertex, G); it_in != in_end; ++it_in)
for (tie(it_out, out_end) = out_edges(vertex, G); it_out != out_end; ++it_out)
if (source(*it_in, G) == target(*it_out, G) && source(*it_in, G) != target(*it_in, G)) // not a loop
if (source(*it_in, G) == target(*it_out, G) && source(*it_in, G) != target(*it_in, G)) // not a loop
Doublet.push_back(source(*it_in, G));
return Doublet;
}
......
......@@ -141,7 +141,7 @@ ModFile::checkPass()
exit(EXIT_FAILURE);
}
if ( (stochastic_statement_present || mod_file_struct.check_present || mod_file_struct.steady_present) && no_static)
if ((stochastic_statement_present || mod_file_struct.check_present || mod_file_struct.steady_present) && no_static)
{
cerr << "no_static option is incompatible with stochastic simulation, estimation, optimal policy, steady or check command" << endl;
exit(EXIT_FAILURE);
......@@ -303,7 +303,7 @@ ModFile::computingPass(bool no_tmp_terms)
// Compute static model and its derivatives
dynamic_model.toStatic(static_model);
if(!no_static)
if (!no_static)
{
static_model.initializeVariablesAndEquations();
static_model.computingPass(global_eval_context, no_tmp_terms, false, block, byte_code);
......@@ -407,7 +407,6 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool console,
else
mOutputFile << "M_.H = 0;" << endl;
if (linear == 1)
mOutputFile << "options_.linear = 1;" << endl;
......@@ -470,9 +469,9 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool console,
// Some mex commands are enclosed in an eval(), because otherwise it will make Octave fail
#if defined(_WIN32) || defined(__CYGWIN32__)
if (msvc)
mOutputFile << " eval('mex -O LINKFLAGS=\"$LINKFLAGS /export:Dynamic\" " << basename << "_dynamic.c')" << endl; // MATLAB/Windows + Microsoft Visual C++
mOutputFile << " eval('mex -O LINKFLAGS=\"$LINKFLAGS /export:Dynamic\" " << basename << "_dynamic.c')" << endl; // MATLAB/Windows + Microsoft Visual C++
else if (cygwin)
mOutputFile << " eval('mex -O PRELINK_CMDS1=\"echo EXPORTS > mex.def & echo mexFunction >> mex.def & echo Dynamic >> mex.def\" " << basename << "_dynamic.c')" << endl; // MATLAB/Windows + Cygwin g++
mOutputFile << " eval('mex -O PRELINK_CMDS1=\"echo EXPORTS > mex.def & echo mexFunction >> mex.def & echo Dynamic >> mex.def\" " << basename << "_dynamic.c')" << endl; // MATLAB/Windows + Cygwin g++
else
mOutputFile << " error('When using the USE_DLL option, you must give either ''cygwin'' or ''msvc'' option to the ''dynare'' command')" << endl;
#else
......
......@@ -537,7 +537,7 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock(const jacob
G2);
vector<int> endo2block(num_vertices(G2)), discover_time(num_vertices(G2));
iterator_property_map<int*, property_map<AdjacencyList_t, vertex_index_t>::type, int, int&> endo2block_map(&endo2block[0], get(vertex_index, G2));
iterator_property_map<int *, property_map<AdjacencyList_t, vertex_index_t>::type, int, int &> endo2block_map(&endo2block[0], get(vertex_index, G2));
// Compute strongly connected components
int num = strong_components(G2, endo2block_map);
......@@ -759,7 +759,7 @@ ModelTree::printBlockDecomposition(const vector<pair<int, int> > &blocks) const
}
block_type_firstequation_size_mfs_t
ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_jacobian, vector<pair<int, int> > &blocks, const equation_type_and_normalized_equation_t &Equation_Type, const vector<int> &variable_reordered, const vector<int> &equation_reordered, vector<unsigned int> &n_static, vector<unsigned int> &n_forward, vector<unsigned int> &n_backward, vector<unsigned int> &n_mixed, vector<pair< pair<int, int>, pair<int,int> > > &block_col_type)
ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_jacobian, vector<pair<int, int> > &blocks, const equation_type_and_normalized_equation_t &Equation_Type, const vector<int> &variable_reordered, const vector<int> &equation_reordered, vector<unsigned int> &n_static, vector<unsigned int> &n_forward, vector<unsigned int> &n_backward, vector<unsigned int> &n_mixed, vector<pair< pair<int, int>, pair<int, int> > > &block_col_type)
{
int i = 0;
int count_equ = 0, blck_count_simult = 0;
......@@ -864,27 +864,27 @@ ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_j
Lead = block_lag_lead[block_type_size_mfs.size()-1].second;
block_lag_lead[block_type_size_mfs.size()-1] = make_pair(Lag, Lead);
pair< pair< unsigned int, unsigned int>, pair<unsigned int, unsigned int> > tmp = block_col_type[block_col_type.size()-1];
block_col_type[block_col_type.size()-1] = make_pair( make_pair(tmp.first.first+l_n_static, tmp.first.second+l_n_forward), make_pair(tmp.second.first+l_n_backward,