Relacs Numerics Library  0.9.8
Public Member Functions | List of all members
Kernel Class Reference

#include <kernel.h>

Inheritance diagram for Kernel:
Inheritance graph
[legend]

Public Member Functions

 Kernel (void)
 
 Kernel (double stdev)
 
virtual ~Kernel (void)
 
double operator() (double x) const
 
virtual double value (double x) const
 
double scale (void) const
 
virtual void setScale (double scale)
 
virtual double mean (void) const
 
virtual double stdev (void) const
 
virtual void setStdev (double stdev)
 
virtual double max (void) const
 
virtual double left (void) const
 
virtual double right (void) const
 

Detailed Description

Base class of all kernel functions.

Author
Jan Benda
Version
1.0 A Kernel is a function y=f(x) which is concentrated between x=left() and x=right(), i.e. f(x) is zero (or close to zero) for x less than left() and for x greater than right(). The integral over the kernel is unity:

\[ \int_{-\infty}^{+\infty} f(x) dx = 1 \]

The width of the kernel can be controlled by a scale factor s, $ f(x) \rightarrow f(x/s) $, via setScale() or by setting the standard deviation of the kernel via setStdev(). The actual scale factor is returned by scale() and the corresponding standard deviation by stdev(). Note that the value returned by stdev() usually differs from scale(). The mean of the kernel is mean(). The maximum value of the kernel is max().

Constructor & Destructor Documentation

Kernel ( void  )
inline

Constructs a default kernel with its scale factor set to one.

Kernel ( double  stdev)
inline

Constructs a kernel with standard deviation stdev.

References Kernel::setStdev().

virtual ~Kernel ( void  )
inlinevirtual

Destructor.

Member Function Documentation

double operator() ( double  x) const
inline

Returns the value of the kernel at position x. This operator is NOT virtual in order to speed up computation when using templates. If you need a virtual function as an interface, implement value().

References Kernel::value().

Referenced by Kernel::value().

double value ( double  x) const
virtual

Returns the value of the kernel at position x. This function IS virtual and might slow things down. If you need a NON virtual function as an interface, implement operator().

Reimplemented in GammaKernel, GaussKernel, EpanechnikovKernel, TriangularKernel, and RectKernel.

References Kernel::operator()().

Referenced by EventData::addCyclicRate(), EventData::addRate(), Kernel::max(), Kernel::mean(), Kernel::operator()(), EventData::rate(), and Kernel::stdev().

double scale ( void  ) const
inline
void setScale ( double  scale)
virtual
double mean ( void  ) const
virtual

Return the mean of the kernel. This default implementation calculates the mean numerically from 400 points between left() and right().

Reimplemented in GammaKernel, GaussKernel, EpanechnikovKernel, TriangularKernel, and RectKernel.

References Kernel::left(), Kernel::right(), and Kernel::value().

double stdev ( void  ) const
virtual

Return the standard deviation of the kernel, which does not have to equal the scale(). This default implementation calculates the standard deviation numerically from 400 points between left() and right().

Reimplemented in GammaKernel, GaussKernel, EpanechnikovKernel, TriangularKernel, and RectKernel.

References Kernel::left(), Kernel::right(), relacs::sqrt(), and Kernel::value().

void setStdev ( double  stdev)
virtual

Set the standard deviation of the kernel to stdev. This default implementation sets the scale() equal to stdev.

Reimplemented in GammaKernel, GaussKernel, EpanechnikovKernel, TriangularKernel, and RectKernel.

References Kernel::setScale().

Referenced by Kernel::Kernel().

double max ( void  ) const
virtual

Return the maximum value of the kernel. This default implementation searches for the maximum of 400 computed function values between left() and right().

Reimplemented in GammaKernel, GaussKernel, EpanechnikovKernel, TriangularKernel, and RectKernel.

References Kernel::left(), Kernel::right(), and Kernel::value().

double left ( void  ) const
virtual

The leftmost extension of the kernel. For x values less than this value, the value of the kernel is negligible. Returns minus half the scale factor.

Reimplemented in GammaKernel, GaussKernel, EpanechnikovKernel, and TriangularKernel.

Referenced by EventData::addCyclicRate(), EventData::addRate(), Kernel::max(), Kernel::mean(), EventData::rate(), and Kernel::stdev().

double right ( void  ) const
virtual

The rightmost extension of the kernel. For x values greater than this value, the value of the kernel is negligible. Returns half the scale factor.

Reimplemented in GammaKernel, GaussKernel, EpanechnikovKernel, and TriangularKernel.

Referenced by EventData::addCyclicRate(), EventData::addRate(), Kernel::max(), Kernel::mean(), EventData::rate(), and Kernel::stdev().


The documentation for this class was generated from the following files: