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

Termination class for polynomial function. More...

#include <JMathlib.hh>

Inheritance diagram for JMATH::JPolynome< ID_t, 0 >:
JMATH::JMathlib< JPolynome< ID_t, 0 > > JMATH::JCalculus< JPolynome< ID_t, 0 > > JMATH::JExp< JPolynome< ID_t, 0 > >

Public Member Functions

 JPolynome ()
 Default constructor.
 
 JPolynome (const double a)
 Constructor.
 
 JPolynome (const std::array< double, 1 > &args)
 Constructor.
 
double getValue (...) const
 Function value.
 
double getDerivative (...) const
 Derivative value.
 
JPolynome getGradient (...) 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.
 
JPolynome< ID_t, 0 > & negate ()
 Negate function.
 
JPolynome< ID_t, 0 > & add (const JPolynome< ID_t, 0 > &f1)
 Add function.
 
JPolynome< ID_t, 0 > & sub (const JPolynome< ID_t, 0 > &f1)
 Subtract function.
 
JPolynome< ID_t, 0 > & mul (const double factor)
 Scale function.
 
JPolynome< ID_t, 0 > & div (const double factor)
 Scale function.
 

Public Attributes

double a
 a[0]
 

Static Public Attributes

static const int ID = ID_t
 
static const size_t NUMBER_OF_DEGREES = 0
 
static constexpr parameter_list< JPolynome, 1 > parameters {&JPolynome::a}
 

Protected Member Functions

void set (const double x)
 Recursive method for setting values.
 

Detailed Description

template<int ID_t>
struct JMATH::JPolynome< ID_t, 0 >

Termination class for polynomial function.

This function consititutes a constant term and is thereby multi-dimensional by nature.

Definition at line 1826 of file JMathlib.hh.

Constructor & Destructor Documentation

◆ JPolynome() [1/3]

template<int ID_t>
JMATH::JPolynome< ID_t, 0 >::JPolynome ( )
inline

Default constructor.

Definition at line 1838 of file JMathlib.hh.

1838 :
1839 a(0.0)
1840 {}

◆ JPolynome() [2/3]

template<int ID_t>
JMATH::JPolynome< ID_t, 0 >::JPolynome ( const double a)
inline

Constructor.

Parameters
avalue

Definition at line 1848 of file JMathlib.hh.

1848 :
1849 a(a)
1850 {}

◆ JPolynome() [3/3]

template<int ID_t>
JMATH::JPolynome< ID_t, 0 >::JPolynome ( const std::array< double, 1 > & args)
inline

Constructor.

Parameters
argslist of values

Definition at line 1858 of file JMathlib.hh.

1858 :
1859 JPolynome()
1860 {
1861 a = std::data(args)[0];
1862 }
JPolynome()
Default constructor.
Definition JMathlib.hh:1838

Member Function Documentation

◆ getValue()

template<int ID_t>
double JMATH::JPolynome< ID_t, 0 >::getValue ( ...) const
inline

Function value.

Returns
function value

Definition at line 1870 of file JMathlib.hh.

1871 {
1872 return a;
1873 }

◆ getDerivative()

template<int ID_t>
double JMATH::JPolynome< ID_t, 0 >::getDerivative ( ...) const
inline

Derivative value.

Returns
derivative value

Definition at line 1881 of file JMathlib.hh.

1882 {
1883 return 0.0;
1884 }

◆ getGradient()

template<int ID_t>
JPolynome JMATH::JPolynome< ID_t, 0 >::getGradient ( ...) const
inline

Get gradient.

Returns
gradient

Definition at line 1892 of file JMathlib.hh.

1893 {
1894 JPolynome gradient;
1895
1896 gradient.a = 1.0;
1897
1898 return gradient;
1899 }

◆ set()

template<int ID_t>
void JMATH::JPolynome< ID_t, 0 >::set ( const double x)
inlineprotected

Recursive method for setting values.

Parameters
xvalue

Definition at line 1911 of file JMathlib.hh.

1912 {
1913 a = x;
1914 }

◆ operator()()

double JMATH::JMathlib< JPolynome< ID_t, 0 > >::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< JPolynome< ID_t, 0 > >::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< JPolynome< ID_t, 0 > >::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()

JPolynome< ID_t, 0 > & JMATH::JCalculus< JPolynome< ID_t, 0 > >::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()

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

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

JPolynome< ID_t, 0 > & JMATH::JCalculus< JPolynome< ID_t, 0 > >::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()

JPolynome< ID_t, 0 > & JMATH::JCalculus< JPolynome< ID_t, 0 > >::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

◆ ID

template<int ID_t>
const int JMATH::JPolynome< ID_t, 0 >::ID = ID_t
static

Definition at line 1830 of file JMathlib.hh.

◆ NUMBER_OF_DEGREES

template<int ID_t>
const size_t JMATH::JPolynome< ID_t, 0 >::NUMBER_OF_DEGREES = 0
static

Definition at line 1832 of file JMathlib.hh.

◆ a

template<int ID_t>
double JMATH::JPolynome< ID_t, 0 >::a

a[0]

Definition at line 1901 of file JMathlib.hh.

◆ parameters

template<int ID_t>
parameter_list<JPolynome, 1> JMATH::JPolynome< ID_t, 0 >::parameters {&JPolynome::a}
staticconstexpr

Definition at line 1903 of file JMathlib.hh.

1903{&JPolynome::a};

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