Julia: drop get_power_deriv function from module

The function is now provided separately by Dynare.jl.
master
Sébastien Villemot 2022-09-26 13:09:33 +02:00
parent 4ae6df494d
commit 762243c705
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
4 changed files with 2 additions and 34 deletions

View File

@ -917,26 +917,6 @@ DataTree::writePowerDeriv(ostream &output) const
<< "}" << endl;
}
void
DataTree::writePowerDerivJulia(ostream &output) const
{
if (isBinaryOpUsed(BinaryOpcode::powerDeriv))
output << "nearbyint(x::T) where T <: Real = (abs((x)-floor(x)) < abs((x)-ceil(x)) ? floor(x) : ceil(x))" << endl
<< endl
<< "function get_power_deriv(x::T, p::T, k::Int64) where T <: Real" << endl
<< " if (abs(x) < 1e-12 && p > 0 && k > p && abs(p-nearbyint(p)) < 1e-12 )" << endl
<< " return 0.0" << endl
<< " else" << endl
<< " dxp = x^(p-k)" << endl
<< " for i = 1:k" << endl
<< " dxp *= p" << endl
<< " p -= 1" << endl
<< " end" << endl
<< " return dxp" << endl
<< " end" << endl
<< "end" << endl;
}
void
DataTree::writePowerDerivHeader(ostream &output) const
{

View File

@ -281,8 +281,6 @@ public:
void writePowerDeriv(ostream &output) const;
//! Write getPowerDeriv in C (prototype)
void writePowerDerivHeader(ostream &output) const;
//! Write getPowerDeriv in Julia
void writePowerDerivJulia(ostream &output) const;
//! Thrown when trying to access an unknown variable by deriv_id
class UnknownDerivIDException
{

View File

@ -930,12 +930,7 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
<< " dynamicResid!(T, residual, y, x, params, steady_state, it_, false)" << endl
<< " return nothing" << endl
<< "end" << endl
<< endl;
// Write function definition if BinaryOpcode::powerDeriv is used
writePowerDerivJulia(output);
output << "end" << endl;
<< "end" << endl;
writeToFileIfModified(output, basename + "Dynamic.jl");
}

View File

@ -818,12 +818,7 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
<< " staticResid!(T, residual, y, x, params, false)" << endl
<< " return nothing" << endl
<< "end" << endl
<< endl;
// Write function definition if BinaryOpcode::powerDeriv is used
writePowerDerivJulia(output);
output << "end" << endl;
<< "end" << endl;
writeToFileIfModified(output, basename + "Static.jl");
}