Jpp 21.0.0-rc.1-88-g0130508c4
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 1833 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 1845 of file JMathlib.hh.

1845 :
1846 a(0.0)
1847 {}

◆ JPolynome() [2/3]

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

Constructor.

Parameters
avalue

Definition at line 1855 of file JMathlib.hh.

1855 :
1856 a(a)
1857 {}

◆ 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 1865 of file JMathlib.hh.

1865 :
1866 JPolynome()
1867 {
1868 a = std::data(args)[0];
1869 }
JPolynome()
Default constructor.
Definition JMathlib.hh:1845

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 1877 of file JMathlib.hh.

1878 {
1879 return a;
1880 }

◆ getDerivative()

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

Derivative value.

Returns
derivative value

Definition at line 1888 of file JMathlib.hh.

1889 {
1890 return 0.0;
1891 }

◆ getGradient()

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

Get gradient.

Returns
gradient

Definition at line 1899 of file JMathlib.hh.

1900 {
1901 JPolynome gradient;
1902
1903 gradient.a = 1.0;
1904
1905 return gradient;
1906 }

◆ 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 1918 of file JMathlib.hh.

1919 {
1920 a = x;
1921 }

◆ 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 330 of file JMathlib.hh.

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

◆ 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 538 of file JMathlib.hh.

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

◆ 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 550 of file JMathlib.hh.

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

◆ 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 1837 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 1839 of file JMathlib.hh.

◆ a

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

a[0]

Definition at line 1908 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 1910 of file JMathlib.hh.

1910{&JPolynome::a};

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