Verified Commit b3fbb862 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

relieve constraint that max lag on EC matrix is 1

parent f4837e6c
Pipeline #818 passed with stage
in 1 minute and 22 seconds
......@@ -5826,7 +5826,7 @@ BinaryOpNode::fillErrorCorrectionRowHelper(expr_t arg1, expr_t arg2,
endog2 = isauxvar2 ?
datatree.symbol_table.getOrigSymbIdForDiffAuxVar(endog2) : endog2;
int max_lag = 0;
int max_lag = vn2->lag;
int colidx = -1;
if (find(nontarget_lhs.begin(), nontarget_lhs.end(), endog1) != nontarget_lhs.end()
&& find(target_lhs.begin(), target_lhs.end(), endog2) != target_lhs.end())
......
......@@ -113,13 +113,6 @@ TrendComponentModelTable::setAR(map<string, map<tuple<int, int, int>, expr_t>> A
void
TrendComponentModelTable::setEC(map<string, map<tuple<int, int, int>, expr_t>> EC_arg)
{
for (const auto & itmap1 : EC_arg)
for (const auto &itmap2 : itmap1.second)
if (get<1>(itmap2.first) != 1)
{
cerr << "Error in EC component: lag must be equal to 1" << endl;
exit(EXIT_FAILURE);
}
EC = move(EC_arg);
}
......@@ -345,14 +338,19 @@ TrendComponentModelTable::writeOutput(const string &basename, ostream &output) c
it.second->writeOutput(ar_ec_output, ExprNodeOutputType::matlabDynamicModel);
ar_ec_output << ";" << endl;
}
int ec_lag = 0;
for (const auto & it : EC.at(name))
if (get<1>(it.first) > ec_lag)
ec_lag = get<1>(it.first);
ar_ec_output << endl
<< " % EC" << endl
<< " ec = zeros(" << nontarget_lhs_vec.size() << ", " << target_lhs_vec.size() << ", 1);" << endl;
<< " ec = zeros(" << nontarget_lhs_vec.size() << ", " << target_lhs_vec.size() << ", " << ec_lag << ");" << endl;
for (const auto & it : EC.at(name))
{
int eqn, lag, colidx;
tie (eqn, lag, colidx) = it.first;
ar_ec_output << " ec(" << eqn + 1 << ", " << colidx + 1 << ", 1) = ";
ar_ec_output << " ec(" << eqn + 1 << ", " << colidx + 1 << ", " << lag << ") = ";
it.second->writeOutput(ar_ec_output, ExprNodeOutputType::matlabDynamicModel);
ar_ec_output << ";" << endl;
}
......
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