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

Refuse non-stationary endogenous variables in deflators.

It is not clear what we should do in that case anyways.
parent f889760f
......@@ -1567,3 +1567,10 @@ ModelTree::computeParamsDerivativesTemporaryTerms()
it != hessian_params_derivatives.end(); ++it)
it->second->computeTemporaryTerms(reference_count, params_derivs_temporary_terms, true);
}
bool ModelTree::isNonstationary(int symb_id) const
{
return (nonstationary_symbols_map.find(symb_id)
!= nonstationary_symbols_map.end());
}
......@@ -307,6 +307,8 @@ public:
void addTrendVariables(vector<int> trend_vars, expr_t growth_factor) throw (TrendException);
//! Adds a nonstationary variables with their (common) deflator
void addNonstationaryVariables(vector<int> nonstationary_vars, bool log_deflator, expr_t deflator) throw (TrendException);
//! Is a given variable non-stationary?
bool isNonstationary(int symb_id) const;
void set_cutoff_to_zero();
//! Helper for writing the Jacobian elements in MATLAB and C
/*! Writes either (i+1,j+1) or [i+j*no_eq] */
......
......@@ -357,6 +357,13 @@ ParsingDriver::end_nonstationary_var(bool log_deflator, expr_t deflator)
{
error("Variable " + e.name + " was listed more than once as following a trend.");
}
set<pair<int, int> > r;
deflator->collectVariables(eEndogenous, r);
for (set<pair<int, int> >::const_iterator it = r.begin(); it != r.end(); ++it)
if (dynamic_model->isNonstationary(it->first))
error("The deflator contains a non-stationary endogenous variable. This is not allowed. Please use only stationary endogenous and/or {log_}trend_vars.");
declared_nonstationary_vars.clear();
reset_data_tree();
}
......
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