Deterministic Gaussian Sampling
Loading...
Searching...
No Matches
dirac_to_dirac_approx_short_function.h
1#ifndef DIRAC_TO_DIRAC_SHORT_FUNCTION_H
2#define DIRAC_TO_DIRAC_SHORT_FUNCTION_H
3
4#include <gtest/gtest.h>
5
6#include "dirac_to_dirac_approx_function_i.h"
7
8template <typename T>
11 public:
12 using GSLVectorType =
13 typename dirac_to_dirac_approx_function_i<T>::GSLVectorType;
14 using GSLVectorViewType =
15 typename dirac_to_dirac_approx_function_i<T>::GSLVectorViewType;
16 using GSLMatrixType =
17 typename dirac_to_dirac_approx_function_i<T>::GSLMatrixType;
18 using wXf = typename dirac_to_dirac_approx_function_i<T>::wXf;
19 using wXd = typename dirac_to_dirac_approx_function_i<T>::wXd;
20
21 // clang-format off
22 bool approximate(const T* y,
23 size_t M,
24 size_t L,
25 size_t N,
26 size_t bMax,
27 T* x,
28 wXf wXcallback,
29 wXd wXDcallback,
30 GslminimizerResult* result = nullptr,
31 const ApproximateOptions& options = ApproximateOptions{}) override;
32 // clang-format on
33
34 // clang-format off
35 void modified_van_mises_distance_sq(T* distance,
36 const T *y,
37 size_t M,
38 size_t L,
39 size_t N,
40 size_t bMax,
41 T *x,
42 wXf wXcallback,
43 wXd wXDcallback) override;
44 // clang-format on
45
46 // clang-format off
48 const T *y,
49 size_t M,
50 size_t L,
51 size_t N,
52 size_t bMax,
53 T *x,
54 wXf wXcallback,
55 wXd wXDcallback) override;
56
57 // clang-format off
58 bool approximate(const GSLVectorType* y,
59 size_t L,
60 size_t N,
61 size_t bMax,
62 GSLVectorType* x,
63 wXf wXcallback,
64 wXd wXDcallback,
65 GslminimizerResult* result = nullptr,
66 const ApproximateOptions& options = ApproximateOptions{}) override;
67 // clang-format on
68
69 // clang-format off
71 const GSLVectorType *y,
72 size_t L,
73 size_t N,
74 size_t bMax,
75 GSLVectorType *x,
76 wXf wXcallback,
77 wXd wXDcallback) override;
78 // clang-format on
79
80 // clang-format off
81 void modified_van_mises_distance_sq_derivative(GSLMatrixType* gradient,
82 const GSLVectorType *y,
83 size_t L,
84 size_t N,
85 size_t bMax,
86 GSLVectorType *x,
87 wXf wXcallback,
88 wXd wXDcallback) override;
89 // clang-format on
90
91 // clang-format off
92 bool approximate(GSLMatrixType* y,
93 size_t L,
94 size_t bMax,
95 GSLMatrixType* x,
96 wXf wXcallback,
97 wXd wXDeriv,
98 GslminimizerResult* result = nullptr,
99 const ApproximateOptions& options = ApproximateOptions{}) override;
100 // clang-format on
101
102 // clang-format off
103 void modified_van_mises_distance_sq(T* distance,
104 GSLMatrixType *y,
105 size_t L,
106 size_t bMax,
107 GSLMatrixType *x,
108 wXf wXcallback,
109 wXd wXDcallback) override;
110 // clang-format on
111
112 // clang-format off
113 void modified_van_mises_distance_sq_derivative(GSLMatrixType* gradient,
114 GSLMatrixType *y,
115 size_t L,
116 size_t bMax,
117 GSLMatrixType *x,
118 wXf wXcallback,
119 wXd wXDcallback) override;
120 // clang-format on
121
122 private:
123 static double c_b(size_t bMax);
124 static double modified_van_mises_distance_sq(const gsl_vector* x,
125 void* params);
126 static void modified_van_mises_distance_sq_derivative(const gsl_vector* x,
127 void* params,
128 gsl_vector* grad);
129 static void combined_distance_metric(const gsl_vector* x, void* params,
130 double* f, gsl_vector* grad);
131
132 FRIEND_TEST(
133 dirac_to_dirac_approx_short_function_test_modified_van_mises_distance_sq_derivative,
134 parameterized_test_modified_van_mises_distance_sq_derivative);
135};
136
137template <>
139 const gsl_vector* y, size_t L, size_t N, size_t bMax, gsl_vector* x,
140 wXf wXcallback, wXd wXDcallback, GslminimizerResult* result,
141 const ApproximateOptions& options);
142
143template <>
145 double>::modified_van_mises_distance_sq(double* distance,
146 const gsl_vector* y, size_t L,
147 size_t N, size_t bMax,
148 gsl_vector* x, wXf wXcallback,
149 wXd wXDcallback);
150
151template <>
153 double>::modified_van_mises_distance_sq_derivative(gsl_matrix* gradient,
154 const gsl_vector* y,
155 size_t L, size_t N,
156 size_t bMax,
157 gsl_vector* x,
158 wXf wXcallback,
159 wXd wXDcallback);
160
162
163#endif // DIRAC_TO_DIRAC_SHORT_FUNCTION_H
interface for the gausian mixture to dirac approximation with a custom weight function
Definition dirac_to_dirac_approx_function_i.h:21
Definition dirac_to_dirac_approx_short_function.h:10
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, wXf wXcallback, wXd wXDcallback) override
calculate modified van mises distance based on x and y
Definition dirac_to_dirac_approx_short_function.cpp:34
void modified_van_mises_distance_sq_derivative(GSLMatrixType *gradient, const GSLVectorType *y, size_t L, size_t N, size_t bMax, GSLVectorType *x, wXf wXcallback, wXd wXDcallback) override
calculate modified van mises distance based on x and y
bool approximate(const GSLVectorType *y, size_t L, size_t N, size_t bMax, GSLVectorType *x, wXf wXcallback, wXd wXDcallback, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{}) override
reduce the data points using gsl vectors
void modified_van_mises_distance_sq(T *distance, const GSLVectorType *y, size_t L, size_t N, size_t bMax, GSLVectorType *x, wXf wXcallback, wXd wXDcallback) override
calculate modified van mises distance based on x and y
bool approximate(const T *y, size_t M, size_t L, size_t N, size_t bMax, T *x, wXf wXcallback, wXd wXDcallback, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{}) override
reduce the data points using raw pointers
Definition dirac_to_dirac_approx_short_function.cpp:20
void modified_van_mises_distance_sq_derivative(T *gradient, const T *y, size_t M, size_t L, size_t N, size_t bMax, T *x, wXf wXcallback, wXd wXDcallback) override
calculate modified van mises distance based on x and y
Definition dirac_to_dirac_approx_short_function.cpp:48
Definition approximate_options.h:6
struct to hold the result of the minimization
Definition gsl_minimizer.h:32