INET Framework for OMNeT++/OMNEST
inet::math::GaussFunction< R, X > Class Template Reference

The one-dimensional Gauss function. More...

#include <PrimitiveFunctions.h>

Inheritance diagram for inet::math::GaussFunction< R, X >:
inet::math::FunctionBase< R, Domain< X > > inet::math::IFunction< R, Domain< X > >

Public Member Functions

 GaussFunction (X mean, X stddev)
 
virtual R getValue (const Point< X > &p) const override
 
- Public Member Functions inherited from inet::math::FunctionBase< R, Domain< X > >
virtual void partition (const typename Domain< X > ::I &i, const std::function< void(const typename Domain< X > ::I &, const IFunction< R, Domain< X > > *)> callback) const override
 Subdivides the provided domain and calls back f with the subdomains and the corresponding potentially simpler domain limited functions. More...
 
virtual Interval< R > getRange () const override
 Returns the valid range of the function as an interval. More...
 
virtual Interval< R > getRange (const typename Domain< X > ::I &i) const override
 Returns the valid range of the function as an interval for the given domain. More...
 
virtual Domain< X > ::I getDomain () const override
 Returns the valid domain of the function as an interval. More...
 
virtual bool isFinite () const override
 Returns true if the function value is finite in the whole domain. More...
 
virtual bool isFinite (const typename Domain< X > ::I &i) const override
 Returns true if the function value is finite in the given domain. More...
 
virtual bool isNonZero () const override
 Returns true if the function value is non-zero in the whole domain. More...
 
virtual bool isNonZero (const typename Domain< X > ::I &i) const override
 Returns true if the function value is non-zero in the given domain. More...
 
virtual R getMin () const override
 Returns the minimum value for the whole domain. More...
 
virtual R getMin (const typename Domain< X > ::I &i) const override
 Returns the minimum value for the given domain. More...
 
virtual R getMax () const override
 Returns the maximum value for the whole domain. More...
 
virtual R getMax (const typename Domain< X > ::I &i) const override
 Returns the maximum value for the given domain. More...
 
virtual R getMean () const override
 Returns the mean value for the whole domain. More...
 
virtual R getMean (const typename Domain< X > ::I &i) const override
 Returns the mean value for the given domain. More...
 
virtual R getIntegral () const override
 Returns the integral value for the whole domain. More...
 
virtual R getIntegral (const typename Domain< X > ::I &i) const override
 Returns the integral value for the given domain. More...
 
virtual const Ptr< const IFunction< R, Domain< X > > > add (const Ptr< const IFunction< R, Domain< X > >> &o) const override
 Adds the provided function to this function. More...
 
virtual const Ptr< const IFunction< R, Domain< X > > > subtract (const Ptr< const IFunction< R, Domain< X > >> &o) const override
 Substracts the provided function from this function. More...
 
virtual const Ptr< const IFunction< R, Domain< X > > > multiply (const Ptr< const IFunction< double, Domain< X > >> &o) const override
 Multiplies the provided function with this function. More...
 
virtual const Ptr< const IFunction< double, Domain< X > > > divide (const Ptr< const IFunction< R, Domain< X > >> &o) const override
 Divides this function with the provided function. More...
 
virtual std::ostream & printOn (std::ostream &os) const override
 
virtual void print (std::ostream &os, int level=0) const override
 Prints this function in human readable form to the provided stream for the whole domain. More...
 
virtual void print (std::ostream &os, const typename Domain< X > ::I &i, int level=0) const override
 Prints this function in a human readable form to the provided stream for the given domain. More...
 
virtual void printPartitioning (std::ostream &os, const typename Domain< X > ::I &i, int level) const override
 Prints the partitioning of this function in a human readable form to the provided stream for the given domain. More...
 
virtual void printPartition (std::ostream &os, const typename Domain< X > ::I &i, int level=0) const override
 Prints a single partition of this function in a human readable form to the provided stream for the given domain. More...
 
virtual void printStructure (std::ostream &os, int level=0) const override
 Prints the internal data structure of this function in a human readable form to the provided stream. More...
 
- Public Member Functions inherited from inet::math::IFunction< R, Domain< X > >
virtual ~IFunction ()
 
virtual R getValue (const typename Domain< X > ::P &p) const=0
 Returns the value of the function at the given point. More...
 

Protected Attributes

const X mean
 
const X stddev
 

Detailed Description

template<typename R, typename X>
class inet::math::GaussFunction< R, X >

The one-dimensional Gauss function.

Constructor & Destructor Documentation

◆ GaussFunction()

template<typename R , typename X >
inet::math::GaussFunction< R, X >::GaussFunction ( mean,
stddev 
)
inline
474 : mean(mean), stddev(stddev) {}

Member Function Documentation

◆ getValue()

template<typename R , typename X >
virtual R inet::math::GaussFunction< R, X >::getValue ( const Point< X > &  p) const
inlineoverridevirtual
476  {
477  static const double c = 1 / sqrt(2 * M_PI);
478  X x = std::get<0>(p);
479  double a = toDouble((x - mean) / stddev);
480  return R(c / toDouble(stddev) * std::exp(-0.5 * a * a));
481  }

Member Data Documentation

◆ mean

template<typename R , typename X >
const X inet::math::GaussFunction< R, X >::mean
protected

◆ stddev

template<typename R , typename X >
const X inet::math::GaussFunction< R, X >::stddev
protected

The documentation for this class was generated from the following file:
inet::units::constants::c
const value< double, compose< units::m, pow< units::s, -1 > > > c(299792458)
inet::math::toDouble
double toDouble(const T v)
Definition: Point.h:28
inet::units::sqrt
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:272
inet::math::GaussFunction::mean
const X mean
Definition: PrimitiveFunctions.h:470
inet::units::constants::R
const value< double, compose< units::J, compose< pow< units::mol, -1 >, pow< units::kg, -1 > > > > R(8.314472)
M_PI
#define M_PI
Definition: INETMath.h:52
inet::math::GaussFunction::stddev
const X stddev
Definition: PrimitiveFunctions.h:471