Gaussian-to-Dirac approximation, quadrature-free (even dimension).
Overview
gm_to_dirac_even_closed_form<T> approximates a standard normal distribution by a Dirac mixture with L components in N dimensions, exactly as gm_to_dirac_short_standard_normal_deviation does, but with every integral over the kernel-width variable b evaluated in closed form.
The quadrature path issues L × N adaptive Gauss-Kronrod integrations per gradient evaluation. This path issues none.
Preconditions
- N must be EVEN and >= 2. Odd N fails loudly (assert in Debug, approximate() returns false in Release); there is no silent fallback.
- The target must be the standard normal N(0, I), or an isotropic N(0, sigma² I) through the approximate_isotropic() overloads. General diagonal covariance with unequal sigma_k is NOT supported: the scaling reduction that makes the isotropic case work does not exist there.
- bMax may be ANY value > 0. Unlike the quadrature path, whose D3 uses a large-bMax logarithmic approximation, D3 here is the exact Ei form, so no "for large bMax" assumption is made anywhere.
Differences from the quadrature path
Two behavioural differences are worth knowing when comparing results against gm_to_dirac_short_standard_normal_deviation:
- The reported distance is the TRUE modified Cramér-von-Mises distance: it includes the sample-independent D1 term, which the quadrature path omits.
- D3 is exact rather than logarithmically approximated.
Interface
Inherits:
- gm_to_dirac_approx_standard_normal_distribution_i<T>
Template parameter:
- T ∈ {float, double}; computation is always performed in double and cast at the interface boundary.
Provides overloads of:
- approximate(...)
- modified_van_mises_distance_sq(...)
- modified_van_mises_distance_sq_derivative(...)
- approximate_isotropic(...)
- modified_van_mises_distance_sq_isotropic(...)
Parameters
Common parameters:
- L -> number of Dirac components
- N -> dimension, must be even
- bMax -> integration bound, any value > 0
- x -> initial guess and output locations (L × N)
- wX -> weights of the Dirac mixture (optional)
If wX is nullptr:
- Uniform weights are assumed
Supported Input Formats
Three overload families are available:
- Raw pointer interface (T*)
- GSL vector interface (gsl_vector / gsl_vector_float)
- GSL matrix interface (gsl_matrix / gsl_matrix_float)
Memory layout:
- x represents L × N Dirac locations, row major
Example (Raw Pointer)
L,
N,
100.0,
x,
wX,
);
Definition dirac_to_dirac_approx_short.h:9
bool approximate(const T *y, size_t M, size_t L, size_t N, T *x, const T *wX=nullptr, const T *wY=nullptr, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{}) override
reduce the data points using raw pointers
Definition dirac_to_dirac_approx_short.cpp:24
Example (true distance)
void modified_van_mises_distance_sq(T *distance, const T *y, size_t M, size_t L, size_t N, size_t bMax, T *x, const T *wX=nullptr, const T *wY=nullptr) override
calculate modified van mises distance based on x and y
Definition dirac_to_dirac_approx_short.cpp:39
Example (isotropic sigma² I)
const double sigma = 2.0;
const double bMax = 100.0;
Closed forms
The distance decomposes as D = D1 - 2·D2 + D3, all expressed in units of pi^(N/2) — the same normalisation the quadrature path uses, so the two are directly comparable. The building blocks live in lcd_even_closed_form.h:
Notes