Jpp 21.0.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JMATH::JPf< JF1_t > Struct Template Reference

forward declaration for fixed power of function. More...

#include <JMathlib.hh>

Inheritance diagram for JMATH::JPf< JF1_t >:
JMATH::JMathlib< JPf< JF1_t > > JMATH::JCalculus< JPf< JF1_t > >

Public Member Functions

 JPf ()
 Default constructor.
 
 JPf (const JF1_t *f1)
 Constructor.
 
template<class ... Args>
double getValue (const Args &...args) const
 Function value.
 
double getDerivative (const double x) const
 Derivative value.
 
template<class ... Args>
JPf 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.
 
JF1_t & negate ()
 Negate function.
 
JF1_t & add (const JF1_t &f1)
 Add function.
 
JF1_t & sub (const JF1_t &f1)
 Subtract function.
 
JF1_t & mul (const double factor)
 Scale function.
 
JF1_t & div (const double factor)
 Scale function.
 

Static Public Attributes

static constexpr parameter_list< JPf, 0 > parameters {}
 

Private Attributes

const JF1_t * f1
 

Detailed Description

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

forward declaration for fixed power of function.

Pointer to function.

Definition at line 1629 of file JMathlib.hh.

Constructor & Destructor Documentation

◆ JPf() [1/2]

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

Default constructor.

Definition at line 1641 of file JMathlib.hh.

1641 :
1642 f1(NULL)
1643 {}
const JF1_t * f1
Definition JMathlib.hh:1698

◆ JPf() [2/2]

template<class JF1_t >
JMATH::JPf< JF1_t >::JPf ( const JF1_t * f1)
inline

Constructor.

Parameters
f1pointer to function

Definition at line 1651 of file JMathlib.hh.

1651 :
1652 f1(f1)
1653 {}

Member Function Documentation

◆ getValue()

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

Function value.

Parameters
argsabscissa value(s)
Returns
function value

Definition at line 1663 of file JMathlib.hh.

1664 {
1665 return f1->getValue(args...);
1666 }

◆ getDerivative()

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

Derivative value.

Parameters
xabscissa value
Returns
derivative value

Definition at line 1675 of file JMathlib.hh.

1676 {
1677 return f1->getDerivative(x);
1678 }

◆ getGradient()

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

Get gradient.

Parameters
argsabscissa value(s)
Returns
gradient

Definition at line 1688 of file JMathlib.hh.

1689 {
1690 JPf gradient;
1691
1692 return gradient;
1693 }
JPf()
Default constructor.
Definition JMathlib.hh:1641

◆ operator()()

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

Function value.

Parameters
argsabscissa value(s)
Returns
function value

Definition at line 331 of file JMathlib.hh.

332 {
333 return static_cast<const JF1_t&>(*this).getValue(args...);
334 }

◆ operator[]() [1/2]

double JMATH::JMathlib< JF1_t >::operator[] ( const size_t i) const
inlineinherited

Get value of parameter at given index.

Parameters
iindex
Returns
value

Definition at line 539 of file JMathlib.hh.

540 {
541 return static_cast<const JF1_t&>(*this).*JF1_t::parameters[i];
542 }

◆ operator[]() [2/2]

double & JMATH::JMathlib< JF1_t >::operator[] ( const size_t i)
inlineinherited

Get value of parameter at given index.

Parameters
iindex
Returns
value

Definition at line 551 of file JMathlib.hh.

552 {
553 return static_cast<JF1_t&>(*this).*JF1_t::parameters[i];
554 }

◆ negate()

JF1_t & JMATH::JCalculus< JF1_t >::negate ( )
inlineinherited

Negate function.

Returns
this function

Definition at line 169 of file JMathlib.hh.

170 {
171 for (const auto& i : JF1_t::parameters) {
172 static_cast<JF1_t&>(*this).*i = -(static_cast<JF1_t&>(*this).*i);
173 }
174
175 return static_cast<JF1_t&>(*this);
176 }

◆ add()

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

Add function.

Parameters
f1function
Returns
this function

Definition at line 185 of file JMathlib.hh.

186 {
187 for (const auto& i : JF1_t::parameters) {
188 static_cast<JF1_t&>(*this).*i += f1.*i;
189 }
190
191 return static_cast<JF1_t&>(*this);
192 }

◆ sub()

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

Subtract function.

Parameters
f1function
Returns
this function

Definition at line 201 of file JMathlib.hh.

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

◆ mul()

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

Scale function.

Parameters
factorfactor
Returns
this function

Definition at line 217 of file JMathlib.hh.

218 {
219 for (const auto& i : JF1_t::parameters) {
220 static_cast<JF1_t&>(*this).*i *= factor;
221 }
222
223 return static_cast<JF1_t&>(*this);
224 }

◆ div()

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

Scale function.

Parameters
factorfactor
Returns
this function

Definition at line 233 of file JMathlib.hh.

234 {
235 for (const auto& i : JF1_t::parameters) {
236 static_cast<JF1_t&>(*this).*i /= factor;
237 }
238
239 return static_cast<JF1_t&>(*this);
240 }

Member Data Documentation

◆ parameters

template<class JF1_t >
parameter_list<JPf, 0> JMATH::JPf< JF1_t >::parameters {}
staticconstexpr

Definition at line 1695 of file JMathlib.hh.

1695{};

◆ f1

template<class JF1_t >
const JF1_t* JMATH::JPf< JF1_t >::f1
private

Definition at line 1698 of file JMathlib.hh.


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