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 ...@@ -651,13 +651,15 @@ DataTree::writePowerDeriv(ostream &output, bool use_dll) const
<< "% The k-th derivative of x^p" << endl << "% The k-th derivative of x^p" << endl
<< "%" << endl << "%" << endl
<< "function dxp=getPowerDeriv(x,p,k)" << endl << "function dxp=getPowerDeriv(x,p,k)" << endl
<< "if (abs(x) < " << NEAR_ZERO << ") && (p > 0) && (k >= p) && (abs(p - round(p)) < " << NEAR_ZERO << ")" << endl << " if (abs(x) < " << NEAR_ZERO << ") && (p > 0) && (k >= p) && (abs(p - round(p)) < " << NEAR_ZERO << ")" << endl
<< " dxp = 0;" << endl << " dxp = 0;" << endl
<< "else" << endl << " else" << endl
<< " dxp = x^(p-k);" << endl << " dxp = x^(p-k);" << endl
<< " for i=0:k-1" << endl << " for i=0:k-1" << endl
<< " dxp = dxp*p;" << endl << " dxp = dxp*p;" << endl
<< " p = p-1;" << endl << " p = p-1;" << endl
<< " end" << endl
<< " end" << endl << " end" << endl
<< "end" << endl; << "end" << endl;
} }
...@@ -795,6 +795,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const ...@@ -795,6 +795,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
default: default:
break; break;
} }
output << "end" << endl;
writePowerDeriv(output, false); writePowerDeriv(output, false);
output.close(); output.close();
} }
...@@ -2033,7 +2034,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri ...@@ -2033,7 +2034,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
open_par = false; open_par = false;
mDynamicModelFile << " oo_.endo_simul = y';\n"; mDynamicModelFile << " oo_.endo_simul = y';\n";
mDynamicModelFile << "return;\n"; mDynamicModelFile << "return;\n";
mDynamicModelFile << "end" << endl;
writePowerDeriv(mDynamicModelFile, false); writePowerDeriv(mDynamicModelFile, false);
mDynamicModelFile.close(); mDynamicModelFile.close();
......
...@@ -407,6 +407,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &static_basename) const ...@@ -407,6 +407,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &static_basename) const
default: default:
break; break;
} }
output << "end" << endl;
writePowerDeriv(output, false); writePowerDeriv(output, false);
output.close(); 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