25double const CoreFunction::PI = 4.0 * atan(1.0);
26double const CoreFunction::PI_2 = 2.0 * atan(1.0);
27double const CoreFunction::E = exp(1.0);
29CoreFunction::CoreFunction() : type (
Type::POLY2 ),
30#ifndef N2P2_NO_ASYM_POLY
81 throw invalid_argument(
"ERROR: Unknown core function.\n");
99 throw invalid_argument(
"ERROR: Unknown CoreFunction type.\n");
113 v.push_back(
strpr(
"CoreFunction::Type::COS (%d):\n",
type));
114 v.push_back(
"f(x) := 1/2 * (cos(pi*x) + 1)\n");
118 v.push_back(
strpr(
"CoreFunction::Type::POLY1 (%d):\n",
type));
119 v.push_back(
"f(x) := (2x - 3)x^2 + 1\n");
123 v.push_back(
strpr(
"CoreFunction::Type::POLY2 (%d):\n",
type));
124 v.push_back(
"f(x) := ((15 - 6x)x - 10)x^3 + 1\n");
128 v.push_back(
strpr(
"CoreFunction::Type::POLY3 (%d):\n",
type));
129 v.push_back(
"f(x) := (x(x(20x - 70) + 84) - 35)x^4 + 1\n");
133 v.push_back(
strpr(
"CoreFunction::Type::POLY4 (%d):\n",
type));
134 v.push_back(
"f(x) := (x(x((315 - 70x)x - 540) + 420) - 126)x^5 + 1\n");
138 v.push_back(
strpr(
"CoreFunction::Type::EXP (%d):\n",
type));
139 v.push_back(
"f(x) := exp(-1 / 1 - x^2)\n");
double fPOLY4(double x) const
double dfPOLY2(double x) const
double fCOS(double x) const
void fdfEXP(double x, double &fx, double &dfx) const
std::vector< std::string > info() const
Get string with formula of compact function.
double fPOLY1(double x) const
Type type
Core function type.
void fdfPOLY3(double x, double &fx, double &dfx) const
double dfPOLY4(double x) const
void(CoreFunction::* fdfPtr)(double x, double &fx, double &dfx) const
Function pointer to fdf.
double dfEXP(double x) const
double(CoreFunction::* dfPtr)(double x) const
Function pointer to df.
double dfPOLY3(double x) const
double fEXP(double x) const
void fdfPOLY4(double x, double &fx, double &dfx) const
double dfCOS(double x) const
void fdfPOLY1(double x, double &fx, double &dfx) const
void setType(Type const type)
Set function type.
void fdfCOS(double x, double &fx, double &dfx) const
double fPOLY2(double x) const
void fdfPOLY2(double x, double &fx, double &dfx) const
double dfPOLY1(double x) const
Type
List of available function types.
double fPOLY3(double x) const
double(CoreFunction::* fPtr)(double x) const
Function pointer to f.
string strpr(const char *format,...)
String version of printf function.