imate
C++/CUDA Reference
Loading...
Searching...
No Matches
GaussianInt Class Reference

Defines the integral of the normal probability density function by. More...

#include <gaussian_int.h>

Inheritance diagram for GaussianInt:
Collaboration diagram for GaussianInt:

Public Member Functions

 GaussianInt (double mu_, double sigma_)
 Sets the default for the parameter mu to 0.0 and for the parameter sigma to 1.0.
 
virtual float function (const float lambda_) const
 
virtual double function (const double lambda_) const
 
virtual long double function (const long double lambda_) const
 
- Public Member Functions inherited from Function
virtual ~Function ()
 Default virtual destructor.
 

Public Attributes

double mu
 
double sigma
 

Detailed Description

Defines the integral of the normal probability density function by.

\[ f: \lambda \mapsto \frac{1}{2} \operatorname{erf} \left(\frac{x}{\sqrt{2}} \right), \]

where

\[ x = \frac{\lambda - \mu}{\sigma}, \]

and \( \mu \) and \( \sigma \) parameters are the mean and standard deviation of the Gaussian function and should be set by this->mu and this->sigma members, respectively. This function essentialy defines the cumulative distribution function of the normal distribution.

The matrix function \( f: \mathbb{R}^{n \times n} \to \mathbb{R}^{n \times n} \) is used in

\[ \mathrm{trace} \left( f(\mathbf{A}) \right). \]

However, instead of a matrix function, the equivalent scalar function \( f: \mathbb{R} \to \mathbb{R} \) is defiend which acts on the eigenvalues of the matrix.

Definition at line 53 of file gaussian_int.h.

Constructor & Destructor Documentation

◆ GaussianInt()

GaussianInt::GaussianInt ( double  mu_,
double  sigma_ 
)

Sets the default for the parameter mu to 0.0 and for the parameter sigma to 1.0.

Definition at line 34 of file gaussian_int.cpp.

35{
36 this->mu = mu_;
37 this->sigma = sigma_;
38}

References mu, and sigma.

Member Function Documentation

◆ function() [1/3]

double GaussianInt::function ( const double  lambda_) const
virtual
Parameters
[in]lambda_Eigenvalue (or singular value) of matrix.
Returns
The value of matrix function for the given eigenvalue.

Implements Function.

Definition at line 71 of file gaussian_int.cpp.

72{
73 double x = (lambda_ - this->mu) / this->sigma;
74
75 // C++11 and later
76 #if __cplusplus >= 201103L
77 return 0.5 * (1.0 + std::erf(x * M_SQRT1_2));
78 #else
79 return 0.5 * (1.0 + erf(x * M_SQRT1_2));
80 #endif
81}

References mu, and sigma.

◆ function() [2/3]

float GaussianInt::function ( const float  lambda_) const
virtual
Parameters
[in]lambda_Eigenvalue (or singular value) of matrix.
Returns
The value of matrix function for the given eigenvalue.

Implements Function.

Definition at line 48 of file gaussian_int.cpp.

49{
50 float mu_ = static_cast<float>(this->mu);
51 float sigma_ = static_cast<float>(this->sigma);
52 float x = (lambda_ - mu_) / sigma_;
53
54 // C++11 and later
55 #if __cplusplus >= 201103L
56 return 0.5f * (1.0f + std::erf(x * M_SQRT1_2));
57 #else
58 return 0.5f * (1.0f + static_cast<float>(erf(x * M_SQRT1_2)));
59 #endif
60}

References mu, and sigma.

◆ function() [3/3]

long double GaussianInt::function ( const long double  lambda_) const
virtual
Parameters
[in]lambda_Eigenvalue (or singular value) of matrix.
Returns
The value of matrix function for the given eigenvalue.

Implements Function.

Definition at line 92 of file gaussian_int.cpp.

93{
94 long double mu_ = static_cast<long double>(this->mu);
95 long double sigma_ = static_cast<long double>(this->sigma);
96 long double x = (lambda_ - mu_) / sigma_;
97
98 // C++11 and later
99 #if __cplusplus >= 201103L
100 return 0.5l * (1.0l + std::erf(x * M_SQRT1_2));
101 #else
102 return 0.5l * (1.0l + static_cast<long double>(erf(x * M_SQRT1_2)));
103 #endif
104}

References mu, and sigma.

Member Data Documentation

◆ mu

double GaussianInt::mu

Definition at line 60 of file gaussian_int.h.

Referenced by function(), function(), function(), and GaussianInt().

◆ sigma

double GaussianInt::sigma

Definition at line 61 of file gaussian_int.h.

Referenced by function(), function(), function(), and GaussianInt().


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