Fix derivs w.r.t. parameters with temporary terms array
parent
61dc80bb64
commit
dd6799187c
|
@ -2351,6 +2351,7 @@ DynamicModel::writeDynamicModel(const string &dynamic_basename, ostream &Dynamic
|
||||||
|
|
||||||
writeTemporaryTerms(temporary_terms_res,
|
writeTemporaryTerms(temporary_terms_res,
|
||||||
temp_term_union,
|
temp_term_union,
|
||||||
|
temporary_terms_idxs,
|
||||||
model_tt_output, output_type, tef_terms);
|
model_tt_output, output_type, tef_terms);
|
||||||
temp_term_union.insert(temporary_terms_res.begin(), temporary_terms_res.end());
|
temp_term_union.insert(temporary_terms_res.begin(), temporary_terms_res.end());
|
||||||
|
|
||||||
|
@ -2364,6 +2365,7 @@ DynamicModel::writeDynamicModel(const string &dynamic_basename, ostream &Dynamic
|
||||||
{
|
{
|
||||||
writeTemporaryTerms(temporary_terms_g1,
|
writeTemporaryTerms(temporary_terms_g1,
|
||||||
temp_term_union,
|
temp_term_union,
|
||||||
|
temporary_terms_idxs,
|
||||||
jacobian_tt_output, output_type, tef_terms);
|
jacobian_tt_output, output_type, tef_terms);
|
||||||
temp_term_union.insert(temporary_terms_g1.begin(), temporary_terms_g1.end());
|
temp_term_union.insert(temporary_terms_g1.begin(), temporary_terms_g1.end());
|
||||||
|
|
||||||
|
@ -2387,6 +2389,7 @@ DynamicModel::writeDynamicModel(const string &dynamic_basename, ostream &Dynamic
|
||||||
{
|
{
|
||||||
writeTemporaryTerms(temporary_terms_g2,
|
writeTemporaryTerms(temporary_terms_g2,
|
||||||
temp_term_union,
|
temp_term_union,
|
||||||
|
temporary_terms_idxs,
|
||||||
hessian_tt_output, output_type, tef_terms);
|
hessian_tt_output, output_type, tef_terms);
|
||||||
temp_term_union.insert(temporary_terms_g2.begin(), temporary_terms_g2.end());
|
temp_term_union.insert(temporary_terms_g2.begin(), temporary_terms_g2.end());
|
||||||
|
|
||||||
|
@ -2457,6 +2460,7 @@ DynamicModel::writeDynamicModel(const string &dynamic_basename, ostream &Dynamic
|
||||||
{
|
{
|
||||||
writeTemporaryTerms(temporary_terms_g3,
|
writeTemporaryTerms(temporary_terms_g3,
|
||||||
temp_term_union,
|
temp_term_union,
|
||||||
|
temporary_terms_idxs,
|
||||||
third_derivatives_tt_output, output_type, tef_terms);
|
third_derivatives_tt_output, output_type, tef_terms);
|
||||||
temp_term_union.insert(temporary_terms_g3.begin(), temporary_terms_g3.end());
|
temp_term_union.insert(temporary_terms_g3.begin(), temporary_terms_g3.end());
|
||||||
|
|
||||||
|
@ -4979,8 +4983,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
||||||
deriv_node_temp_terms_t tef_terms;
|
deriv_node_temp_terms_t tef_terms;
|
||||||
writeModelLocalVariables(model_local_vars_output, output_type, tef_terms);
|
writeModelLocalVariables(model_local_vars_output, output_type, tef_terms);
|
||||||
|
|
||||||
temporary_terms_t temp_terms_empty;
|
writeTemporaryTerms(params_derivs_temporary_terms, {}, params_derivs_temporary_terms_idxs, model_output, output_type, tef_terms);
|
||||||
writeTemporaryTerms(params_derivs_temporary_terms, temp_terms_empty, model_output, output_type, tef_terms);
|
|
||||||
|
|
||||||
for (first_derivatives_t::const_iterator it = residuals_params_derivatives.begin();
|
for (first_derivatives_t::const_iterator it = residuals_params_derivatives.begin();
|
||||||
it != residuals_params_derivatives.end(); it++)
|
it != residuals_params_derivatives.end(); it++)
|
||||||
|
@ -4993,7 +4996,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
||||||
|
|
||||||
jacobian_output << "rp" << LEFT_ARRAY_SUBSCRIPT(output_type) << eq+1 << ", " << param_col
|
jacobian_output << "rp" << LEFT_ARRAY_SUBSCRIPT(output_type) << eq+1 << ", " << param_col
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << " = ";
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << " = ";
|
||||||
d1->writeOutput(jacobian_output, output_type, params_derivs_temporary_terms, tef_terms);
|
d1->writeOutput(jacobian_output, output_type, params_derivs_temporary_terms, params_derivs_temporary_terms_idxs, tef_terms);
|
||||||
jacobian_output << ";" << endl;
|
jacobian_output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5010,7 +5013,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
||||||
|
|
||||||
hessian_output << "gp" << LEFT_ARRAY_SUBSCRIPT(output_type) << eq+1 << ", " << var_col
|
hessian_output << "gp" << LEFT_ARRAY_SUBSCRIPT(output_type) << eq+1 << ", " << var_col
|
||||||
<< ", " << param_col << RIGHT_ARRAY_SUBSCRIPT(output_type) << " = ";
|
<< ", " << param_col << RIGHT_ARRAY_SUBSCRIPT(output_type) << " = ";
|
||||||
d2->writeOutput(hessian_output, output_type, params_derivs_temporary_terms, tef_terms);
|
d2->writeOutput(hessian_output, output_type, params_derivs_temporary_terms, params_derivs_temporary_terms_idxs, tef_terms);
|
||||||
hessian_output << ";" << endl;
|
hessian_output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5034,7 +5037,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param2_col << ";" << endl
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param2_col << ";" << endl
|
||||||
<< "rpp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",4"
|
<< "rpp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",4"
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
||||||
d2->writeOutput(hessian1_output, output_type, params_derivs_temporary_terms, tef_terms);
|
d2->writeOutput(hessian1_output, output_type, params_derivs_temporary_terms, params_derivs_temporary_terms_idxs, tef_terms);
|
||||||
hessian1_output << ";" << endl;
|
hessian1_output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5062,7 +5065,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param2_col << ";" << endl
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param2_col << ";" << endl
|
||||||
<< "gpp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",5"
|
<< "gpp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",5"
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
||||||
d2->writeOutput(third_derivs_output, output_type, params_derivs_temporary_terms, tef_terms);
|
d2->writeOutput(third_derivs_output, output_type, params_derivs_temporary_terms, params_derivs_temporary_terms_idxs, tef_terms);
|
||||||
third_derivs_output << ";" << endl;
|
third_derivs_output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5090,7 +5093,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param_col << ";" << endl
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param_col << ";" << endl
|
||||||
<< "hp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",5"
|
<< "hp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",5"
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
||||||
d2->writeOutput(third_derivs1_output, output_type, params_derivs_temporary_terms, tef_terms);
|
d2->writeOutput(third_derivs1_output, output_type, params_derivs_temporary_terms, params_derivs_temporary_terms_idxs, tef_terms);
|
||||||
third_derivs1_output << ";" << endl;
|
third_derivs1_output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5159,6 +5162,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
||||||
<< "%" << endl
|
<< "%" << endl
|
||||||
<< "% Warning : this file is generated automatically by Dynare" << endl
|
<< "% Warning : this file is generated automatically by Dynare" << endl
|
||||||
<< "% from model file (.mod)" << endl << endl
|
<< "% from model file (.mod)" << endl << endl
|
||||||
|
<< "T = NaN(" << params_derivs_temporary_terms_idxs.size() << ",1);" << endl
|
||||||
<< model_local_vars_output.str()
|
<< model_local_vars_output.str()
|
||||||
<< model_output.str()
|
<< model_output.str()
|
||||||
<< "rp = zeros(" << equations.size() << ", "
|
<< "rp = zeros(" << equations.size() << ", "
|
||||||
|
|
|
@ -1231,6 +1231,7 @@ ModelTree::writeModelLocalVariableTemporaryTerms(const temporary_terms_t &tto, c
|
||||||
void
|
void
|
||||||
ModelTree::writeTemporaryTerms(const temporary_terms_t &tt,
|
ModelTree::writeTemporaryTerms(const temporary_terms_t &tt,
|
||||||
const temporary_terms_t &ttm1,
|
const temporary_terms_t &ttm1,
|
||||||
|
const temporary_terms_idxs_t &tt_idxs,
|
||||||
ostream &output, ExprNodeOutputType output_type, deriv_node_temp_terms_t &tef_terms) const
|
ostream &output, ExprNodeOutputType output_type, deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
// Local var used to keep track of temp nodes already written
|
// Local var used to keep track of temp nodes already written
|
||||||
|
@ -1239,16 +1240,16 @@ ModelTree::writeTemporaryTerms(const temporary_terms_t &tt,
|
||||||
it != tt.end(); it++)
|
it != tt.end(); it++)
|
||||||
{
|
{
|
||||||
if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL)
|
if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL)
|
||||||
(*it)->writeExternalFunctionOutput(output, output_type, tt2, temporary_terms_idxs, tef_terms);
|
(*it)->writeExternalFunctionOutput(output, output_type, tt2, tt_idxs, tef_terms);
|
||||||
|
|
||||||
if (IS_C(output_type))
|
if (IS_C(output_type))
|
||||||
output << "double ";
|
output << "double ";
|
||||||
else if (IS_JULIA(output_type))
|
else if (IS_JULIA(output_type))
|
||||||
output << " @inbounds ";
|
output << " @inbounds ";
|
||||||
|
|
||||||
(*it)->writeOutput(output, output_type, tt, temporary_terms_idxs, tef_terms);
|
(*it)->writeOutput(output, output_type, tt, tt_idxs, tef_terms);
|
||||||
output << " = ";
|
output << " = ";
|
||||||
(*it)->writeOutput(output, output_type, tt2, temporary_terms_idxs, tef_terms);
|
(*it)->writeOutput(output, output_type, tt2, tt_idxs, tef_terms);
|
||||||
|
|
||||||
if (IS_C(output_type) || IS_MATLAB(output_type))
|
if (IS_C(output_type) || IS_MATLAB(output_type))
|
||||||
output << ";";
|
output << ";";
|
||||||
|
@ -2010,6 +2011,22 @@ ModelTree::computeParamsDerivativesTemporaryTerms()
|
||||||
params_derivs_temporary_terms_res2 = temp_terms_map[eResidualsParamsSecondDeriv];
|
params_derivs_temporary_terms_res2 = temp_terms_map[eResidualsParamsSecondDeriv];
|
||||||
params_derivs_temporary_terms_g12 = temp_terms_map[eJacobianParamsSecondDeriv];
|
params_derivs_temporary_terms_g12 = temp_terms_map[eJacobianParamsSecondDeriv];
|
||||||
params_derivs_temporary_terms_g2 = temp_terms_map[eHessianParamsDeriv];
|
params_derivs_temporary_terms_g2 = temp_terms_map[eHessianParamsDeriv];
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
|
for (auto tt : params_derivs_temporary_terms_res)
|
||||||
|
params_derivs_temporary_terms_idxs[tt] = idx++;
|
||||||
|
|
||||||
|
for (auto tt : params_derivs_temporary_terms_g1)
|
||||||
|
params_derivs_temporary_terms_idxs[tt] = idx++;
|
||||||
|
|
||||||
|
for (auto tt : params_derivs_temporary_terms_res2)
|
||||||
|
params_derivs_temporary_terms_idxs[tt] = idx++;
|
||||||
|
|
||||||
|
for (auto tt : params_derivs_temporary_terms_g12)
|
||||||
|
params_derivs_temporary_terms_idxs[tt] = idx++;
|
||||||
|
|
||||||
|
for (auto tt : params_derivs_temporary_terms_g2)
|
||||||
|
params_derivs_temporary_terms_idxs[tt] = idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -152,6 +152,8 @@ protected:
|
||||||
temporary_terms_t params_derivs_temporary_terms_g12;
|
temporary_terms_t params_derivs_temporary_terms_g12;
|
||||||
temporary_terms_t params_derivs_temporary_terms_g2;
|
temporary_terms_t params_derivs_temporary_terms_g2;
|
||||||
|
|
||||||
|
temporary_terms_idxs_t params_derivs_temporary_terms_idxs;
|
||||||
|
|
||||||
//! Trend variables and their growth factors
|
//! Trend variables and their growth factors
|
||||||
map<int, expr_t> trend_symbols_map;
|
map<int, expr_t> trend_symbols_map;
|
||||||
|
|
||||||
|
@ -185,7 +187,7 @@ protected:
|
||||||
//! Computes temporary terms for the file containing parameters derivatives
|
//! Computes temporary terms for the file containing parameters derivatives
|
||||||
void computeParamsDerivativesTemporaryTerms();
|
void computeParamsDerivativesTemporaryTerms();
|
||||||
//! Writes temporary terms
|
//! Writes temporary terms
|
||||||
void writeTemporaryTerms(const temporary_terms_t &tt, const temporary_terms_t &ttm1, ostream &output, ExprNodeOutputType output_type, deriv_node_temp_terms_t &tef_terms) const;
|
void writeTemporaryTerms(const temporary_terms_t &tt, const temporary_terms_t &ttm1, const temporary_terms_idxs_t &tt_idxs, ostream &output, ExprNodeOutputType output_type, deriv_node_temp_terms_t &tef_terms) const;
|
||||||
void writeJsonTemporaryTerms(const temporary_terms_t &tt, const temporary_terms_t &ttm1, ostream &output, deriv_node_temp_terms_t &tef_terms, string &concat) const;
|
void writeJsonTemporaryTerms(const temporary_terms_t &tt, const temporary_terms_t &ttm1, ostream &output, deriv_node_temp_terms_t &tef_terms, string &concat) const;
|
||||||
//! Compiles temporary terms
|
//! Compiles temporary terms
|
||||||
void compileTemporaryTerms(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, map_idx_t map_idx, bool dynamic, bool steady_dynamic) const;
|
void compileTemporaryTerms(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, map_idx_t map_idx, bool dynamic, bool steady_dynamic) const;
|
||||||
|
|
|
@ -1364,6 +1364,7 @@ StaticModel::writeStaticModel(const string &basename,
|
||||||
|
|
||||||
writeTemporaryTerms(temporary_terms_res,
|
writeTemporaryTerms(temporary_terms_res,
|
||||||
temp_term_union,
|
temp_term_union,
|
||||||
|
temporary_terms_idxs,
|
||||||
model_tt_output, output_type, tef_terms);
|
model_tt_output, output_type, tef_terms);
|
||||||
temp_term_union.insert(temporary_terms_res.begin(), temporary_terms_res.end());
|
temp_term_union.insert(temporary_terms_res.begin(), temporary_terms_res.end());
|
||||||
|
|
||||||
|
@ -1378,6 +1379,7 @@ StaticModel::writeStaticModel(const string &basename,
|
||||||
{
|
{
|
||||||
writeTemporaryTerms(temporary_terms_g1,
|
writeTemporaryTerms(temporary_terms_g1,
|
||||||
temp_term_union,
|
temp_term_union,
|
||||||
|
temporary_terms_idxs,
|
||||||
jacobian_tt_output, output_type, tef_terms);
|
jacobian_tt_output, output_type, tef_terms);
|
||||||
temp_term_union.insert(temporary_terms_g1.begin(), temporary_terms_g1.end());
|
temp_term_union.insert(temporary_terms_g1.begin(), temporary_terms_g1.end());
|
||||||
}
|
}
|
||||||
|
@ -1401,6 +1403,7 @@ StaticModel::writeStaticModel(const string &basename,
|
||||||
{
|
{
|
||||||
writeTemporaryTerms(temporary_terms_g2,
|
writeTemporaryTerms(temporary_terms_g2,
|
||||||
temp_term_union,
|
temp_term_union,
|
||||||
|
temporary_terms_idxs,
|
||||||
hessian_tt_output, output_type, tef_terms);
|
hessian_tt_output, output_type, tef_terms);
|
||||||
temp_term_union.insert(temporary_terms_g2.begin(), temporary_terms_g2.end());
|
temp_term_union.insert(temporary_terms_g2.begin(), temporary_terms_g2.end());
|
||||||
|
|
||||||
|
@ -1470,6 +1473,7 @@ StaticModel::writeStaticModel(const string &basename,
|
||||||
{
|
{
|
||||||
writeTemporaryTerms(temporary_terms_g3,
|
writeTemporaryTerms(temporary_terms_g3,
|
||||||
temp_term_union,
|
temp_term_union,
|
||||||
|
temporary_terms_idxs,
|
||||||
third_derivatives_tt_output, output_type, tef_terms);
|
third_derivatives_tt_output, output_type, tef_terms);
|
||||||
temp_term_union.insert(temporary_terms_g3.begin(), temporary_terms_g3.end());
|
temp_term_union.insert(temporary_terms_g3.begin(), temporary_terms_g3.end());
|
||||||
|
|
||||||
|
@ -2517,8 +2521,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
||||||
deriv_node_temp_terms_t tef_terms;
|
deriv_node_temp_terms_t tef_terms;
|
||||||
writeModelLocalVariables(model_local_vars_output, output_type, tef_terms);
|
writeModelLocalVariables(model_local_vars_output, output_type, tef_terms);
|
||||||
|
|
||||||
temporary_terms_t temp_terms_empty;
|
writeTemporaryTerms(params_derivs_temporary_terms, {}, params_derivs_temporary_terms_idxs, model_output, output_type, tef_terms);
|
||||||
writeTemporaryTerms(params_derivs_temporary_terms, temp_terms_empty, model_output, output_type, tef_terms);
|
|
||||||
|
|
||||||
for (first_derivatives_t::const_iterator it = residuals_params_derivatives.begin();
|
for (first_derivatives_t::const_iterator it = residuals_params_derivatives.begin();
|
||||||
it != residuals_params_derivatives.end(); it++)
|
it != residuals_params_derivatives.end(); it++)
|
||||||
|
@ -2532,7 +2535,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
||||||
jacobian_output << "rp" << LEFT_ARRAY_SUBSCRIPT(output_type)
|
jacobian_output << "rp" << LEFT_ARRAY_SUBSCRIPT(output_type)
|
||||||
<< eq+1 << ", " << param_col
|
<< eq+1 << ", " << param_col
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << " = ";
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << " = ";
|
||||||
d1->writeOutput(jacobian_output, output_type, params_derivs_temporary_terms, tef_terms);
|
d1->writeOutput(jacobian_output, output_type, params_derivs_temporary_terms, params_derivs_temporary_terms_idxs, tef_terms);
|
||||||
jacobian_output << ";" << endl;
|
jacobian_output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2550,7 +2553,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
||||||
hessian_output << "gp" << LEFT_ARRAY_SUBSCRIPT(output_type)
|
hessian_output << "gp" << LEFT_ARRAY_SUBSCRIPT(output_type)
|
||||||
<< eq+1 << ", " << var_col << ", " << param_col
|
<< eq+1 << ", " << var_col << ", " << param_col
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << " = ";
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << " = ";
|
||||||
d2->writeOutput(hessian_output, output_type, params_derivs_temporary_terms, tef_terms);
|
d2->writeOutput(hessian_output, output_type, params_derivs_temporary_terms, params_derivs_temporary_terms_idxs, tef_terms);
|
||||||
hessian_output << ";" << endl;
|
hessian_output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2574,7 +2577,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param2_col << ";" << endl
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param2_col << ";" << endl
|
||||||
<< "rpp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",4"
|
<< "rpp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",4"
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
||||||
d2->writeOutput(hessian1_output, output_type, params_derivs_temporary_terms, tef_terms);
|
d2->writeOutput(hessian1_output, output_type, params_derivs_temporary_terms, params_derivs_temporary_terms_idxs, tef_terms);
|
||||||
hessian1_output << ";" << endl;
|
hessian1_output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2602,7 +2605,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param2_col << ";" << endl
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param2_col << ";" << endl
|
||||||
<< "gpp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",5"
|
<< "gpp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",5"
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
||||||
d2->writeOutput(third_derivs_output, output_type, params_derivs_temporary_terms, tef_terms);
|
d2->writeOutput(third_derivs_output, output_type, params_derivs_temporary_terms, params_derivs_temporary_terms_idxs, tef_terms);
|
||||||
third_derivs_output << ";" << endl;
|
third_derivs_output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2630,7 +2633,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param_col << ";" << endl
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=" << param_col << ";" << endl
|
||||||
<< "hp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",5"
|
<< "hp" << LEFT_ARRAY_SUBSCRIPT(output_type) << i << ",5"
|
||||||
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
<< RIGHT_ARRAY_SUBSCRIPT(output_type) << "=";
|
||||||
d2->writeOutput(third_derivs1_output, output_type, params_derivs_temporary_terms, tef_terms);
|
d2->writeOutput(third_derivs1_output, output_type, params_derivs_temporary_terms, params_derivs_temporary_terms_idxs, tef_terms);
|
||||||
third_derivs1_output << ";" << endl;
|
third_derivs1_output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2688,6 +2691,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
||||||
<< "%" << endl
|
<< "%" << endl
|
||||||
<< "% Warning : this file is generated automatically by Dynare" << endl
|
<< "% Warning : this file is generated automatically by Dynare" << endl
|
||||||
<< "% from model file (.mod)" << endl << endl
|
<< "% from model file (.mod)" << endl << endl
|
||||||
|
<< "T = NaN(" << params_derivs_temporary_terms_idxs.size() << ",1);" << endl
|
||||||
<< model_local_vars_output.str()
|
<< model_local_vars_output.str()
|
||||||
<< model_output.str()
|
<< model_output.str()
|
||||||
<< "rp = zeros(" << equations.size() << ", "
|
<< "rp = zeros(" << equations.size() << ", "
|
||||||
|
|
Loading…
Reference in New Issue