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

Defines the derivative of the log normal probability function by. More...

#include <log_gaussian_der.h>

Inheritance diagram for LogGaussianDer:
Collaboration diagram for LogGaussianDer:

Public Member Functions

 LogGaussianDer (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 derivative of the log normal probability function by.

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

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.

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 52 of file log_gaussian_der.h.

Constructor & Destructor Documentation

◆ LogGaussianDer()

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

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

References mu, and sigma.

Member Function Documentation

◆ function() [1/3]

double LogGaussianDer::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 69 of file log_gaussian_der.cpp.

70{
71 double x = (lambda_ - this->mu) / this->sigma;
72 double sigma2 = this->sigma * this->sigma;
73 double sigma3 = sigma2 * this->sigma;
74 return -(0.5 * M_SQRT1_2 * M_2_SQRTPI / sigma3) * \
75 std::exp(-0.5 * x * x) * \
76 (std::log(lambda_) - std::log(mu) + sigma2) / (lambda_ * lambda_);
77}

References mu, and sigma.

◆ function() [2/3]

float LogGaussianDer::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 log_gaussian_der.cpp.

49{
50 float mu_ = static_cast<float>(this->mu);
51 float sigma_ = static_cast<float>(this->sigma);
52 float sigma2 = sigma_ * sigma_;
53 float sigma3 = sigma2 * sigma_;
54 float x = (lambda_ - mu_) / sigma_;
55 return -(0.5f * M_SQRT1_2 * M_2_SQRTPI / sigma3) * \
56 std::exp(-0.5f * x * x) * \
57 (std::log(lambda_) - std::log(mu) + sigma2) / (lambda_ * lambda_);
58}

References mu, and sigma.

◆ function() [3/3]

long double LogGaussianDer::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 88 of file log_gaussian_der.cpp.

89{
90 long double mu_ = static_cast<long double>(this->mu);
91 long double sigma_ = static_cast<long double>(this->sigma);
92 long double sigma2 = sigma_ * sigma_;
93 long double sigma3 = sigma2 * sigma_;
94 long double x = (lambda_ - mu_) / sigma_;
95 return -(0.5l * M_SQRT1_2 * M_2_SQRTPI / sigma3) * \
96 std::exp(-0.5l * x * x) * \
97 (std::log(lambda_) - std::log(mu) + sigma2) / (lambda_ * lambda_);
98}

References mu, and sigma.

Member Data Documentation

◆ mu

double LogGaussianDer::mu

Definition at line 59 of file log_gaussian_der.h.

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

◆ sigma

double LogGaussianDer::sigma

Definition at line 60 of file log_gaussian_der.h.

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


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