preprocessor: reverted useless changes from last commit
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3016 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
ece194b602
commit
522de968d0
|
@ -2424,16 +2424,12 @@ DynamicModel::toStaticDll(StaticDllModel &static_model) const
|
|||
// Convert model local variables (need to be done first)
|
||||
for (map<int, NodeID>::const_iterator it = local_variables_table.begin();
|
||||
it != local_variables_table.end(); it++)
|
||||
{
|
||||
static_model.AddLocalVariable(symbol_table.getName(it->first), it->second->toStatic(static_model));
|
||||
}
|
||||
|
||||
// Convert equations
|
||||
for (vector<BinaryOpNode *>::const_iterator it = equations.begin();
|
||||
it != equations.end(); it++)
|
||||
{
|
||||
static_model.addEquation((*it)->toStatic(static_model));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -52,10 +52,12 @@ ExprNode::getDerivative(int deriv_id)
|
|||
{
|
||||
if (!preparedForDerivation)
|
||||
prepareForDerivation();
|
||||
|
||||
// Return zero if derivative is necessarily null (using symbolic a priori)
|
||||
set<int>::const_iterator it = non_null_derivatives.find(deriv_id);
|
||||
if (it == non_null_derivatives.end())
|
||||
return datatree.Zero;
|
||||
|
||||
// If derivative is stored in cache, use the cached value, otherwise compute it (and cache it)
|
||||
map<int, NodeID>::const_iterator it2 = derivatives.find(deriv_id);
|
||||
if (it2 != derivatives.end())
|
||||
|
@ -306,7 +308,7 @@ VariableNode::prepareForDerivation()
|
|||
{
|
||||
if (preparedForDerivation)
|
||||
return;
|
||||
int der_id;
|
||||
|
||||
preparedForDerivation = true;
|
||||
|
||||
// Fill in non_null_derivatives
|
||||
|
@ -317,25 +319,12 @@ VariableNode::prepareForDerivation()
|
|||
case eExogenousDet:
|
||||
case eParameter:
|
||||
// For a variable or a parameter, the only non-null derivative is with respect to itself
|
||||
//non_null_derivatives.insert(datatree.getDerivID(symb_id, lag));
|
||||
der_id = datatree.getDerivID(symb_id, lag);
|
||||
non_null_derivatives = set<int>(&der_id, &der_id+1);
|
||||
non_null_derivatives.insert(datatree.getDerivID(symb_id, lag));
|
||||
break;
|
||||
case eModelLocalVariable:
|
||||
datatree.local_variables_table[symb_id]->prepareForDerivation();
|
||||
// Non null derivatives are those of the value of the local parameter
|
||||
non_null_derivatives = datatree.local_variables_table[symb_id]->non_null_derivatives;
|
||||
/*for(set<int>::const_iterator it=datatree.local_variables_table[symb_id]->non_null_derivatives.begin(); it != datatree.local_variables_table[symb_id]->non_null_derivatives.end(); it++)
|
||||
non_null_derivatives.insert(*it);*/
|
||||
//cout << "symb_id=" << symb_id << " " << datatree.symbol_table.getName(symb_id) << " " << datatree.symbol_table.maxID();
|
||||
//non_null_derivatives = datatree.local_variables_table[symb_id]->non_null_derivatives;
|
||||
/*cout << " non_null_derivatives.size()= " << non_null_derivatives.size() << endl;
|
||||
if(non_null_derivatives.size()>0)
|
||||
for(set<int>::const_iterator it=non_null_derivatives.begin(); it != non_null_derivatives.end(); it++)
|
||||
{
|
||||
cout << "symb_id=" << symb_id << " *it = " << *it << "\n" ;
|
||||
//cout << datatree.symbol_table.getName(staticdllmodel.getSymbIDByDerivID(*it)) << "(" << staticdllmodel.getLagByDerivID(*it) << ")\n";
|
||||
}*/
|
||||
break;
|
||||
case eModFileLocalVariable:
|
||||
// Such a variable is never derived
|
||||
|
@ -360,7 +349,6 @@ VariableNode::computeDerivative(int deriv_id)
|
|||
else
|
||||
return datatree.Zero;
|
||||
case eModelLocalVariable:
|
||||
//datatree.local_variables_table[symb_id]->writeOutput(cout);
|
||||
return datatree.local_variables_table[symb_id]->getDerivative(deriv_id);
|
||||
case eModFileLocalVariable:
|
||||
cerr << "ModFileLocalVariable is not derivable" << endl;
|
||||
|
@ -640,7 +628,7 @@ VariableNode::compile(ostream &CompileCode, bool lhs_rhs, const temporary_terms_
|
|||
break;
|
||||
case eModelLocalVariable:
|
||||
case eModFileLocalVariable:
|
||||
//cout << "eModelLocalVariable=" << tsid << "lhs_rhs=" << lhs_rhs << "\n";
|
||||
//cout << "eModelLocalVariable=" << symb_id << "\n";
|
||||
datatree.local_variables_table[symb_id]->compile(CompileCode, lhs_rhs, temporary_terms, map_idx, dynamic, steady_dynamic);
|
||||
break;
|
||||
case eUnknownFunction:
|
||||
|
|
|
@ -241,7 +241,7 @@ public:
|
|||
typedef map<const ExprNode *, const VariableNode *> subst_table_t;
|
||||
|
||||
//! Creates auxiliary lead variables corresponding to this expression
|
||||
/*!
|
||||
/*!
|
||||
If maximum endogenous lead >= 3, this method will also create intermediary auxiliary var, and will add the equations of the form aux1 = aux2(+1) to the substitution table.
|
||||
\pre This expression is assumed to have maximum endogenous lead >= 2
|
||||
\param[in,out] subst_table The table to which new auxiliary variables and their correspondance will be added
|
||||
|
|
|
@ -53,15 +53,13 @@ ModelTree::writeDerivative(ostream &output, int eq, int symb_id, int lag,
|
|||
void
|
||||
ModelTree::computeJacobian(const set<int> &vars)
|
||||
{
|
||||
int i = 0;
|
||||
for(set<int>::const_iterator it = vars.begin();
|
||||
it != vars.end(); it++, i++)
|
||||
it != vars.end(); it++)
|
||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
||||
{
|
||||
NodeID d1 = equations[eq]->getDerivative(*it);
|
||||
if (d1 == Zero)
|
||||
continue;
|
||||
//printf("eq=%4d var=%4d i=%4d\n",eq,*it,i);
|
||||
first_derivatives[make_pair(eq, *it)] = d1;
|
||||
++NNZDerivatives[0];
|
||||
}
|
||||
|
|
|
@ -250,8 +250,6 @@ StaticModel::computeNormalization()
|
|||
|
||||
#if 1
|
||||
bool check = checked_edmonds_maximum_cardinality_matching(g, &mate_map[0]);
|
||||
for (int i = 0; i < n; i++)
|
||||
printf("match equation %4d with variable %4d \n", mate_map[i] - n, i);
|
||||
#else // Alternative way to compute normalization, by giving an initial matching using natural normalizations
|
||||
fill(mate_map.begin(), mate_map.end(), graph_traits<BipartiteGraph>::null_vertex());
|
||||
|
||||
|
@ -406,11 +404,11 @@ StaticModel::computeSortedBlockDecomposition()
|
|||
for(int i = 0; i < n; i++)
|
||||
blocks[unordered2ordered[endo2block[i]]].insert(i);
|
||||
|
||||
//#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
cout << "Found " << m << " blocks" << endl;
|
||||
for(int i = 0; i < m; i++)
|
||||
cout << " Block " << i << " of size " << blocks[i].size() << endl;
|
||||
//#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue