From 1e4c0852f67d8bb7b68171f133da539c009039a9 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Mon, 18 Jul 2011 14:28:47 +0200 Subject: [PATCH] bug fix: getPowerDeriv not accessible from modfile.m --- DataTree.cc | 22 +--------------------- DynamicModel.cc | 6 ------ StaticModel.cc | 3 --- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/DataTree.cc b/DataTree.cc index 87052a6e..267a97e6 100644 --- a/DataTree.cc +++ b/DataTree.cc @@ -660,10 +660,7 @@ DataTree::writePowerDerivCHeader(ostream &output) const void DataTree::writePowerDeriv(ostream &output, bool use_dll) const { - if (!isBinaryOpUsed(oPowerDeriv)) - return; - - if (use_dll) + if (use_dll && isBinaryOpUsed(oPowerDeriv)) output << "/*" << endl << " * The k-th derivative of x^p" << endl << " */" << endl @@ -683,21 +680,4 @@ DataTree::writePowerDeriv(ostream &output, bool use_dll) const << " return dxp;" << endl << " }" << endl << "}" << endl; - else - output << endl - << "%" << endl - << "% 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 - << " end" << endl - << " end" << endl - << "end" << endl; - } diff --git a/DynamicModel.cc b/DynamicModel.cc index 38f57595..f37bf240 100644 --- a/DynamicModel.cc +++ b/DynamicModel.cc @@ -780,7 +780,6 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const break; } output << "end" << endl; - writePowerDeriv(output, false); output.close(); } } @@ -1513,7 +1512,6 @@ DynamicModel::writeDynamicMFile(const string &dynamic_basename) const writeDynamicModel(mDynamicModelFile, false); mDynamicModelFile << "end" << endl; // Close *_dynamic function - writePowerDeriv(mDynamicModelFile, false); mDynamicModelFile.close(); } @@ -2022,7 +2020,6 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri mDynamicModelFile << " oo_.endo_simul = y';\n"; mDynamicModelFile << "return;\n"; mDynamicModelFile << "end" << endl; - writePowerDeriv(mDynamicModelFile, false); mDynamicModelFile.close(); @@ -3674,9 +3671,6 @@ DynamicModel::writeParamsDerivativesFile(const string &basename) const paramsDerivsFile << "end" << endl << "end" << endl; - - writePowerDeriv(paramsDerivsFile, false); - paramsDerivsFile.close(); } diff --git a/StaticModel.cc b/StaticModel.cc index 0fe9a379..c81f2191 100644 --- a/StaticModel.cc +++ b/StaticModel.cc @@ -396,7 +396,6 @@ StaticModel::writeModelEquationsOrdered_M(const string &static_basename) const break; } output << "end" << endl; - writePowerDeriv(output, false); output.close(); } } @@ -1238,7 +1237,6 @@ StaticModel::writeStaticMFile(const string &func_name) const output << "end" << endl; // Close the if nargout >= 3 statement output << "end" << endl; // Close the *_static function - writePowerDeriv(output, false); output.close(); } @@ -1322,7 +1320,6 @@ StaticModel::writeStaticBlockMFSFile(const string &basename) const } output << " end" << endl << "end" << endl; - writePowerDeriv(output, false); output.close(); }