Commit d8dbc68e authored by Ferhat Mihoubi's avatar Ferhat Mihoubi

- The function getPowerDeriv must end with an "end" instruction

parent 77c3d668
......@@ -651,13 +651,15 @@ DataTree::writePowerDeriv(ostream &output, bool use_dll) const
<< "% The k-th derivative of x^p" << endl
<< "%" << endl
<< "function dxp=getPowerDeriv(x,p,k)" << endl
<< "if (abs(x) < " << NEAR_ZERO << ") && (p > 0) && (k >= p) && (abs(p - round(p)) < " << NEAR_ZERO << ")" << endl
<< " dxp = 0;" << endl
<< "else" << endl
<< " dxp = x^(p-k);" << endl
<< " for i=0:k-1" << endl
<< " dxp = dxp*p;" << endl
<< " p = p-1;" << endl
<< " if (abs(x) < " << NEAR_ZERO << ") && (p > 0) && (k >= p) && (abs(p - round(p)) < " << NEAR_ZERO << ")" << endl
<< " dxp = 0;" << endl
<< " else" << endl
<< " dxp = x^(p-k);" << endl
<< " for i=0:k-1" << endl
<< " dxp = dxp*p;" << endl
<< " p = p-1;" << endl
<< " end" << endl
<< " end" << endl
<< "end" << endl;
}
......@@ -795,6 +795,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
default:
break;
}
output << "end" << endl;
writePowerDeriv(output, false);
output.close();
}
......@@ -2033,7 +2034,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
open_par = false;
mDynamicModelFile << " oo_.endo_simul = y';\n";
mDynamicModelFile << "return;\n";
mDynamicModelFile << "end" << endl;
writePowerDeriv(mDynamicModelFile, false);
mDynamicModelFile.close();
......
......@@ -407,6 +407,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &static_basename) const
default:
break;
}
output << "end" << endl;
writePowerDeriv(output, false);
output.close();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment