Jpp  debug
the software that should make you happy
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
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. More...
 
 JGauss (const double center, const double sigma)
 Constructor. More...
 
double getValue (const double x) const
 Function value. More...
 
double getDerivative (const double x) const
 Derivative value. More...
 
const JGaussgetGradient (const double x) const
 Get gradient. More...
 
double operator() (const Args &...args) const
 Function value. More...
 
JGauss< ID_t, true > & negate ()
 Negate function. More...
 
JGauss< ID_t, true > & add (const JGauss< ID_t, true > &f1)
 Add function. More...
 
JGauss< ID_t, true > & sub (const JGauss< ID_t, true > &f1)
 Subtract function. More...
 
JGauss< ID_t, true > & mul (const double factor)
 Scale function. More...
 
JGauss< ID_t, true > & div (const double factor)
 Scale function. More...
 

Public Attributes

double center
 center More...
 
double sigma
 sigma More...
 

Static Public Attributes

static const int ID = ID_t
 
static const parameter_list< JGaussparameters = { &JGauss<ID_t, true>::center, &JGauss<ID_t, true>::sigma }
 parameters More...
 

Private Member Functions

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

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 u[N+1]
Definition: JPolint.hh:865
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  }
data_type w[N+1][M+1]
Definition: JPolint.hh:867

◆ 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  }
Gauss function object.
Definition: JGauss.hh:175
double sigma
sigma
Definition: JMathlib.hh:1665
double center
center
Definition: JMathlib.hh:1664

◆ 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  }
static const double PI
Mathematical constants.

◆ 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< ID_t, true > > JMATH::JGauss< ID_t, true >::parameters = { &JGauss<ID_t, true>::center, &JGauss<ID_t, true>::sigma }
static

parameters

Set parameters.

Definition at line 1772 of file JMathlib.hh.


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