|
Deterministic Gaussian Sampling
|
bMax-free Gaussian-to-Dirac approximation for an even-dimensional standard normal target More...
#include <gm_to_dirac_even_binf.h>
Public Types | |
| using | GSLVectorType = typename GSLTemplateTypeAlias< T >::VectorType |
| using | GSLMatrixType = typename GSLTemplateTypeAlias< T >::MatrixType |
bMax-free Gaussian-to-Dirac approximation for an even-dimensional standard normal target
Same objective family as gm_to_dirac_even_closed_form, but the limit bMax -> infinity has been taken analytically (see lcd_even_binf_closed_form.h), so no integration bound appears anywhere in the API.
The minimizer optimises over an unconstrained t and every objective and gradient evaluation begins by projecting
s = t - 1 * (w^T t)
with the assembled gradient chain-ruled back by
grad_{t,q} = grad_{s,q} - w_q * sum_i grad_{s,i}
so no iterate can ever leave the zero-mean manifold and the finite non-distance is unreachable. The same projection runs inside the standalone distance and derivative entry points, which therefore report the value for the MEAN-CORRECTED input rather than for the raw input.
| T | float or double; computation is always performed in double and cast at the interface boundary |
| bool gm_to_dirac_even_binf< T >::approximate | ( | size_t | L, |
| size_t | N, | ||
| GSLMatrixType * | x, | ||
| const GSLVectorType * | wX = nullptr, |
||
| GslminimizerResult * | result = nullptr, |
||
| const ApproximateOptions & | options = ApproximateOptions{} |
||
| ) |
approximate a standard normal by L Dirac components
| L | number of Dirac components, must be >= 1 |
| N | dimension, must be even and >= 2 |
| x | initial guess and output locations (L rows, N columns) |
| wX | weights, nullptr for uniform |
| result | minimizer result |
| options | minimizer options; ApproximateOptions::bMax is IGNORED |
| bool gm_to_dirac_even_binf< T >::approximate | ( | size_t | L, |
| size_t | N, | ||
| GSLVectorType * | x, | ||
| const GSLVectorType * | wX = nullptr, |
||
| GslminimizerResult * | result = nullptr, |
||
| const ApproximateOptions & | options = ApproximateOptions{} |
||
| ) |
approximate a standard normal by L Dirac components
| L | number of Dirac components, must be >= 1 |
| N | dimension, must be even and >= 2 |
| x | initial guess and output locations (L * N) |
| wX | weights, nullptr for uniform |
| result | minimizer result |
| options | minimizer options; ApproximateOptions::bMax is IGNORED |
| bool gm_to_dirac_even_binf< T >::approximate | ( | size_t | L, |
| size_t | N, | ||
| T * | x, | ||
| const T * | wX = nullptr, |
||
| GslminimizerResult * | result = nullptr, |
||
| const ApproximateOptions & | options = ApproximateOptions{} |
||
| ) |
approximate a standard normal by L Dirac components
On return x holds the projected, zero-mean sample set s, not the raw optimizer variable t.
| L | number of Dirac components, must be >= 1 |
| N | dimension, must be even and >= 2 |
| x | initial guess and output locations (L * N) |
| wX | weights, nullptr for uniform |
| result | minimizer result |
| options | minimizer options; ApproximateOptions::bMax is IGNORED, there is no integration bound on this path |
| void gm_to_dirac_even_binf< T >::modified_van_mises_distance_sq | ( | T * | distance, |
| size_t | L, | ||
| size_t | N, | ||
| GSLMatrixType * | x, | ||
| const GSLVectorType * | wX = nullptr |
||
| ) |
true bMax-free mCvM distance, K_k included
| distance | output distance; set to NaN if the preconditions fail |
| L | number of Dirac components, must be >= 1 |
| N | dimension, must be even and >= 2 |
| x | sample locations (L rows, N columns) |
| wX | weights, nullptr for uniform |
| void gm_to_dirac_even_binf< T >::modified_van_mises_distance_sq | ( | T * | distance, |
| size_t | L, | ||
| size_t | N, | ||
| GSLVectorType * | x, | ||
| const GSLVectorType * | wX = nullptr |
||
| ) |
true bMax-free mCvM distance, K_k included
| distance | output distance; set to NaN if the preconditions fail |
| L | number of Dirac components, must be >= 1 |
| N | dimension, must be even and >= 2 |
| x | sample locations (L * N) |
| wX | weights, nullptr for uniform |
| void gm_to_dirac_even_binf< T >::modified_van_mises_distance_sq | ( | T * | distance, |
| size_t | L, | ||
| size_t | N, | ||
| T * | x, | ||
| const T * | wX = nullptr |
||
| ) |
true bMax-free mCvM distance, K_k included
Reports the distance of the mean-corrected sample set
| distance | output distance; set to NaN if the preconditions fail |
| L | number of Dirac components, must be >= 1 |
| N | dimension, must be even and >= 2 |
| x | sample locations (L * N) |
| wX | weights, nullptr for uniform |
| void gm_to_dirac_even_binf< T >::modified_van_mises_distance_sq_derivative | ( | GSLMatrixType * | gradient, |
| size_t | L, | ||
| size_t | N, | ||
| GSLMatrixType * | x, | ||
| const GSLVectorType * | wX = nullptr |
||
| ) |
gradient of the true bMax-free mCvM distance w.r.t. the SAMPLES
Returns grad_s, not the minimizer's grad_t; see the raw-pointer overload.
| gradient | output gradient (L rows, N columns); filled with NaN if the preconditions fail |
| L | number of Dirac components, must be >= 1 |
| N | dimension, must be even and >= 2 |
| x | sample locations (L rows, N columns) |
| wX | weights, nullptr for uniform |
| void gm_to_dirac_even_binf< T >::modified_van_mises_distance_sq_derivative | ( | GSLVectorType * | gradient, |
| size_t | L, | ||
| size_t | N, | ||
| GSLVectorType * | x, | ||
| const GSLVectorType * | wX = nullptr |
||
| ) |
gradient of the true bMax-free mCvM distance w.r.t. the SAMPLES
Returns grad_s, not the minimizer's grad_t; see the raw-pointer overload.
| gradient | output gradient (L * N); filled with NaN if the preconditions fail |
| L | number of Dirac components, must be >= 1 |
| N | dimension, must be even and >= 2 |
| x | sample locations (L * N) |
| wX | weights, nullptr for uniform |
| void gm_to_dirac_even_binf< T >::modified_van_mises_distance_sq_derivative | ( | T * | gradient, |
| size_t | L, | ||
| size_t | N, | ||
| T * | x, | ||
| const T * | wX = nullptr |
||
| ) |
gradient of the true bMax-free mCvM distance w.r.t. the SAMPLES
Returns grad_s, the derivative with respect to the sample locations themselves:
grad_s,q = -4 w_q phi_k'(c_q) s_q
+ 0.5 w_q sum_{j != q, T_qj > 0} w_j (s_q - s_j)
* (ln(T_qj / 4) + 1)
This is NOT the gradient the minimizer works with. approximate() varies the unconstrained t behind s = t - 1 * (w^T t) and therefore uses grad_t,q = grad_s,q - w_q * sum_i grad_s,i. The two agree only up to that projection; grad_s is exposed here because it is the derivative of the distance as a function of the sample set, which is what a caller asking for "the gradient at x" means.
| gradient | output gradient (L * N); filled with NaN if the preconditions fail |
| L | number of Dirac components, must be >= 1 |
| N | dimension, must be even and >= 2 |
| x | sample locations (L * N) |
| wX | weights, nullptr for uniform |