Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JMATH::JPow< ID_t, _vF > Struct Template Reference

Power of x. More...

#include <JMathlib.hh>

Inheritance diagram for JMATH::JPow< ID_t, _vF >:
JMATH::JMathlib< JPow< ID_t > > JMATH::JCalculus< JPow< ID_t > >

Public Member Functions

 JPow ()
 Default constructor.
 
 JPow (const double alpha)
 Constructor.
 
double getValue (const double x) const
 Function value.
 
double getDerivative (const double x) const
 Derivative value.
 
const JPowgetGradient (const double x) const
 Get gradient.
 
double operator() (const Args &...args) const
 Function value.
 
JPow< ID_t > & negate ()
 Negate function.
 
JPow< ID_t > & add (const JPow< ID_t > &f1)
 Add function.
 
JPow< ID_t > & sub (const JPow< ID_t > &f1)
 Subtract function.
 
JPow< ID_t > & mul (const double factor)
 Scale function.
 
JPow< ID_t > & div (const double factor)
 Scale function.
 

Public Attributes

double alpha
 x^alpha
 

Static Public Attributes

static const int ID = ID_t
 
static const parameter_list< JPowparameters
 parameters
 

Detailed Description

template<int ID_t>
struct JMATH::JPow< ID_t, _vF >

Power of x.

Definition at line 1907 of file JMathlib.hh.

Constructor & Destructor Documentation

◆ JPow() [1/2]

template<int ID_t>
JMATH::JPow< ID_t, _vF >::JPow ( )
inline

Default constructor.

Definition at line 1917 of file JMathlib.hh.

1917 :
1918 alpha(0.0)
1919 {}

◆ JPow() [2/2]

template<int ID_t>
JMATH::JPow< ID_t, _vF >::JPow ( const double alpha)
inline

Constructor.

Parameters
alphavalue

Definition at line 1927 of file JMathlib.hh.

1927 :
1928 alpha(alpha)
1929 {}

Member Function Documentation

◆ getValue()

template<int ID_t>
double JMATH::JPow< ID_t, _vF >::getValue ( const double x) const
inline

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 1938 of file JMathlib.hh.

1939 {
1940 return pow(x, alpha);
1941 }
T pow(const T &x, const double y)
Power .
Definition JMath.hh:97

◆ getDerivative()

template<int ID_t>
double JMATH::JPow< ID_t, _vF >::getDerivative ( const double x) const
inline

Derivative value.

Parameters
xabscissa value
Returns
derivative value

Definition at line 1950 of file JMathlib.hh.

1951 {
1952 return alpha * pow(x, alpha - 1);
1953 }

◆ getGradient()

template<int ID_t>
const JPow & JMATH::JPow< ID_t, _vF >::getGradient ( const double x) const
inline

Get gradient.

Parameters
xabscissa value
Returns
gradient

Definition at line 1962 of file JMathlib.hh.

1963 {
1964 static JPow gradient; // d(f)/d(a)
1965
1966 gradient.alpha = this->getValue(x) * log(x);
1967
1968 return gradient;
1969 }
double getValue(const double x) const
Function value.
Definition JMathlib.hh:1938
JPow()
Default constructor.
Definition JMathlib.hh:1917

◆ operator()()

double JMATH::JMathlib< JPow< ID_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 }

◆ negate()

JPow< ID_t > & JMATH::JCalculus< JPow< ID_t > >::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()

JPow< ID_t > & JMATH::JCalculus< JPow< ID_t > >::add ( const JPow< ID_t > & 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()

JPow< ID_t > & JMATH::JCalculus< JPow< ID_t > >::sub ( const JPow< ID_t > & 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()

JPow< ID_t > & JMATH::JCalculus< JPow< ID_t > >::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()

JPow< ID_t > & JMATH::JCalculus< JPow< ID_t > >::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

◆ ID

template<int ID_t>
const int JMATH::JPow< ID_t, _vF >::ID = ID_t
static

Definition at line 1911 of file JMathlib.hh.

◆ alpha

template<int ID_t>
double JMATH::JPow< ID_t, _vF >::alpha

x^alpha

Definition at line 1971 of file JMathlib.hh.

◆ parameters

template<int ID_t>
const parameter_list<JPow> JMATH::JPow< ID_t, _vF >::parameters
static

parameters

Definition at line 1972 of file JMathlib.hh.


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