Revert "preprocessor: params_derivs_file: by default, compute second order derivs wrt params; simplify code; #1187"
This reverts commit 1442f83037e9d66a718a0fd446faddae5ebbf58b.issue#70
parent
adf1c0392b
commit
de9d05aac4
14
ModFile.cc
14
ModFile.cc
|
@ -490,11 +490,10 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xr
|
||||||
const bool static_hessian = mod_file_struct.identification_present
|
const bool static_hessian = mod_file_struct.identification_present
|
||||||
|| mod_file_struct.estimation_analytic_derivation;
|
|| mod_file_struct.estimation_analytic_derivation;
|
||||||
FileOutputType paramsDerivatives = none;
|
FileOutputType paramsDerivatives = none;
|
||||||
if (mod_file_struct.identification_present || mod_file_struct.estimation_analytic_derivation)
|
if (mod_file_struct.estimation_analytic_derivation)
|
||||||
if (!sec_order_param_deriv)
|
paramsDerivatives = third;
|
||||||
|
if (mod_file_struct.identification_present || !sec_order_param_deriv)
|
||||||
paramsDerivatives = first;
|
paramsDerivatives = first;
|
||||||
else
|
|
||||||
paramsDerivatives = second;
|
|
||||||
static_model.computingPass(global_eval_context, no_tmp_terms, static_hessian,
|
static_model.computingPass(global_eval_context, no_tmp_terms, static_hessian,
|
||||||
false, paramsDerivatives, block, byte_code);
|
false, paramsDerivatives, block, byte_code);
|
||||||
}
|
}
|
||||||
|
@ -528,11 +527,10 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xr
|
||||||
|| mod_file_struct.estimation_analytic_derivation
|
|| mod_file_struct.estimation_analytic_derivation
|
||||||
|| output == third;
|
|| output == third;
|
||||||
FileOutputType paramsDerivatives = none;
|
FileOutputType paramsDerivatives = none;
|
||||||
if (mod_file_struct.identification_present || mod_file_struct.estimation_analytic_derivation)
|
if (mod_file_struct.estimation_analytic_derivation)
|
||||||
if (!sec_order_param_deriv)
|
paramsDerivatives = third;
|
||||||
|
if (mod_file_struct.identification_present || !sec_order_param_deriv)
|
||||||
paramsDerivatives = first;
|
paramsDerivatives = first;
|
||||||
else
|
|
||||||
paramsDerivatives = second;
|
|
||||||
dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivatives, global_eval_context, no_tmp_terms, block, use_dll, byte_code, compute_xrefs);
|
dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivatives, global_eval_context, no_tmp_terms, block, use_dll, byte_code, compute_xrefs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1659,7 +1659,7 @@ ModelTree::sparseHelper(int order, ostream &output, int row_nb, int col_nb, Expr
|
||||||
void
|
void
|
||||||
ModelTree::computeParamsDerivatives(FileOutputType paramsDerivatives)
|
ModelTree::computeParamsDerivatives(FileOutputType paramsDerivatives)
|
||||||
{
|
{
|
||||||
if (!(paramsDerivatives == first || paramsDerivatives == second))
|
if (!(paramsDerivatives == first || paramsDerivatives == second || paramsDerivatives == third))
|
||||||
return;
|
return;
|
||||||
set<int> deriv_id_set;
|
set<int> deriv_id_set;
|
||||||
addAllParamDerivId(deriv_id_set);
|
addAllParamDerivId(deriv_id_set);
|
||||||
|
@ -1677,7 +1677,7 @@ ModelTree::computeParamsDerivatives(FileOutputType paramsDerivatives)
|
||||||
residuals_params_derivatives[make_pair(eq, param)] = d1;
|
residuals_params_derivatives[make_pair(eq, param)] = d1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paramsDerivatives == second)
|
if (paramsDerivatives == second || paramsDerivatives == third)
|
||||||
for (first_derivatives_t::const_iterator it2 = residuals_params_derivatives.begin();
|
for (first_derivatives_t::const_iterator it2 = residuals_params_derivatives.begin();
|
||||||
it2 != residuals_params_derivatives.end(); it2++)
|
it2 != residuals_params_derivatives.end(); it2++)
|
||||||
{
|
{
|
||||||
|
@ -1704,8 +1704,7 @@ ModelTree::computeParamsDerivatives(FileOutputType paramsDerivatives)
|
||||||
jacobian_params_derivatives[make_pair(eq, make_pair(var, param))] = d2;
|
jacobian_params_derivatives[make_pair(eq, make_pair(var, param))] = d2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paramsDerivatives == second)
|
if (paramsDerivatives == second || paramsDerivatives == third)
|
||||||
{
|
|
||||||
for (second_derivatives_t::const_iterator it2 = jacobian_params_derivatives.begin();
|
for (second_derivatives_t::const_iterator it2 = jacobian_params_derivatives.begin();
|
||||||
it2 != jacobian_params_derivatives.end(); it2++)
|
it2 != jacobian_params_derivatives.end(); it2++)
|
||||||
{
|
{
|
||||||
|
@ -1720,6 +1719,7 @@ ModelTree::computeParamsDerivatives(FileOutputType paramsDerivatives)
|
||||||
jacobian_params_second_derivatives[make_pair(eq, make_pair(var, make_pair(param1, param)))] = d2;
|
jacobian_params_second_derivatives[make_pair(eq, make_pair(var, make_pair(param1, param)))] = d2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (paramsDerivatives == third)
|
||||||
for (second_derivatives_t::const_iterator it2 = second_derivatives.begin();
|
for (second_derivatives_t::const_iterator it2 = second_derivatives.begin();
|
||||||
it2 != second_derivatives.end(); it2++)
|
it2 != second_derivatives.end(); it2++)
|
||||||
{
|
{
|
||||||
|
@ -1735,7 +1735,6 @@ ModelTree::computeParamsDerivatives(FileOutputType paramsDerivatives)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::computeParamsDerivativesTemporaryTerms()
|
ModelTree::computeParamsDerivativesTemporaryTerms()
|
||||||
|
|
Loading…
Reference in New Issue