Deterministic Gaussian Sampling
Loading...
Searching...
No Matches
gm_to_dirac_even_closed_form< T > Class Template Reference

quadrature-free Gaussian-to-Dirac approximation for an even-dimensional standard normal target More...

#include <gm_to_dirac_even_closed_form.h>

Inheritance diagram for gm_to_dirac_even_closed_form< T >:
gm_to_dirac_approx_standard_normal_distribution_i< T >

Public Types

using GSLVectorType = typename gm_to_dirac_approx_standard_normal_distribution_i< T >::GSLVectorType
 
using GSLMatrixType = typename gm_to_dirac_approx_standard_normal_distribution_i< T >::GSLMatrixType
 
- Public Types inherited from gm_to_dirac_approx_standard_normal_distribution_i< T >
using GSLVectorType = typename GSLTemplateTypeAlias< T >::VectorType
 
using GSLVectorViewType = typename GSLTemplateTypeAlias< T >::VectorViewType
 
using GSLMatrixType = typename GSLTemplateTypeAlias< T >::MatrixType
 

Public Member Functions

bool approximate (size_t L, size_t N, double bMax, T *x, const T *wX=nullptr, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{})
 approximate a standard normal by L Dirac components
 
void modified_van_mises_distance_sq (T *distance, size_t L, size_t N, double bMax, T *x, const T *wX)
 true mCvM distance, D1 included
 
void modified_van_mises_distance_sq_derivative (T *gradient, size_t L, size_t N, double bMax, T *x, const T *wX)
 gradient of the true mCvM distance with respect to x
 
bool approximate (size_t L, size_t N, double bMax, GSLVectorType *x, const GSLVectorType *wX=nullptr, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{})
 
void modified_van_mises_distance_sq (T *distance, size_t L, size_t N, double bMax, GSLVectorType *x, const GSLVectorType *wX)
 
void modified_van_mises_distance_sq_derivative (GSLVectorType *gradient, size_t L, size_t N, double bMax, GSLVectorType *x, const GSLVectorType *wX)
 
bool approximate (size_t L, size_t N, double bMax, GSLMatrixType *x, const GSLVectorType *wX=nullptr, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{})
 
void modified_van_mises_distance_sq (T *distance, size_t L, size_t N, double bMax, GSLMatrixType *x, const GSLVectorType *wX)
 
void modified_van_mises_distance_sq_derivative (GSLMatrixType *gradient, size_t L, size_t N, double bMax, GSLMatrixType *x, const GSLVectorType *wX)
 
bool approximate_isotropic (size_t L, size_t N, double sigma, double bMax, T *x, const T *wX=nullptr, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{})
 approximate an isotropic Gaussian N(0, sigma^2 * I)
 
void modified_van_mises_distance_sq_isotropic (T *distance, size_t L, size_t N, double sigma, double bMax, T *x, const T *wX)
 true mCvM distance for an isotropic Gaussian N(0, sigma^2 * I)
 
bool approximate (size_t L, size_t N, T *x, const T *wX, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{}) override
 approximate using raw pointers
 
void modified_van_mises_distance_sq (T *distance, size_t L, size_t N, size_t bMax, T *x, const T *wX) override
 calculate modified van mises distance based on standard normal deviation and x
 
void modified_van_mises_distance_sq_derivative (T *gradient, size_t L, size_t N, size_t bMax, T *x, const T *wX) override
 calculate modified van mises distance based on standard normal deviation and x
 
bool approximate (size_t L, size_t N, GSLVectorType *x, const GSLVectorType *wX=nullptr, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{}) override
 approximate using gsl vectors
 
void modified_van_mises_distance_sq (T *distance, size_t L, size_t N, size_t bMax, GSLVectorType *x, const GSLVectorType *wX) override
 calculate modified van mises distance based on standard normal deviation and x
 
void modified_van_mises_distance_sq_derivative (GSLVectorType *gradient, size_t L, size_t N, size_t bMax, GSLVectorType *x, const GSLVectorType *wX) override
 calculate modified van mises distance based on standard normal deviation and x
 
bool approximate (size_t L, size_t N, GSLMatrixType *x, const GSLVectorType *wX=nullptr, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{}) override
 approximate using gsl vectors
 
void modified_van_mises_distance_sq (T *distance, size_t L, size_t N, size_t bMax, GSLMatrixType *x, const GSLVectorType *wX) override
 calculate modified van mises distance based on standard normal deviation and x
 
