Revert spurious preprocessor changes introduced in dfa744f

issue#70
Sébastien Villemot 2013-03-26 15:33:28 +01:00
parent 832c9d37ef
commit 69a5271db7
6 changed files with 10 additions and 103 deletions

View File

@ -3715,19 +3715,6 @@ DynamicModel::testTrendDerivativesEqualToZero(const eval_context_t &eval_context
} }
} }
void
DynamicModel::print_trend_vars()
{
for (trend_symbols_map_t::const_iterator it = nonstationary_symbols_map.begin();
it != nonstationary_symbols_map.end(); it++)
{
cout << "it->first:" << symbol_table.getName(it->first) << " ";
it->second->print_deflator();
cout << endl;
}
}
void void
DynamicModel::writeParamsDerivativesFile(const string &basename) const DynamicModel::writeParamsDerivativesFile(const string &basename) const
{ {

View File

@ -230,7 +230,6 @@ public:
virtual int getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException); virtual int getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException);
virtual int getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException); virtual int getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException);
virtual void addAllParamDerivId(set<int> &deriv_id_set); virtual void addAllParamDerivId(set<int> &deriv_id_set);
void print_trend_vars();
//! Returns true indicating that this is a dynamic model //! Returns true indicating that this is a dynamic model
virtual bool virtual bool

View File

