StaticModel: remove transformation of complex residuals

master
Johannes Pfeifer 2023-07-19 21:10:22 +02:00
parent d95c2f2bd8
commit 5313286db5
2 changed files with 0 additions and 14 deletions

View File

@ -2500,10 +2500,6 @@ ModelTree::writeSparseModelMFiles(const string &basename) const
<< "[T_order, T] = " << full_prefix << "resid_tt(y, x, params" << ss_arg << ", T_order, T);" << endl
<< "residual = NaN(" << equations.size() << ", 1);" << endl
<< d_sparse_output[0].str();
if constexpr(!dynamic)
output << "if ~isreal(residual)" << endl
<< " residual = real(residual)+imag(residual).^2;" << endl
<< "end" << endl;
output << "end" << endl;
output.close();
@ -2534,10 +2530,6 @@ ModelTree::writeSparseModelMFiles(const string &basename) const
<< "[T_order, T] = " << full_prefix << "g1_tt(y, x, params" << ss_arg << ", T_order, T);" << endl
<< "g1_v = NaN(" << jacobian_sparse_column_major_order.size() << ", 1);" << endl
<< d_sparse_output[1].str();
if constexpr(!dynamic)
output << "if ~isreal(g1_v)" << endl
<< " g1_v = real(g1_v)+2*imag(g1_v);" << endl
<< "end" << endl;
// On MATLAB < R2020a, sparse() does not accept int32 indices
output << "if ~isoctave && matlab_ver_less_than('9.8')" << endl
<< " sparse_rowval = double(sparse_rowval);" << endl

View File

@ -227,9 +227,6 @@ StaticModel::writeStaticMFile(const string &basename) const
ostringstream init_output, end_output;
init_output << "residual = zeros(" << equations.size() << ", 1);";
end_output << "if ~isreal(residual)" << endl
<< " residual = real(residual)+imag(residual).^2;" << endl
<< "end";
writeStaticMFileHelper(basename, "static_resid", "residual", "static_resid_tt",
temporary_terms_derivatives[0].size(),
"", init_output, end_output,
@ -238,9 +235,6 @@ StaticModel::writeStaticMFile(const string &basename) const
init_output.str("");
end_output.str("");
init_output << "g1 = zeros(" << equations.size() << ", " << symbol_table.endo_nbr() << ");";
end_output << "if ~isreal(g1)" << endl
<< " g1 = real(g1)+2*imag(g1);" << endl
<< "end";
writeStaticMFileHelper(basename, "static_g1", "g1", "static_g1_tt",
temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size(),
"static_resid_tt",