void modified_van_mises_distance_sq_derivative (GSLMatrixType *gradient, size_t L, size_t N, size_t bMax, GSLMatrixType *x, const GSLVectorType *wX) override
 calculate modified van mises distance based on standard normal deviation and x
 
bool approximate (size_t L, size_t N, double bMax, gsl_vector_float *x, const gsl_vector_float *wX, GslminimizerResult *result, const ApproximateOptions &options)
 
void modified_van_mises_distance_sq (float *distance, size_t L, size_t N, double bMax, gsl_vector_float *x, const gsl_vector_float *wX)
 
void modified_van_mises_distance_sq_derivative (gsl_vector_float *gradient, size_t L, size_t N, double bMax, gsl_vector_float *x, const gsl_vector_float *wX)
 
bool approximate (size_t L, size_t N, double bMax, gsl_vector *x, const gsl_vector *wX, GslminimizerResult *result, const ApproximateOptions &options)
 
void modified_van_mises_distance_sq (double *distance, size_t L, size_t N, double bMax, gsl_vector *x, const gsl_vector *wX)
 
void modified_van_mises_distance_sq_derivative (gsl_vector *gradient, size_t L, size_t N, double bMax, gsl_vector *x, const gsl_vector *wX)
 
bool approximate (size_t L, size_t N, double bMax, gsl_vector_float *x, const gsl_vector_float *wX, GslminimizerResult *result, const ApproximateOptions &options)
 
bool approximate (size_t L, size_t N, double bMax, gsl_vector *x, const gsl_vector *wX, GslminimizerResult *result, const ApproximateOptions &options)
 
void modified_van_mises_distance_sq (float *distance, size_t L, size_t N, double bMax, gsl_vector_float *x, const gsl_vector_float *wX)
 
void modified_van_mises_distance_sq (double *distance, size_t L, size_t N, double bMax, gsl_vector *x, const gsl_vector *wX)
 
void modified_van_mises_distance_sq_derivative (gsl_vector_float *gradient, size_t L, size_t N, double bMax, gsl_vector_float *x, const gsl_vector_float *wX)
 
void modified_van_mises_distance_sq_derivative (gsl_vector *gradient, size_t L, size_t N, double bMax, gsl_vector *x, const gsl_vector *wX)
 

Data Fields

bool includeD1InObjective = true
 carry the sample-independent constant inside the minimizer's objective
 

Detailed Description

template<typename T>
class gm_to_dirac_even_closed_form< T >

quadrature-free Gaussian-to-Dirac approximation for an even-dimensional standard normal target

Same objective as gm_to_dirac_short_standard_normal_deviation, but every integral over the kernel-width variable b is evaluated in closed form (see lcd_even_closed_form.h).

One further differences from the quadrature path:

  • the reported distance is the TRUE mCvM distance: it includes the D1 term, which gm_to_dirac_short omits.
Note
PRECONDITIONS: the target must be the STANDARD normal N(0, I) (or an isotropic sigma^2 * I via approximate_isotropic()), and N must be EVEN and >= 2. Odd N fails loudly rather than falling back.

Member Function Documentation

◆ approximate() [1/4]

template<typename T >
bool gm_to_dirac_even_closed_form< T >::approximate ( size_t  L,
size_t  N,
double  bMax,
T *  x,
const T *  wX = nullptr,
GslminimizerResult *  result = nullptr,
const ApproximateOptions &  options = ApproximateOptions{} 
)

approximate a standard normal by L Dirac components

Parameters
Lnumber of Dirac components
Ndimension, must be even and >= 2
bMaxupper bound of the b-integral, must be > 0
xinitial guess and output locations (L * N)
wXweights, nullptr for uniform
resultminimizer result
optionsminimizer options; options.bMax is ignored here
Returns
true on success, false otherwise (including odd N)

◆ approximate() [2/4]

template<typename T >
bool gm_to_dirac_even_closed_form< T >::approximate ( size_t  L,
size_t  N,
GSLMatrixType *  x,
const GSLVectorType *  wX = nullptr,
GslminimizerResult *  result = nullptr,
const ApproximateOptions &  options = ApproximateOptions{} 
)
overridevirtual

approximate using gsl vectors

Parameters
Lnumber of data points for apprioximation
Ndimension of the data
bMaxbMax
xfirst guess for the approximation and return value
wXweights for the x data points
resultminimizer result
optionsoptions for minimizer
Returns
true, on success, false otherwise

