Deterministic Gaussian Sampling (Python API)
Python bindings for deterministic Gaussian sampling and Dirac mixture reduction.
Loading...
Searching...
No Matches
gaussian_to_dirac.py
Go to the documentation of this file.
3import ctypes
4import numpy
5from typing import Optional
6from .base_approximation import BaseApproximation
7
9 """
10 Gaussian-to-Dirac approximation with covariance matrix.
11
12 The covariance matrix is internally diagonalized.
13 The optimized points are transformed back to
14 the original coordinate system.
15 """
16 def __init__(self, parent):
17 self._parent = parent
18
20 self,
21 cov: numpy.ndarray,
22 L: int,
23 N: int,
24 x: numpy.ndarray,
25 wX: Optional[numpy.ndarray] = None,
26 options: Optional[python_variant.ApproximateOptionsPy] = None,
28 """
29 Approximate Gaussian distribution by L Dirac points.
30
31 Parameters
32 ----------
33 cov : numpy.ndarray
34 Covariance matrix (N x N).
35 L : int
36 Number of Dirac components.
37 N : int
38 Dimension.
39 x : numpy.ndarray
40 Initial guess (L x N).
41 wX : numpy.ndarray, optional
42 Dirac weights.
43
44 Returns
45 -------
46 ApproximationResultPy
47 Result containing optimized Dirac points.
48 """
49 cdll = self._parent.cdll
50 if cdll is None:
51 raise OSError("C++-Library was not loaded. Unable to continue!!!")
52 covData = self._parent._check_covariance_matrix(cov, N)
53 xChecked = self._parent._check_numpy_ndarray(x, L, N)
54 wXChecked = self._parent._check_weights(wX, L)
56 success = cdll.gm_to_dirac_short_double_approximate(
57 self._parent.gm_to_dirac_double,
58 covData.sqrt_eigvals.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
59 ctypes.c_size_t(L),
60 ctypes.c_size_t(N),
61 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
62 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
63 ctypes.byref(minimizer_result),
64 (
65 None
66 if options is None
67 else ctypes_wrapper.ApproximateOptionsCTypes.from_py_type(options)
68 ),
69 )
70 result = python_variant.ApproximationResultPy.from_ctypes(
71 success, minimizer_result, x, L, N
72 )
73 result.x = result.x @ covData.Q.T
74 return result
75
77 self,
78 cov: numpy.ndarray,
79 L: int,
80 N: int,
81 x: numpy.ndarray,
82 wX: Optional[numpy.ndarray] = None,
83 bMax: int = 100
84 ) -> float:
85 cdll = self._parent.cdll
86 if cdll is None:
87 raise OSError("C++-Library was not loaded. Unable to continue!!!")
88 covData = self._parent._check_covariance_matrix(cov, N)
89 xChecked = self._parent._check_numpy_ndarray(x, L, N)
90 wXChecked = self._parent._check_weights(wX, L)
91 result = ctypes.c_double(0.0)
92 cdll.gm_to_dirac_short_double_modified_van_mises_distance_sq(
93 self._parent.gm_to_dirac_double,
94 covData.sqrt_eigvals.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
95 ctypes.byref(result),
96 ctypes.c_size_t(L),
97 ctypes.c_size_t(N),
98 ctypes.c_size_t(bMax),
99 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
100 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
101 )
102 return result.value
103
105 self,
106 cov: numpy.ndarray,
107 L: int,
108 N: int,
109 x: numpy.ndarray,
110 wX: Optional[numpy.ndarray] = None,
111 bMax: int = 100
112 ) -> float:
113 cdll = self._parent.cdll
114 if cdll is None:
115 raise OSError("C++-Library was not loaded. Unable to continue!!!")
116 covData = self._parent._check_covariance_matrix(cov, N)
117 xChecked = self._parent._check_numpy_ndarray(x, L, N)
118 wXChecked = self._parent._check_weights(wX, L)
119 gradient = numpy.zeros((L, N))
120 gradientChecked = self._parent._check_numpy_ndarray(gradient, L, N)
121 cdll.gm_to_dirac_short_double_modified_van_mises_distance_sq_derivative(
122 self._parent.gm_to_dirac_double,
123 covData.sqrt_eigvals.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
124 gradientChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
125 ctypes.c_size_t(L),
126 ctypes.c_size_t(N),
127 ctypes.c_size_t(bMax),
128 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
129 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
130 )
131 return gradient
132
134 """
135 Gaussian-to-Dirac approximation for standard normal deviation case.
136
137 Assumes standardized Gaussian structure.
138 """
139 def __init__(self, parent):
140 self._parent = parent
141
143 self,
144 L: int,
145 N: int,
146 x: numpy.ndarray,
147 wX: Optional[numpy.ndarray] = None,
148 options: Optional[python_variant.ApproximateOptionsPy] = None,
150 """
151 Approximate standard normal Gaussian with L Dirac points.
152
153 Parameters
154 ----------
155 L : int
156 Number of Dirac components.
157 N : int
158 Dimension.
159 x : numpy.ndarray
160 Initial guess (L x N).
161
162 Returns
163 -------
164 ApproximationResultPy
165 Optimization result.
166 """
167 cdll = self._parent.cdll
168 if cdll is None:
169 raise OSError("C++-Library was not loaded. Unable to continue!!!")
170 xChecked = self._parent._check_numpy_ndarray(x, L, N)
171 wXChecked = self._parent._check_weights(wX, L)
172 minimizer_result = ctypes_wrapper.GslMinimizerResultCTypes()
173 success = cdll.gm_to_dirac_short_standard_normal_deviation_double_approximate(
174 self._parent.gm_to_dirac_snd_double,
175 ctypes.c_size_t(L),
176 ctypes.c_size_t(N),
177 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
178 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
179 ctypes.byref(minimizer_result),
180 (
181 None
182 if options is None
183 else ctypes_wrapper.ApproximateOptionsCTypes.from_py_type(options)
184 ),
185 )
186 return python_variant.ApproximationResultPy.from_ctypes(
187 success, minimizer_result, x, L, N
188 )
189
191 self,
192 L: int,
193 N: int,
194 x: numpy.ndarray,
195 wX: Optional[numpy.ndarray] = None,
196 bMax: int = 100
197 ) -> float:
198 cdll = self._parent.cdll
199 if cdll is None:
200 raise OSError("C++-Library was not loaded. Unable to continue!!!")
201 xChecked = self._parent._check_numpy_ndarray(x, L, N)
202 wXChecked = self._parent._check_weights(wX, L)
203 result = ctypes.c_double(0.0)
204 cdll.gm_to_dirac_short_standard_normal_deviation_double_modified_van_mises_distance_sq(
205 self._parent.gm_to_dirac_snd_double,
206 ctypes.byref(result),
207 ctypes.c_size_t(L),
208 ctypes.c_size_t(N),
209 ctypes.c_size_t(bMax),
210 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
211 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
212 )
213 return result.value
214
216 self,
217 L: int,
218 N: int,
219 x: numpy.ndarray,
220 wX: Optional[numpy.ndarray] = None,
221 bMax: int = 100
222 ) -> numpy.ndarray:
223 cdll = self._parent.cdll
224 if cdll is None:
225 raise OSError("C++-Library was not loaded. Unable to continue!!!")
226 xChecked = self._parent._check_numpy_ndarray(x, L, N)
227 wXChecked = self._parent._check_weights(wX, L)
228 gradient = numpy.zeros((L, N))
229 gradientChecked = self._parent._check_numpy_ndarray(gradient, L, N)
230 cdll.gm_to_dirac_short_standard_normal_deviation_double_modified_van_mises_distance_sq_derivative(
231 self._parent.gm_to_dirac_snd_double,
232 gradientChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
233 ctypes.c_size_t(L),
234 ctypes.c_size_t(N),
235 ctypes.c_size_t(bMax),
236 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
237 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
238 )
239 return gradient
240
242 """
243 Closed-form Gaussian-to-Dirac approximation for even dimensions.
244
245 Standard normal target without quadrature; isotropic covariance supported.
246 """
247 def __init__(self, parent):
248 self._parent = parent
249
251 self,
252 L: int,
253 N: int,
254 bMax: float,
255 x: numpy.ndarray,
256 wX: Optional[numpy.ndarray] = None,
257 options: Optional[python_variant.ApproximateOptionsPy] = None,
259 """
260 Approximate standard normal Gaussian with L Dirac points.
261
262 Parameters
263 ----------
264 L : int
265 Number of Dirac components.
266 N : int
267 Dimension (even, >= 2).
268 bMax : float
269 Upper bound of the b-integral (> 0).
270 x : numpy.ndarray
271 Initial guess (L x N).
272
273 Returns
274 -------
275 ApproximationResultPy
276 Optimization result.
277 """
278 cdll = self._parent.cdll
279 if cdll is None:
280 raise OSError("C++-Library was not loaded. Unable to continue!!!")
281 self._parent._check_even_dimension(N)
282 self._parent._check_positive(bMax, "bMax")
283 xChecked = self._parent._check_numpy_ndarray(x, L, N)
284 wXChecked = self._parent._check_weights(wX, L)
285 minimizer_result = ctypes_wrapper.GslMinimizerResultCTypes()
286 success = cdll.gm_to_dirac_even_closed_form_double_approximate(
287 self._parent.gm_to_dirac_even_double,
288 ctypes.c_size_t(L),
289 ctypes.c_size_t(N),
290 ctypes.c_double(bMax),
291 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
292 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
293 ctypes.byref(minimizer_result),
294 (
295 None
296 if options is None
297 else ctypes_wrapper.ApproximateOptionsCTypes.from_py_type(options)
298 ),
299 )
300 return python_variant.ApproximationResultPy.from_ctypes(
301 success, minimizer_result, xChecked, L, N
302 )
303
305 self,
306 L: int,
307 N: int,
308 sigma: float,
309 bMax: float,
310 x: numpy.ndarray,
311 wX: Optional[numpy.ndarray] = None,
312 options: Optional[python_variant.ApproximateOptionsPy] = None,
314 """
315 Approximate isotropic Gaussian N(0, sigma^2 I) with L Dirac points.
316
317 Parameters
318 ----------
319 L : int
320 Number of Dirac components.
321 N : int
322 Dimension (even, >= 2).
323 sigma : float
324 Standard deviation (> 0).
325 bMax : float
326 Upper bound of the b-integral (> 0).
327 x : numpy.ndarray
328 Initial guess (L x N).
329
330 Returns
331 -------
332 ApproximationResultPy
333 Optimization result.
334 """
335 cdll = self._parent.cdll
336 if cdll is None:
337 raise OSError("C++-Library was not loaded. Unable to continue!!!")
338 self._parent._check_even_dimension(N)
339 self._parent._check_positive(sigma, "sigma")
340 self._parent._check_positive(bMax, "bMax")
341 xChecked = self._parent._check_numpy_ndarray(x, L, N)
342 wXChecked = self._parent._check_weights(wX, L)
343 minimizer_result = ctypes_wrapper.GslMinimizerResultCTypes()
344 success = cdll.gm_to_dirac_even_closed_form_double_approximate_isotropic(
345 self._parent.gm_to_dirac_even_double,
346 ctypes.c_size_t(L),
347 ctypes.c_size_t(N),
348 ctypes.c_double(sigma),
349 ctypes.c_double(bMax),
350 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
351 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
352 ctypes.byref(minimizer_result),
353 (
354 None
355 if options is None
356 else ctypes_wrapper.ApproximateOptionsCTypes.from_py_type(options)
357 ),
358 )
359 return python_variant.ApproximationResultPy.from_ctypes(
360 success, minimizer_result, xChecked, L, N
361 )
362
364 self,
365 L: int,
366 N: int,
367 bMax: float,
368 x: numpy.ndarray,
369 wX: Optional[numpy.ndarray] = None
370 ) -> float:
371 cdll = self._parent.cdll
372 if cdll is None:
373 raise OSError("C++-Library was not loaded. Unable to continue!!!")
374 self._parent._check_even_dimension(N)
375 self._parent._check_positive(bMax, "bMax")
376 xChecked = self._parent._check_numpy_ndarray(x, L, N)
377 wXChecked = self._parent._check_weights(wX, L)
378 result = ctypes.c_double(0.0)
379 cdll.gm_to_dirac_even_closed_form_double_modified_van_mises_distance_sq(
380 self._parent.gm_to_dirac_even_double,
381 ctypes.byref(result),
382 ctypes.c_size_t(L),
383 ctypes.c_size_t(N),
384 ctypes.c_double(bMax),
385 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
386 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
387 )
388 return result.value
389
391 self,
392 L: int,
393 N: int,
394 bMax: float,
395 x: numpy.ndarray,
396 wX: Optional[numpy.ndarray] = None
397 ) -> numpy.ndarray:
398 cdll = self._parent.cdll
399 if cdll is None:
400 raise OSError("C++-Library was not loaded. Unable to continue!!!")
401 self._parent._check_even_dimension(N)
402 self._parent._check_positive(bMax, "bMax")
403 xChecked = self._parent._check_numpy_ndarray(x, L, N)
404 wXChecked = self._parent._check_weights(wX, L)
405 gradient = numpy.zeros((L, N))
406 gradientChecked = self._parent._check_numpy_ndarray(gradient, L, N)
407 cdll.gm_to_dirac_even_closed_form_double_modified_van_mises_distance_sq_derivative(
408 self._parent.gm_to_dirac_even_double,
409 gradientChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
410 ctypes.c_size_t(L),
411 ctypes.c_size_t(N),
412 ctypes.c_double(bMax),
413 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
414 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
415 )
416 return gradient
417
419 self,
420 L: int,
421 N: int,
422 sigma: float,
423 bMax: float,
424 x: numpy.ndarray,
425 wX: Optional[numpy.ndarray] = None
426 ) -> float:
427 cdll = self._parent.cdll
428 if cdll is None:
429 raise OSError("C++-Library was not loaded. Unable to continue!!!")
430 self._parent._check_even_dimension(N)
431 self._parent._check_positive(sigma, "sigma")
432 self._parent._check_positive(bMax, "bMax")
433 xChecked = self._parent._check_numpy_ndarray(x, L, N)
434 wXChecked = self._parent._check_weights(wX, L)
435 result = ctypes.c_double(0.0)
436 cdll.gm_to_dirac_even_closed_form_double_modified_van_mises_distance_sq_isotropic(
437 self._parent.gm_to_dirac_even_double,
438 ctypes.byref(result),
439 ctypes.c_size_t(L),
440 ctypes.c_size_t(N),
441 ctypes.c_double(sigma),
442 ctypes.c_double(bMax),
443 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
444 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
445 )
446 return result.value
447
449 """
450 bMax-free closed-form Gaussian-to-Dirac approximation for even dimensions.
451
452 Standard normal target; returned points have zero mean.
453 """
454 def __init__(self, parent):
455 self._parent = parent
456
458 self,
459 L: int,
460 N: int,
461 x: numpy.ndarray,
462 wX: Optional[numpy.ndarray] = None,
463 options: Optional[python_variant.ApproximateOptionsPy] = None,
465 """
466 Approximate standard normal Gaussian with L Dirac points.
467
468 Parameters
469 ----------
470 L : int
471 Number of Dirac components.
472 N : int
473 Dimension (even, >= 2).
474 x : numpy.ndarray
475 Initial guess (L x N).
476
477 Returns
478 -------
479 ApproximationResultPy
480 Optimization result.
481 """
482 cdll = self._parent.cdll
483 if cdll is None:
484 raise OSError("C++-Library was not loaded. Unable to continue!!!")
485 self._parent._check_even_dimension(N)
486 xChecked = self._parent._check_numpy_ndarray(x, L, N)
487 wXChecked = self._parent._check_weights(wX, L)
488 minimizer_result = ctypes_wrapper.GslMinimizerResultCTypes()
489 success = cdll.gm_to_dirac_even_binf_double_approximate(
490 self._parent.gm_to_dirac_even_binf_double,
491 ctypes.c_size_t(L),
492 ctypes.c_size_t(N),
493 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
494 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
495 ctypes.byref(minimizer_result),
496 (
497 None
498 if options is None
499 else ctypes_wrapper.ApproximateOptionsCTypes.from_py_type(options)
500 ),
501 )
502 return python_variant.ApproximationResultPy.from_ctypes(
503 success, minimizer_result, xChecked, L, N
504 )
505
507 self,
508 L: int,
509 N: int,
510 x: numpy.ndarray,
511 wX: Optional[numpy.ndarray] = None
512 ) -> float:
513 """Distance of the mean-corrected input."""
514 cdll = self._parent.cdll
515 if cdll is None:
516 raise OSError("C++-Library was not loaded. Unable to continue!!!")
517 self._parent._check_even_dimension(N)
518 xChecked = self._parent._check_numpy_ndarray(x, L, N)
519 wXChecked = self._parent._check_weights(wX, L)
520 result = ctypes.c_double(0.0)
521 cdll.gm_to_dirac_even_binf_double_modified_van_mises_distance_sq(
522 self._parent.gm_to_dirac_even_binf_double,
523 ctypes.byref(result),
524 ctypes.c_size_t(L),
525 ctypes.c_size_t(N),
526 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
527 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
528 )
529 return result.value
530
532 self,
533 L: int,
534 N: int,
535 x: numpy.ndarray,
536 wX: Optional[numpy.ndarray] = None
537 ) -> numpy.ndarray:
538 """Gradient w.r.t. the samples of the mean-corrected input."""
539 cdll = self._parent.cdll
540 if cdll is None:
541 raise OSError("C++-Library was not loaded. Unable to continue!!!")
542 self._parent._check_even_dimension(N)
543 xChecked = self._parent._check_numpy_ndarray(x, L, N)
544 wXChecked = self._parent._check_weights(wX, L)
545 gradient = numpy.zeros((L, N))
546 gradientChecked = self._parent._check_numpy_ndarray(gradient, L, N)
547 cdll.gm_to_dirac_even_binf_double_modified_van_mises_distance_sq_derivative(
548 self._parent.gm_to_dirac_even_binf_double,
549 gradientChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
550 ctypes.c_size_t(L),
551 ctypes.c_size_t(N),
552 xChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double)),
553 None if wXChecked is None else wXChecked.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
554 )
555 return gradient
556
558 """
559 Gaussian-to-Dirac approximation interface.
560
561 Python wrapper around the C++ Gaussian approximation backend.
562
563 Provides:
564
565 - Diagonal covariance Gaussian approximation
566 - Standard normal deviation variant
567 - Closed-form even-dimensional variants (finite bMax and bMax-free)
568 - Distance evaluation
569 - Analytical gradient computation
570 """
571 def __init__(self):
572 super().__init__()
573 cdll = self.__class__.cdll
574 if cdll is None:
575 raise OSError("C++-Library was not loaded. Unable to continue!!!")
576 self.gm_to_dirac_double = cdll.create_gm_to_dirac_short_double()
578 cdll.create_gm_to_dirac_short_standard_normal_deviation_double()
579 )
580 self.gm_to_dirac_even_double = cdll.create_gm_to_dirac_even_closed_form_double()
581 self.gm_to_dirac_even_binf_double = cdll.create_gm_to_dirac_even_binf_double()
582
587
588 def __del__(self):
589 cdll = self.__class__.cdll
590 if cdll is None:
591 return
592 cdll.delete_gm_to_dirac_short_double(self.gm_to_dirac_double)
593 cdll.delete_gm_to_dirac_short_standard_normal_deviation_double(
595 )
596 cdll.delete_gm_to_dirac_even_closed_form_double(self.gm_to_dirac_even_double)
597 cdll.delete_gm_to_dirac_even_binf_double(self.gm_to_dirac_even_binf_double)
float modified_van_mises_distance_sq(self, numpy.ndarray cov, int L, int N, numpy.ndarray x, Optional[numpy.ndarray] wX=None, int bMax=100)
python_variant.ApproximationResultPy __call__(self, numpy.ndarray cov, int L, int N, numpy.ndarray x, Optional[numpy.ndarray] wX=None, Optional[python_variant.ApproximateOptionsPy] options=None)
Approximate Gaussian distribution by L Dirac points.
float modified_van_mises_distance_sq_derivative(self, numpy.ndarray cov, int L, int N, numpy.ndarray x, Optional[numpy.ndarray] wX=None, int bMax=100)
bMax-free closed-form Gaussian-to-Dirac approximation for even dimensions.
python_variant.ApproximationResultPy __call__(self, int L, int N, numpy.ndarray x, Optional[numpy.ndarray] wX=None, Optional[python_variant.ApproximateOptionsPy] options=None)
Approximate standard normal Gaussian with L Dirac points.
float modified_van_mises_distance_sq(self, int L, int N, numpy.ndarray x, Optional[numpy.ndarray] wX=None)
Distance of the mean-corrected input.
numpy.ndarray modified_van_mises_distance_sq_derivative(self, int L, int N, numpy.ndarray x, Optional[numpy.ndarray] wX=None)
Gradient w.r.t.
Closed-form Gaussian-to-Dirac approximation for even dimensions.
python_variant.ApproximationResultPy approximate_isotropic(self, int L, int N, float sigma, float bMax, numpy.ndarray x, Optional[numpy.ndarray] wX=None, Optional[python_variant.ApproximateOptionsPy] options=None)
Approximate isotropic Gaussian N(0, sigma^2 I) with L Dirac points.
float modified_van_mises_distance_sq(self, int L, int N, float bMax, numpy.ndarray x, Optional[numpy.ndarray] wX=None)
python_variant.ApproximationResultPy __call__(self, int L, int N, float bMax, numpy.ndarray x, Optional[numpy.ndarray] wX=None, Optional[python_variant.ApproximateOptionsPy] options=None)
Approximate standard normal Gaussian with L Dirac points.
numpy.ndarray modified_van_mises_distance_sq_derivative(self, int L, int N, float bMax, numpy.ndarray x, Optional[numpy.ndarray] wX=None)
float modified_van_mises_distance_sq_isotropic(self, int L, int N, float sigma, float bMax, numpy.ndarray x, Optional[numpy.ndarray] wX=None)
Gaussian-to-Dirac approximation for standard normal deviation case.
numpy.ndarray modified_van_mises_distance_sq_derivative(self, int L, int N, numpy.ndarray x, Optional[numpy.ndarray] wX=None, int bMax=100)
float modified_van_mises_distance_sq(self, int L, int N, numpy.ndarray x, Optional[numpy.ndarray] wX=None, int bMax=100)
python_variant.ApproximationResultPy __call__(self, int L, int N, numpy.ndarray x, Optional[numpy.ndarray] wX=None, Optional[python_variant.ApproximateOptionsPy] options=None)
Approximate standard normal Gaussian with L Dirac points.