Commit 1d079d4e authored by Houtan Bastani's avatar Houtan Bastani

preprocessor: var_estimation: remove unnecessary equation specifiers in syntax

parent 00e8930f
......@@ -340,17 +340,13 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
for (crossequation_restrictions_t::const_iterator it = crossequation_restrictions.begin();
it != crossequation_restrictions.end(); it++, idx++, nrestrictions++)
{
output << Mstr << "crossequation_restriction{" << idx << "}.eq1 = '"
<< symbol_table.getName(it->first.first) << "';" << endl
<< Mstr << "crossequation_restriction{" << idx << "}.eq2 = '"
<< symbol_table.getName(it->first.second) << "';" << endl
<< Mstr << "crossequation_restriction{" << idx << "}.val = "
<< it->second.second << ";" << endl;
output << Mstr << "crossequation_restriction{" << idx << "}.val = "
<< it->second << ";" << endl;
var_restriction_eq_crosseq_t ls = it->second.first.first;
var_restriction_eq_crosseq_t ls = it->first.first;
output << Mstr << "crossequation_restriction{" << idx << "}.lseq = '"
<< symbol_table.getName(ls.first.first) << "';" << endl
<< Mstr << "crossequation_restriction{" << idx << "}.ls2 = '"
<< Mstr << "crossequation_restriction{" << idx << "}.lsvar = '"
<< symbol_table.getName(ls.first.second.first) << "';" << endl
<< Mstr << "crossequation_restriction{" << idx << "}.lslag = "
<< ls.first.second.second << ";" << endl
......@@ -358,12 +354,12 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
ls.second->writeOutput(output);
output << ";" << endl;
var_restriction_eq_crosseq_t rs = it->second.first.second;
var_restriction_eq_crosseq_t rs = it->first.second;
if (rs.first.first >= 0)
{
output << Mstr << "crossequation_restriction{" << idx << "}.rseq = '"
<< symbol_table.getName(rs.first.first) << "';" << endl
<< Mstr << "crossequation_restriction{" << idx << "}.rs2 = '"
<< Mstr << "crossequation_restriction{" << idx << "}.rsvar = '"
<< symbol_table.getName(rs.first.second.first) << "';" << endl
<< Mstr << "crossequation_restriction{" << idx << "}.rslag = "
<< rs.first.second.second << ";" << endl
......
......@@ -134,7 +134,7 @@ private:
const map<int, map<int, SymbolList> > exclusion_restrictions;
typedef map<int, pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double> > equation_restrictions_t;
const equation_restrictions_t equation_restrictions;
typedef map<pair<int, int>, pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double> > crossequation_restrictions_t;
typedef vector<pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double> > crossequation_restrictions_t;
const crossequation_restrictions_t crossequation_restrictions;
const map<pair<int, int>, double> covariance_number_restriction;
const map<pair<int, int>, pair<int, int> > covariance_pair_restriction;
......
......@@ -380,9 +380,9 @@ restrictions_list : restrictions_list restriction
restriction : EXCLUSION LAG INT_NUMBER ';' restriction_exclusion_equation_list
{ driver.add_VAR_exclusion_restriction($3); }
| RESTRICTION EQUATION '(' symbol ')' restriction_equation_equality ';'
{ driver.add_VAR_restriction_equation_or_crossequation_final($4, NULL); }
| RESTRICTION CROSSEQUATIONS '(' symbol COMMA symbol ')' restriction_crossequation_equality ';'
{ driver.add_VAR_restriction_equation_or_crossequation_final($4, $6); }
{ driver.add_VAR_restriction_equation_or_crossequation_final($4); }
| RESTRICTION CROSSEQUATIONS restriction_crossequation_equality ';'
{ driver.add_VAR_restriction_equation_or_crossequation_final(NULL); }
| RESTRICTION COVARIANCE '(' symbol COMMA symbol ')' EQUAL number ';'
{ driver.add_VAR_covariance_number_restriction($4, $6, $9); }
| RESTRICTION COVARIANCE '(' symbol COMMA symbol ')' EQUAL '(' symbol COMMA symbol ')' ';'
......
......@@ -576,18 +576,16 @@ ParsingDriver::multiply_arg2_by_neg_one()
}
void
ParsingDriver::add_VAR_restriction_equation_or_crossequation_final(string *name1, string *name2)
ParsingDriver::add_VAR_restriction_equation_or_crossequation_final(string *name)
{
int symb_id1 = mod_file->symbol_table.getID(*name1);
if (name2 == NULL)
equation_restrictions[symb_id1] = var_restriction_equation_or_crossequation;
else
if (name != NULL)
{
int symb_id2 = name2 == NULL ? -1 : mod_file->symbol_table.getID(*name2);
crossequation_restrictions[make_pair(symb_id1, symb_id2)] = var_restriction_equation_or_crossequation;
delete name2;
int symb_id = mod_file->symbol_table.getID(*name);
equation_restrictions[symb_id] = var_restriction_equation_or_crossequation;
delete name;
}
delete name1;
else
crossequation_restrictions.push_back(var_restriction_equation_or_crossequation);
}
void
......
......@@ -272,7 +272,7 @@ public:
vector<var_restriction_eq_crosseq_t> var_restriction_eq_or_crosseq;
pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double> var_restriction_equation_or_crossequation;
map<int, pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double> > equation_restrictions;
map<pair<int, int>, pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double> > crossequation_restrictions;
vector<pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double> > crossequation_restrictions;
//! > covariance restrictions
map<pair<int, int>, double> covariance_number_restriction;
map<pair<int, int>, pair<int, int> > covariance_pair_restriction;
......@@ -789,7 +789,7 @@ public:
void add_VAR_restriction_eq_or_crosseq(expr_t expr);
void add_VAR_restriction_equation_or_crossequation(string *numberstr);
void multiply_arg2_by_neg_one();
void add_VAR_restriction_equation_or_crossequation_final(string *name1, string *name2);
void add_VAR_restriction_equation_or_crossequation_final(string *name);
void add_VAR_covariance_number_restriction(string *name1, string *name2, string *valuestr);
void add_VAR_covariance_pair_restriction(string *name11, string *name12, string *name21, string *name22);
//! Runs VAR estimation process
......
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