Implements gm_to_dirac_approx_standard_normal_distribution_i< T >.

◆ approximate() [3/4]

template<typename T >
bool gm_to_dirac_even_closed_form< T >::approximate ( size_t  L,
size_t  N,
GSLVectorType *  x,
const GSLVectorType *  wX = nullptr,
GslminimizerResult *  result = nullptr,
const ApproximateOptions &  options = ApproximateOptions{} 
)
overridevirtual

approximate using gsl vectors

Parameters
Lnumber of data points for apprioximation
Ndimension of the data
bMaxbMax
xfirst guess for the approximation and return value
wXweights for the x data points
resultminimizer result
optionsoptions for minimizer
Returns
true, on success, false otherwise

Implements gm_to_dirac_approx_standard_normal_distribution_i< T >.

◆ approximate() [4/4]

template<typename T >
bool gm_to_dirac_even_closed_form< T >::approximate ( size_t  L,
size_t  N,
T *  x,
const T *  wX,
GslminimizerResult *  result = nullptr,
const ApproximateOptions &  options = ApproximateOptions{} 
)
overridevirtual

approximate using raw pointers

Parameters
Lnumber of data points for approximation
Ndimension of the data
bMaxbMax
xfirst guess for the approximation and return value
resultminimizer result
optionsoptions for minimizer
Returns
true, on success, false otherwise

Implements gm_to_dirac_approx_standard_normal_distribution_i< T >.

◆ approximate_isotropic()

template<typename T >
bool gm_to_dirac_even_closed_form< T >::approximate_isotropic ( size_t  L,
size_t  N,
double  sigma,
double  bMax,
T *  x,
const T *  wX = nullptr,
GslminimizerResult *  result = nullptr,
const ApproximateOptions &  options = ApproximateOptions{} 
)

approximate an isotropic Gaussian N(0, sigma^2 * I)

Solves the standard-normal problem at bMax / sigma and scales the result by sigma. This is why the new API takes a double bMax: bMax / sigma is generally not an integer.

Parameters
Lnumber of Dirac components
Ndimension, must be even and >= 2
sigmastandard deviation, must be > 0
bMaxupper bound of the b-integral, must be > 0
xinitial guess and output locations (L * N)
wXweights, nullptr for uniform
resultminimizer result
optionsminimizer options; options.bMax is ignored here
Returns
true on success, false otherwise
Note
only isotropic covariance is supported; general diagonal covariance admits no such reduction

◆ modified_van_mises_distance_sq() [1/4]

template<typename T >
void gm_to_dirac_even_closed_form< T >::modified_van_mises_distance_sq ( T *  distance,
size_t  L,
size_t  N,
double  bMax,
T *  x,
const T *  wX 
)

true mCvM distance, D1 included

Parameters
distanceoutput distance
Lnumber of Dirac components
Ndimension, must be even and >= 2
bMaxupper bound of the b-integral, must be > 0
xsample locations (L * N)
wXweights, nullptr for uniform

◆ modified_van_mises_distance_sq() [2/4]

template<typename T >
void gm_to_dirac_even_closed_form< T >::modified_van_mises_distance_sq ( T *  distance,
size_t  L,
size_t  N,
size_t  bMax,
GSLMatrixType *  x,
const GSLVectorType *  wX 
)
overridevirtual

calculate modified van mises distance based on standard normal deviation and x

Parameters
distancepointer to distance value to be calculated
Lnumber of data points for approximation
Ndimension of the data
bMaxbMax
xfirst guess for the approximation and return value
resultminimizer result
optionsoptions for minimizer
Returns
true, on success, false otherwise

Implements gm_to_dirac_approx_standard_normal_distribution_i< T >.

◆ modified_van_mises_distance_sq() [3/4]

template<typename T >
void gm_to_dirac_even_closed_form< T >::modified_van_mises_distance_sq ( T *  distance,
size_t  L,
size_t  N,
size_t  bMax,
GSLVectorType *  x,
const GSLVectorType *  wX 
)
overridevirtual

calculate modified van mises distance based on standard normal deviation and x

Parameters
distancepointer to distance value to be calculated
Lnumber of data points for approximation
Ndimension of the data
bMaxbMax
xfirst guess for the approximation and return value
resultminimizer result
optionsoptions for minimizer
Returns
true, on success, false otherwise

Implements gm_to_dirac_approx_standard_normal_distribution_i< T >.

◆ modified_van_mises_distance_sq() [4/4]

