Removed useless stuff
git-svn-id: https://www.dynare.org/svn/dynare/trunk@2901 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
fea4b91872
commit
655fa02710
|
@ -1072,92 +1072,6 @@ StaticDllModel::computeChainRuleJacobian(Model_Block *ModelBlock)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
StaticDllModel::computeParamsDerivatives()
|
||||
{
|
||||
for (deriv_id_table_t::const_iterator it = deriv_id_table.begin();
|
||||
it != deriv_id_table.end(); it++)
|
||||
{
|
||||
if (symbol_table.getType(it->first.first) != eParameter)
|
||||
continue;
|
||||
|
||||
int param = it->second;
|
||||
|
||||
for (first_derivatives_type::const_iterator it2 = first_derivatives.begin();
|
||||
it2 != first_derivatives.end(); it2++)
|
||||
{
|
||||
int eq = it2->first.first;
|
||||
int var = it2->first.second;
|
||||
NodeID d1 = it2->second;
|
||||
|
||||
NodeID d2 = d1->getDerivative(param);
|
||||
if (d2 == Zero)
|
||||
continue;
|
||||
params_derivatives[make_pair(eq, make_pair(var, param))] = d2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
StaticDllModel::computeParamsDerivativesTemporaryTerms()
|
||||
{
|
||||
map<NodeID, int> reference_count;
|
||||
params_derivs_temporary_terms.clear();
|
||||
|
||||
for (second_derivatives_type::iterator it = params_derivatives.begin();
|
||||
it != params_derivatives.end(); it++)
|
||||
it->second->computeTemporaryTerms(reference_count, params_derivs_temporary_terms, true);
|
||||
}
|
||||
|
||||
void
|
||||
StaticDllModel::writeParamsDerivativesFile(const string &basename) const
|
||||
{
|
||||
if (!params_derivatives.size())
|
||||
return;
|
||||
|
||||
string filename = basename + "_params_derivs.m";
|
||||
|
||||
ofstream paramsDerivsFile;
|
||||
paramsDerivsFile.open(filename.c_str(), ios::out | ios::binary);
|
||||
if (!paramsDerivsFile.is_open())
|
||||
{
|
||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
paramsDerivsFile << "function gp = " << basename << "_params_derivs(y, x, params, it_)" << endl
|
||||
<< "%" << endl
|
||||
<< "% Warning : this file is generated automatically by Dynare" << endl
|
||||
<< "% from model file (.mod)" << endl << endl;
|
||||
|
||||
|
||||
writeTemporaryTerms(params_derivs_temporary_terms, paramsDerivsFile, oMatlabStaticModel);
|
||||
|
||||
paramsDerivsFile << "gp = zeros(" << equation_number() << ", " << dynJacobianColsNbr << ", "
|
||||
<< symbol_table.param_nbr() << ");" << endl;
|
||||
|
||||
for (second_derivatives_type::const_iterator it = params_derivatives.begin();
|
||||
it != params_derivatives.end(); it++)
|
||||
{
|
||||
int eq = it->first.first;
|
||||
int var = it->first.second.first;
|
||||
int param = it->first.second.second;
|
||||
NodeID d2 = it->second;
|
||||
|
||||
int var_col = getDynJacobianCol(var) + 1;
|
||||
int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
|
||||
|
||||
paramsDerivsFile << "gp(" << eq+1 << ", " << var_col << ", " << param_col << ") = ";
|
||||
d2->writeOutput(paramsDerivsFile, oMatlabStaticModel, params_derivs_temporary_terms);
|
||||
paramsDerivsFile << ";" << endl;
|
||||
}
|
||||
|
||||
paramsDerivsFile.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
StaticDllModel::writeChainRuleDerivative(ostream &output, int eqr, int varr, int lag,
|
||||
ExprNodeOutputType output_type,
|
||||
|
|
|
@ -58,13 +58,6 @@ private:
|
|||
/*! Set by computeDerivID() and computeDynJacobianCols() */
|
||||
int dynJacobianColsNbr;
|
||||
|
||||
//! Derivatives of the jacobian w.r. to parameters
|
||||
/*! First index is equation number, second is endo/exo/exo_det variable, and third is parameter.
|
||||
Only non-null derivatives are stored in the map.
|
||||
Variable and parameter indices are those of the getDerivID() method.
|
||||
*/
|
||||
second_derivatives_type params_derivatives;
|
||||
|
||||
//! Temporary terms for the file containing parameters dervicatives
|
||||
temporary_terms_type params_derivs_temporary_terms;
|
||||
|
||||
|
@ -109,10 +102,6 @@ private:
|
|||
void computeStatJacobianCols();
|
||||
//! Computes chain rule derivatives of the Jacobian w.r. to endogenous variables
|
||||
void computeChainRuleJacobian(Model_Block *ModelBlock);
|
||||
//! Computes derivatives of the Jacobian w.r. to parameters
|
||||
void computeParamsDerivatives();
|
||||
//! Computes temporary terms for the file containing parameters derivatives
|
||||
void computeParamsDerivativesTemporaryTerms();
|
||||
//! Collect only the first derivatives
|
||||
map<pair<int, pair<int, int> >, NodeID> collect_first_order_derivatives_endogenous();
|
||||
|
||||
|
@ -160,8 +149,6 @@ public:
|
|||
const int &num, int &u_count_int, bool &file_open) const;
|
||||
//! Writes static model file
|
||||
void writeStaticFile(const string &basename, bool block) const;
|
||||
//! Writes file containing parameters derivatives
|
||||
void writeParamsDerivativesFile(const string &basename) const;
|
||||
|
||||
//! Writes LaTeX file with the equations of the static model
|
||||
void writeLatexFile(const string &basename) const;
|
||||
|
|
Loading…
Reference in New Issue