Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JMATH::JGauss< ID_t, true > Struct Template Reference

Gauss function. More...

#include <JMathlib.hh>

Inheritance diagram for JMATH::JGauss< ID_t, true >:
JMATH::JMathlib< JGauss< ID_t, true > > JMATH::JCalculus< JGauss< ID_t, true > >

Public Member Functions

 JGauss ()
 Default constructor.
 
 JGauss (const double center, const double sigma)
 Constructor.
 
double getValue (const double x) const
 Function value.
 
double getDerivative (const double x) const
 Derivative value.
 
const JGaussgetGradient (const double x) const
 Get gradient.
 
double operator() (const Args &...args) const
 Function value.
 
JGauss< ID_t, true > & negate ()
 Negate function.
 
JGauss< ID_t, true > & add (const JGauss< ID_t, true > &f1)
 Add function.
 
JGauss< ID_t, true > & sub (const JGauss< ID_t, true > &f1)
 Subtract function.
 
JGauss< ID_t, true > & mul (const double factor)
 Scale function.
 
JGauss< ID_t, true > & div (const double factor)
 Scale function.
 

Public Attributes

double center
 center
 
double sigma
 sigma
 

Static Public Attributes

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

Private Member Functions

double get (const double u) const
 Get ordinate value.
 

Detailed Description

template<int ID_t>
struct JMATH::JGauss< ID_t, true >

Gauss function.

Definition at line 1692 of file JMathlib.hh.

Constructor & Destructor Documentation

◆ JGauss() [1/2]

template<int ID_t>
JMATH::JGauss< ID_t, true >::JGauss ( )
inline

Default constructor.

Definition at line 1702 of file JMathlib.hh.

1702 :
1703 center(0.0),
1704 sigma (0.0)
1705 {}

◆ JGauss() [2/2]

template<int ID_t>
JMATH::JGauss< ID_t, true >::JGauss ( const double center,
const double sigma )
inline

Constructor.

Parameters
centercenter
sigmasigma

Definition at line 1714 of file JMathlib.hh.

1715 :
1716 center(center),
1717 sigma (sigma)
1718 {}

Member Function Documentation

◆ getValue()

template<int ID_t>
double JMATH::JGauss< ID_t, true >::getValue ( const double x) const
inline

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 1727 of file JMathlib.hh.

1728 {
1729 const double u = (x - center) / sigma;
1730
1731 return get(u);
1732 }
double get(const double u) const
Get ordinate value.
Definition JMathlib.hh:1781

◆ getDerivative()

template<int ID_t>
double JMATH::JGauss< ID_t, true >::getDerivative ( const double x) const
inline

Derivative value.

Parameters
xabscissa value
Returns
derivative value

Definition at line 1741 of file JMathlib.hh.

1742 {
1743 const double w = 1.0 / sigma;
1744 const double u = (x - center) / sigma;
1745
1746 return get(u) * -u * w;
1747 }

◆ getGradient()

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

Get gradient.

Parameters
xabscissa value
Returns
gradient

Definition at line 1756 of file JMathlib.hh.

1757 {
1758 static JGauss gradient;
1759
1760 const double w = 1.0 / sigma;
1761 const double u = (x - center) * w;
1762 const double f0 = get(u);
1763
1764 gradient.center = f0 * (u) * w; // d(f)/d(center)
1765 gradient.sigma = f0 * (u + 1.0) * (u - 1.0) * w; // d(f)/d(sigma)
1766
1767 return gradient;
1768 }

◆ get()

template<int ID_t>
double JMATH::JGauss< ID_t, true >::get ( const double u) const
inlineprivate

Get ordinate value.

Parameters
uabscissa value
Returns
ordinate value

Definition at line 1781 of file JMathlib.hh.

1782 {
1783 return exp(-0.5*u*u) / (sqrt(2.0*PI) * sigma);
1784 }

◆ operator()()

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

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

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

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

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

JGauss< ID_t, true > & JMATH::JCalculus< JGauss< ID_t, true > >::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::JGauss< ID_t, true >::ID = ID_t
static

Definition at line 1696 of file JMathlib.hh.

◆ center

template<int ID_t>
double JMATH::JGauss< ID_t, true >::center

center

Definition at line 1770 of file JMathlib.hh.

◆ sigma

template<int ID_t>
double JMATH::JGauss< ID_t, true >::sigma

sigma

Definition at line 1771 of file JMathlib.hh.

◆ parameters

template<int ID_t>
const parameter_list<JGauss> JMATH::JGauss< ID_t, true >::parameters
static

parameters

Definition at line 1772 of file JMathlib.hh.


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