@ -175,64 +175,6 @@ ExprNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output
// Nothing to do // Nothing to do
} }
void
ExprNode::print_deflator()
{
}
void
VariableNode::print_deflator()
{
cout << datatree.symbol_table.getName(symb_id);
}
void
UnaryOpNode::print_deflator()
{
arg->print_deflator();
}
void
BinaryOpNode::print_deflator()
{
arg1->print_deflator();
arg2->print_deflator();
}
void
TrinaryOpNode::print_deflator()
{
arg1->print_deflator();
arg2->print_deflator();
arg3->print_deflator();
}
void
ExternalFunctionNode::print_deflator()
{
}
void
FirstDerivExternalFunctionNode::print_deflator()
{
}
void
SecondDerivExternalFunctionNode::print_deflator()
{
}
void void
ExprNode::compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number, ExprNode::compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number,
bool lhs_rhs, const temporary_terms_t &temporary_terms, bool lhs_rhs, const temporary_terms_t &temporary_terms,
@ -355,12 +297,6 @@ NumConstNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, t
temporary_terms_inuse.insert(idx); temporary_terms_inuse.insert(idx);
} }
void
NumConstNode::print_deflator()
{
}
void void
NumConstNode::writeOutput(ostream &output, ExprNodeOutputType output_type, NumConstNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,

View File

@ -284,7 +284,6 @@ public:
//! Returns the relative period of the most forward term in this expression //! Returns the relative period of the most forward term in this expression
/*! A negative value means that the expression contains only lagged variables */ /*! A negative value means that the expression contains only lagged variables */
virtual int maxLead() const = 0; virtual int maxLead() const = 0;
virtual void print_deflator();
//! Returns a new expression where all the leads/lags have been shifted backwards by the same amount //! Returns a new expression where all the leads/lags have been shifted backwards by the same amount
/*! /*!
@ -456,7 +455,6 @@ public:
virtual expr_t detrend(int symb_id, expr_t trend) const; virtual expr_t detrend(int symb_id, expr_t trend) const;
virtual expr_t cloneDynamic(DataTree &dynamic_datatree) const; virtual expr_t cloneDynamic(DataTree &dynamic_datatree) const;
virtual expr_t removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const; virtual expr_t removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const;
virtual void print_deflator();
}; };
//! Symbol or variable node //! Symbol or variable node
@ -485,7 +483,6 @@ public:
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 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 expr_t toStatic(DataTree &static_datatree) const;
virtual void print_deflator();
SymbolType SymbolType
get_type() const get_type() const
{ {
@ -557,7 +554,6 @@ public:
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) 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); 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 double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
virtual void print_deflator();
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 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 //! Returns operand
expr_t expr_t
@ -637,7 +633,6 @@ public:
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 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; virtual expr_t Compute_RHS(expr_t arg1, expr_t arg2, int op, int op_type) const;
virtual void print_deflator();
//! Returns first operand //! Returns first operand
expr_t expr_t
get_arg1() const get_arg1() const
@ -738,7 +733,6 @@ public:
virtual int maxEndoLag() const; virtual int maxEndoLag() const;
virtual int maxExoLag() const; virtual int maxExoLag() const;
virtual int maxLead() const; virtual int maxLead() const;
virtual void print_deflator();
virtual expr_t decreaseLeadsLags(int n) const; virtual expr_t decreaseLeadsLags(int n) const;
virtual expr_t substituteEndoLeadGreaterThanTwo(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool deterministic_model) const; virtual expr_t substituteEndoLeadGreaterThanTwo(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool deterministic_model) const;
//! Creates another TrinaryOpNode with the same opcode, but with a possibly different datatree and arguments //! Creates another TrinaryOpNode with the same opcode, but with a possibly different datatree and arguments
@ -803,7 +797,6 @@ public:
bool lhs_rhs, const temporary_terms_t &temporary_terms, bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const; deriv_node_temp_terms_t &tef_terms) const;
virtual void print_deflator();
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 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 expr_t toStatic(DataTree &static_datatree) const;
@ -862,7 +855,6 @@ public:
bool lhs_rhs, const temporary_terms_t &temporary_terms, bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
deriv_node_temp_terms_t &tef_terms) const; deriv_node_temp_terms_t &tef_terms) const;
virtual void print_deflator();
}; };
class SecondDerivExternalFunctionNode : public ExternalFunctionNode class SecondDerivExternalFunctionNode : public ExternalFunctionNode
@ -888,7 +880,6 @@ public:
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type, virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const; deriv_node_temp_terms_t &tef_terms) const;
virtual void print_deflator();
}; };
#endif #endif

View File

@ -107,7 +107,6 @@ ModFile::addStatementAtFront(Statement *st)
void void
ModFile::checkPass() ModFile::checkPass()
{ {
dynamic_model.print_trend_vars();
for (vector<Statement *>::iterator it = statements.begin(); for (vector<Statement *>::iterator it = statements.begin();
it != statements.end(); it++) it != statements.end(); it++)
(*it)->checkPass(mod_file_struct, warnings); (*it)->checkPass(mod_file_struct, warnings);
@ -375,8 +374,8 @@ ModFile::computingPass(bool no_tmp_terms)
// Mod file may have no equation (for example in a standalone BVAR estimation) // Mod file may have no equation (for example in a standalone BVAR estimation)
if (dynamic_model.equation_number() > 0) if (dynamic_model.equation_number() > 0)
{ {
/*if (nonstationary_variables) if (nonstationary_variables)
trend_dynamic_model.runTrendTest(global_eval_context);*/ trend_dynamic_model.runTrendTest(global_eval_context);
// Compute static model and its derivatives // Compute static model and its derivatives
dynamic_model.toStatic(static_model); dynamic_model.toStatic(static_model);

View File

@ -1003,19 +1003,14 @@ ModelTree::computeJacobian(const set<int> &vars)
for (set<int>::const_iterator it = vars.begin(); for (set<int>::const_iterator it = vars.begin();
it != vars.end(); it++) it != vars.end(); it++)
{ {
int prev_deriv = NNZDerivatives[0]; for (int eq = 0; eq < (int) equations.size(); eq++)
for (int eq = 0; eq < (int) equations.size(); eq++) {
{ expr_t d1 = equations[eq]->getDerivative(*it);
expr_t d1 = equations[eq]->getDerivative(*it); if (d1 == Zero)
if (d1 == Zero) continue;
continue; first_derivatives[make_pair(eq, *it)] = d1;
first_derivatives[make_pair(eq, *it)] = d1; ++NNZDerivatives[0];
++NNZDerivatives[0]; }
}
if (NNZDerivatives[0] == prev_deriv)
{
cout << "the derivatives w.r. to " << symbol_table.getName(*it) << " is always equal to 0\n";
}
} }
} }