bug fix: getPowerDeriv not accessible from modfile.m

issue#70
Houtan Bastani 2011-07-18 14:28:47 +02:00
parent ed81eb22e9
commit 1e4c0852f6
3 changed files with 1 additions and 30 deletions

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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();
}