Jpp  19.1.0-rc.1
the software that should make you happy
Public Member Functions | Static Public Attributes | List of all members
JMATH::JXn< N > Struct Template Reference

Fixed power of x. More...

#include <JMathlib.hh>

Inheritance diagram for JMATH::JXn< N >:
JMATH::JMathlib< JXn< N > > JMATH::JCalculus< JXn< N > >

Public Member Functions

 JXn ()
 Default constructor. More...
 
double getValue (const double x) const
 Function value. More...
 
double getDerivative (const double x) const
 Derivative value. More...
 
const JXngetGradient (const double x) const
 Get gradient. More...
 
double operator() (const Args &...args) const
 Function value. More...
 
JXn< N > & negate ()
 Negate function. More...
 
JXn< N > & add (const JXn< N > &f1)
 Add function. More...
 
JXn< N > & sub (const JXn< N > &f1)
 Subtract function. More...
 
JXn< N > & mul (const double factor)
 Scale function. More...
 
JXn< N > & div (const double factor)
 Scale function. More...
 

Static Public Attributes

static const parameter_list< JXnparameters
 parameters More...
 

Detailed Description

template<int N>
struct JMATH::JXn< N >

Fixed power of x.

Definition at line 1986 of file JMathlib.hh.

Constructor & Destructor Documentation

◆ JXn()

template<int N>
JMATH::JXn< N >::JXn ( )
inline

Default constructor.

Definition at line 1993 of file JMathlib.hh.

1994  {}

Member Function Documentation

◆ getValue()

template<int N>
double JMATH::JXn< N >::getValue ( const double  x) const
inline

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 2003 of file JMathlib.hh.

2004  {
2005  return pow(x, N);
2006  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97

◆ getDerivative()

template<int N>
double JMATH::JXn< N >::getDerivative ( const double  x) const
inline

Derivative value.

Parameters
xabscissa value
Returns
derivative value

Definition at line 2015 of file JMathlib.hh.

2016  {
2017  return N * pow(x, N - 1);
2018  }

◆ getGradient()

template<int N>
const JXn& JMATH::JXn< N >::getGradient ( const double  x) const
inline

Get gradient.

Parameters
xabscissa value
Returns
gradient

Definition at line 2027 of file JMathlib.hh.

2028  {
2029  static JXn gradient;
2030 
2031  return gradient;
2032  }
Fixed power of x.
Definition: JMathlib.hh:1989

◆ operator()()

double JMATH::JMathlib< JXn< N > >::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  }

◆ negate()

JXn< N > & JMATH::JCalculus< JXn< N > >::negate ( )
inlineinherited

Negate function.

Returns
this function

Definition at line 203 of file JMathlib.hh.

204  {
205  for (const auto& i : JF1_t::parameters) {
206  static_cast<JF1_t&>(*this).*i = -(static_cast<JF1_t&>(*this).*i);
207  }
208 
209  return static_cast<JF1_t&>(*this);
210  }

◆ add()

JXn< N > & JMATH::JCalculus< JXn< N > >::add ( const JXn< N > &  f1)
inlineinherited

Add function.

Parameters
f1function
Returns
this function

Definition at line 219 of file JMathlib.hh.

220  {
221  for (const auto& i : JF1_t::parameters) {
222  static_cast<JF1_t&>(*this).*i += f1.*i;
223  }
224 
225  return static_cast<JF1_t&>(*this);
226  }
const JPolynome f1(1.0, 2.0, 3.0)
Function.

◆ sub()

JXn< N > & JMATH::JCalculus< JXn< N > >::sub ( const JXn< N > &  f1)
inlineinherited

Subtract function.

Parameters
f1function
Returns
this function

Definition at line 235 of file JMathlib.hh.

236  {
237  for (const auto& i : JF1_t::parameters) {
238  static_cast<JF1_t&>(*this).*i -= f1.*i;
239  }
240 
241  return static_cast<JF1_t&>(*this);
242  }

◆ mul()

JXn< N > & JMATH::JCalculus< JXn< N > >::mul ( const double  factor)
inlineinherited

Scale function.

Parameters
factorfactor
Returns
this function

Definition at line 251 of file JMathlib.hh.

252  {
253  for (const auto& i : JF1_t::parameters) {
254  static_cast<JF1_t&>(*this).*i *= factor;
255  }
256 
257  return static_cast<JF1_t&>(*this);
258  }

◆ div()

JXn< N > & JMATH::JCalculus< JXn< N > >::div ( const double  factor)
inlineinherited

Scale function.

Parameters
factorfactor
Returns
this function

Definition at line 267 of file JMathlib.hh.

268  {
269  for (const auto& i : JF1_t::parameters) {
270  static_cast<JF1_t&>(*this).*i /= factor;
271  }
272 
273  return static_cast<JF1_t&>(*this);
274  }

Member Data Documentation

◆ parameters

template<int N>
const parameter_list< JXn< N > > JMATH::JXn< N >::parameters
static

parameters

Set parameters.

Definition at line 2034 of file JMathlib.hh.


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