Jpp  master_rocky
the software that should make you happy
Public Member Functions | Public Attributes | List of all members
JMATH::JFn< JF1_t > Struct Template Reference

forward declaration for division of fuction. More...

#include <JMathlib.hh>

Inheritance diagram for JMATH::JFn< JF1_t >:
JMATH::JMathlib< JFn< JF1_t > >

Public Member Functions

 JFn ()
 Default constructor. More...
 
 JFn (const JF1_t &f1, const int N)
 Constructor. More...
 
template<class ... Args>
double getValue (const Args &...args) const
 Function value. More...
 
double getDerivative (const double x) const
 Derivative value. More...
 
template<class ... Args>
const JFngetGradient (const Args &...args) const
 Get gradient. More...
 
double operator() (const Args &...args) const
 Function value. More...
 

Public Attributes

int N
 

Detailed Description

template<class JF1_t>
struct JMATH::JFn< JF1_t >

forward declaration for division of fuction.

Fixed power of x.

Definition at line 1290 of file JMathlib.hh.

Constructor & Destructor Documentation

◆ JFn() [1/2]

template<class JF1_t >
JMATH::JFn< JF1_t >::JFn ( )
inline

Default constructor.

Definition at line 1301 of file JMathlib.hh.

1301  :
1302  JF1_t(),
1303  N(1)
1304  {}

◆ JFn() [2/2]

template<class JF1_t >
JMATH::JFn< JF1_t >::JFn ( const JF1_t &  f1,
const int  N 
)
inline

Constructor.

Parameters
f1first function
Npower

Definition at line 1313 of file JMathlib.hh.

1313  :
1314  JF1_t(f1),
1315  N(N)
1316  {}
const JPolynome f1(1.0, 2.0, 3.0)
Function.

Member Function Documentation

◆ getValue()

template<class JF1_t >
template<class ... Args>
double JMATH::JFn< JF1_t >::getValue ( const Args &...  args) const
inline

Function value.

Parameters
argsabscissa value(s)
Returns
function value

Definition at line 1326 of file JMathlib.hh.

1327  {
1328  const double u = static_cast<const JF1_t&>(*this).getValue(args...);
1329 
1330  return pow(u, N);
1331  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
double u[N+1]
Definition: JPolint.hh:865

◆ getDerivative()

template<class JF1_t >
double JMATH::JFn< JF1_t >::getDerivative ( const double  x) const
inline

Derivative value.

Parameters
xabscissa value
Returns
derivative value

Definition at line 1340 of file JMathlib.hh.

1341  {
1342  const double u = static_cast<const JF1_t&>(*this).getValue(x);
1343  const double v = static_cast<const JF1_t&>(*this).getDerivative(x);
1344 
1345  return N * pow(u, N - 1) * v;
1346  }
data_type v[N+1][M+1]
Definition: JPolint.hh:866

◆ getGradient()

template<class JF1_t >
template<class ... Args>
const JFn& JMATH::JFn< JF1_t >::getGradient ( const Args &...  args) const
inline

Get gradient.

Parameters
argsabscissa value(s)
Returns
gradient

Definition at line 1356 of file JMathlib.hh.

1357  {
1358  static JFn gradient;
1359 
1360  const double u = static_cast<const JF1_t&>(*this).getValue(args...);
1361  const double w = N * pow(u, N - 1);
1362 
1363  static_cast<JF1_t&>(gradient) = static_cast<const JF1_t&>(*this).getGradient(args...);
1364  static_cast<JF1_t&>(gradient) *= w;
1365 
1366  return gradient;
1367  }
data_type w[N+1][M+1]
Definition: JPolint.hh:867
forward declaration for division of fuction.
Definition: JMathlib.hh:1293

◆ operator()()

double JMATH::JMathlib< JFn< JF1_t > >::operator() ( const Args &...  args) const
inlineinherited

Function value.

Parameters
argsabscissa value(s)
Returns
function value

Definition at line 362 of file JMathlib.hh.

363  {
364  return static_cast<const JF1_t&>(*this).getValue(args...);
365  }

Member Data Documentation

◆ N

template<class JF1_t >
int JMATH::JFn< JF1_t >::N

Definition at line 1369 of file JMathlib.hh.


The documentation for this struct was generated from the following file: