Jpp 21.0.0-rc.3
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.
 
template<class T >
 JPolynome (const std::array< T, 1 > &args)
 Constructor.
 
template<class T >
void set (const std::array< T, 1 > &args)
 Set value.
 
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.
 

Static Public Member Functions

static size_t size ()
 Get size of parameter.
 

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}
 

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

1895 :
1896 a(0.0)
1897 {}

◆ JPolynome() [2/3]

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

Constructor.

Parameters
avalue

Definition at line 1905 of file JMathlib.hh.

1905 :
1906 a(a)
1907 {}

◆ JPolynome() [3/3]

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

Constructor.

Parameters
argslist of values

Definition at line 1916 of file JMathlib.hh.

1916 :
1917 JPolynome()
1918 {
1919 set(args);
1920 }
void set(const std::array< T, 1 > &args)
Set value.
Definition JMathlib.hh:1929
JPolynome()
Default constructor.
Definition JMathlib.hh:1895

Member Function Documentation

◆ set()

template<int ID_t>
template<class T >
void JMATH::JPolynome< ID_t, 0 >::set ( const std::array< T, 1 > & args)
inline

Set value.

Parameters
argsvalue

Definition at line 1929 of file JMathlib.hh.

1930 {
1931 a = args[0];
1932 }

◆ getValue()

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

Function value.

Returns
function value

Definition at line 1940 of file JMathlib.hh.

1941 {
1942 return a;
1943 }

◆ getDerivative()

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

Derivative value.

Returns
derivative value

Definition at line 1951 of file JMathlib.hh.

1952 {
1953 return 0.0;
1954 }

◆ getGradient()

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

Get gradient.

Returns
gradient

Definition at line 1962 of file JMathlib.hh.

1963 {
1964 JPolynome gradient;
1965
1966 gradient.a = 1.0;
1967
1968 return gradient;
1969 }

◆ 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 }

◆ size()

static size_t JMATH::JMathlib< JPolynome< ID_t, 0 > >::size ( )
inlinestaticinherited

Get size of parameter.

Returns
size

Definition at line 538 of file JMathlib.hh.

539 {
540 return JF1_t::parameters.size();
541 }

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

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

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

563 {
564 return static_cast<JF1_t&>(*this).*JF1_t::parameters[i];
565 }

◆ negate()

JPolynome< ID_t, 0 > & JMATH::JCalculus< JPolynome< ID_t, 0 > >::negate ( )
inlineinherited

Negate function.

Returns
this function

Definition at line 170 of file JMathlib.hh.

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

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

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

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

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

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

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

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

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

Member Data Documentation

◆ ID

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

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

◆ a

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

a[0]

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

1973{&JPolynome::a};

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