imate
C++/CUDA Reference
Gaussian Class Reference

Defines the function. More...

#include <gaussian.h>

Inheritance diagram for Gaussian:
Collaboration diagram for Gaussian:

Public Member Functions

 Gaussian (double mu_, double sigma_)
 Sets the default for the parameter mu to 0.0 and for the parameter sigma to 1.0. More...
 
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. More...
 

Public Attributes

double mu
 
double sigma
 

Detailed Description

Defines the function.

\[ f: \lambda \mapsto \frac{1}{\sigma \sqrt{2 \pi}} e^{-\frac{1}{2} \frac{(\lambda - \mu)^2}{\sigma^2}}, \]

where \( \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.

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 47 of file gaussian.h.

Constructor & Destructor Documentation

◆ Gaussian()

Gaussian::Gaussian ( 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.cpp.

35 {
36  this->mu = mu_;
37  this->sigma = sigma_;
38 }
double mu
Definition: gaussian.h:54
double sigma
Definition: gaussian.h:55

References mu, and sigma.

Member Function Documentation

◆ function() [1/3]

double Gaussian::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 65 of file gaussian.cpp.

66 {
67  double x = (lambda_ - this->mu) / this->sigma;
68  return (0.5 * M_SQRT1_2 * M_2_SQRTPI / this->sigma) * exp(-0.5 * x * x);
69 }

References mu, and sigma.

◆ function() [2/3]

float Gaussian::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.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  return (0.5 * M_SQRT1_2 * M_2_SQRTPI / sigma_) * exp(-0.5 * x * x);
54 }

References mu, and sigma.

◆ function() [3/3]

long double Gaussian::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 80 of file gaussian.cpp.

81 {
82  long double mu_ = static_cast<long double>(this->mu);
83  long double sigma_ = static_cast<long double>(this->sigma);
84  long double x = (lambda_ - mu_) / sigma_;
85  return (0.5 * M_SQRT1_2 * M_2_SQRTPI / sigma_) * exp(-0.5 * x * x);
86 }

References mu, and sigma.

Member Data Documentation

◆ mu

double Gaussian::mu

Definition at line 54 of file gaussian.h.

Referenced by function(), and Gaussian().

◆ sigma

double Gaussian::sigma

Definition at line 55 of file gaussian.h.

Referenced by function(), and Gaussian().


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