diff --git a/preprocessor/StaticDllModel.cc b/preprocessor/StaticDllModel.cc index 73cb0861d..3f8c12c89 100644 --- a/preprocessor/StaticDllModel.cc +++ b/preprocessor/StaticDllModel.cc @@ -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 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, diff --git a/preprocessor/StaticDllModel.hh b/preprocessor/StaticDllModel.hh index 465292e6a..8f5094926 100644 --- a/preprocessor/StaticDllModel.hh +++ b/preprocessor/StaticDllModel.hh @@ -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 >, 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;