template<typename T >
void gm_to_dirac_even_closed_form< T >::modified_van_mises_distance_sq ( T *  distance,
size_t  L,
size_t  N,
size_t  bMax,
T *  x,
const T *  wX 
)
overridevirtual

calculate modified van mises distance based on standard normal deviation and x

Parameters
distancepointer to distance value to be calculated
Lnumber of data points for approximation
Ndimension of the data
bMaxbMax
xfirst guess for the approximation and return value
resultminimizer result
optionsoptions for minimizer
Returns
true, on success, false otherwise

Implements gm_to_dirac_approx_standard_normal_distribution_i< T >.

◆ modified_van_mises_distance_sq_derivative() [1/4]

template<typename T >
void gm_to_dirac_even_closed_form< T >::modified_van_mises_distance_sq_derivative ( GSLMatrixType *  gradient,
size_t  L,
size_t  N,
size_t  bMax,
GSLMatrixType *  x,
const GSLVectorType *  wX 
)
overridevirtual

calculate modified van mises distance based on standard normal deviation and x

Parameters
gradientpointer to gradient to be calculated
Lnumber of data points for approximation
Ndimension of the data
bMaxbMax
xfirst guess for the approximation and return value
resultminimizer result
optionsoptions for minimizer
Returns
true, on success, false otherwise

Implements gm_to_dirac_approx_standard_normal_distribution_i< T >.

◆ modified_van_mises_distance_sq_derivative() [2/4]

template<typename T >
void gm_to_dirac_even_closed_form< T >::modified_van_mises_distance_sq_derivative ( GSLVectorType *  gradient,
size_t  L,
size_t  N,
size_t  bMax,
GSLVectorType *  x,
const GSLVectorType *  wX 
)
overridevirtual

calculate modified van mises distance based on standard normal deviation and x

Parameters
gradientpointer to gradient to be calculated
Lnumber of data points for approximation
Ndimension of the data
bMaxbMax
xfirst guess for the approximation and return value
resultminimizer result
optionsoptions for minimizer
Returns
true, on success, false otherwise

Implements gm_to_dirac_approx_standard_normal_distribution_i< T >.

◆ modified_van_mises_distance_sq_derivative() [3/4]

template<typename T >
void gm_to_dirac_even_closed_form< T >::modified_van_mises_distance_sq_derivative ( T *  gradient,
size_t  L,
size_t  N,
double  bMax,
T *  x,
const T *  wX 
)

gradient of the true mCvM distance with respect to x

Parameters
gradientoutput gradient (L * N)
Lnumber of Dirac components
Ndimension, must be even and >= 2
bMaxupper bound of the b-integral, must be > 0
xsample locations (L * N)
wXweights, nullptr for uniform

◆ modified_van_mises_distance_sq_derivative() [4/4]

template<typename T >
void gm_to_dirac_even_closed_form< T >::modified_van_mises_distance_sq_derivative ( T *  gradient,
size_t  L,
size_t  N,
size_t  bMax,
T *  x,
const T *  wX 
)
overridevirtual

calculate modified van mises distance based on standard normal deviation and x

Parameters
gradientpointer to gradient to be calculated
Lnumber of data points for approximation
Ndimension of the data
bMaxbMax
xfirst guess for the approximation and return value
resultminimizer result
optionsoptions for minimizer
Returns
true, on success, false otherwise

Implements gm_to_dirac_approx_standard_normal_distribution_i< T >.

◆ modified_van_mises_distance_sq_isotropic()

template<typename T >
void gm_to_dirac_even_closed_form< T >::modified_van_mises_distance_sq_isotropic ( T *  distance,
size_t  L,
size_t  N,
double  sigma,
double  bMax,
T *  x,
const T *  wX 
)

true mCvM distance for an isotropic Gaussian N(0, sigma^2 * I)

D(sigma, bMax) = sigma^2 * D(1, bMax / sigma).

Parameters
distanceoutput distance
Lnumber of Dirac components
Ndimension, must be even and >= 2
sigmastandard deviation, must be > 0
bMaxupper bound of the b-integral, must be > 0
xsample locations (L * N)
wXweights, nullptr for uniform

Field Documentation

◆ includeD1InObjective

template<typename T >
bool gm_to_dirac_even_closed_form< T >::includeD1InObjective = true

carry the sample-independent constant inside the minimizer's objective

The constant does not depend on x, so omitting it leaves the gradient and the minimum unchanged and saves one scalar evaluation per objective call. With it, the objective IS the distance.


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