Fixed power of function.
More...
#include <JMathlib.hh>
|
| | JFn () |
| | Default constructor.
|
| |
| | JFn (const JF1_t &f1, const int N) |
| | Constructor.
|
| |
| template<class ... Args> |
| double | getValue (const Args &...args) const |
| | Function value.
|
| |
| double | getDerivative (const double x) const |
| | Derivative value.
|
| |
| template<class ... Args> |
| JFn | getGradient (const Args &...args) const |
| | Get gradient.
|
| |
| double | operator() (const Args &...args) const |
| | Function value.
|
| |
| double | operator[] (const size_t i) const |
| | Get value of parameter at given index.
|
| |
| double & | operator[] (const size_t i) |
| | Get value of parameter at given index.
|
| |
template<class JF1_t>
struct JMATH::JFn< JF1_t >
Fixed power of function.
Definition at line 1418 of file JMathlib.hh.
◆ JFn() [1/2]
Default constructor.
Definition at line 1430 of file JMathlib.hh.
1430 :
1431 JF1_t(),
1433 {}
◆ JFn() [2/2]
template<class JF1_t >
| JMATH::JFn< JF1_t >::JFn |
( |
const JF1_t & | f1, |
|
|
const int | N ) |
|
inline |
Constructor.
- Parameters
-
Definition at line 1442 of file JMathlib.hh.
1442 :
1443 JF1_t(f1),
1445 {}
◆ getValue()
template<class JF1_t >
template<class ... Args>
| double JMATH::JFn< JF1_t >::getValue |
( |
const Args &... | args | ) |
const |
|
inline |
Function value.
- Parameters
-
- Returns
- function value
Definition at line 1455 of file JMathlib.hh.
1456 {
1457 const double u =
static_cast<const JF1_t&
>(*this).getValue(
args...);
1458
1460 }
T pow(const T &x, const double y)
Power .
◆ getDerivative()
template<class JF1_t >
| double JMATH::JFn< JF1_t >::getDerivative |
( |
const double | x | ) |
const |
|
inline |
Derivative value.
- Parameters
-
- Returns
- derivative value
Definition at line 1469 of file JMathlib.hh.
1470 {
1471 const double u = static_cast<const JF1_t&>(*this).getValue(x);
1472 const double v = static_cast<const JF1_t&>(*this).getDerivative(x);
1473
1474 return N *
pow(u,
N - 1) * v;
1475 }
◆ getGradient()
template<class JF1_t >
template<class ... Args>
| JFn JMATH::JFn< JF1_t >::getGradient |
( |
const Args &... | args | ) |
const |
|
inline |
Get gradient.
- Parameters
-
- Returns
- gradient
Definition at line 1485 of file JMathlib.hh.
1486 {
1488
1489 const double u =
static_cast<const JF1_t&
>(*this).getValue(
args...);
1490 const double w =
N *
pow(u,
N - 1);
1491
1492 static_cast<JF1_t&
>(gradient) =
static_cast<const JF1_t&
>(*this).getGradient(
args...);
1493 static_cast<JF1_t&>(gradient) *= w;
1494
1495 return gradient;
1496 }
JFn()
Default constructor.
◆ operator()()
Function value.
- Parameters
-
- Returns
- function value
Definition at line 330 of file JMathlib.hh.
331 {
332 return static_cast<const JF1_t&
>(*this).getValue(
args...);
333 }
◆ operator[]() [1/2]
Get value of parameter at given index.
- Parameters
-
- Returns
- value
Definition at line 538 of file JMathlib.hh.
539 {
540 return static_cast<const JF1_t&>(*this).*JF1_t::parameters[i];
541 }
◆ operator[]() [2/2]
Get value of parameter at given index.
- Parameters
-
- Returns
- value
Definition at line 550 of file JMathlib.hh.
551 {
552 return static_cast<JF1_t&>(*this).*JF1_t::parameters[i];
553 }
The documentation for this struct was generated from the following file: