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 T* x,
27 wXf wXcallback,
28 wXd wXDcallback,
29 GslminimizerResult* result = nullptr,
30 const ApproximateOptions& options = ApproximateOptions{}) override;
31 // clang-format on
32
33 // clang-format off
34 void modified_van_mises_distance_sq(T* distance,
35 const T *y,
36 size_t M,
37 size_t L,
38 size_t N,
39 size_t bMax,
40 T *x,
41 wXf wXcallback,
42 wXd wXDcallback) override;
43 // clang-format on
44
45 // clang-format off
47 const T *y,
48 size_t M,
49 size_t L,
50 size_t N,
51 size_t bMax,
52 T *x,
53 wXf wXcallback,
54 wXd wXDcallback) override;
55
56 // clang-format off
57 bool approximate(const GSLVectorType* y,
58 size_t L,
59 size_t N,
60 GSLVectorType* x,
61 wXf wXcallback,
62 wXd wXDcallback,
63 GslminimizerResult* result = nullptr,
64 const ApproximateOptions& options = ApproximateOptions{}) override;
65 // clang-format on
66
67 // clang-format off
69 const GSLVectorType *y,
70 size_t L,
71 size_t N,
72 size_t bMax,
73 GSLVectorType *x,
74 wXf wXcallback,
75 wXd wXDcallback) override;
76 // clang-format on
77
78 // clang-format off
79 void modified_van_mises_distance_sq_derivative(GSLMatrixType* gradient,
80 const GSLVectorType *y,
81 size_t L,
82 size_t N,
83 size_t bMax,
84 GSLVectorType *x,
85 wXf wXcallback,
86 wXd wXDcallback) override;
87 // clang-format on
88
89 // clang-format off
90 bool approximate(GSLMatrixType* y,
91 size_t L,
92 GSLMatrixType* x,
93 wXf wXcallback,
94 wXd wXDeriv,
95 GslminimizerResult* result = nullptr,
96 const ApproximateOptions& options = ApproximateOptions{}) override;
97 // clang-format on
98
99 // clang-format off
100 void modified_van_mises_distance_sq(T* distance,
101 GSLMatrixType *y,
102 size_t L,
103 size_t bMax,
104 GSLMatrixType *x,
105 wXf wXcallback,
106 wXd wXDcallback) override;
107 // clang-format on
108
109 // clang-format off
110 void modified_van_mises_distance_sq_derivative(GSLMatrixType* gradient,
111 GSLMatrixType *y,
112 size_t L,
113 size_t bMax,
114 GSLMatrixType *x,
115 wXf wXcallback,
116 wXd wXDcallback) override;
117 // clang-format on
118
119 private:
120 static double c_b(size_t bMax);
121 static double modified_van_mises_distance_sq(const gsl_vector* x,
122 void* params);
123 static void modified_van_mises_distance_sq_derivative(const gsl_vector* x,
124 void* params,
125 gsl_vector* grad);
126 static void combined_distance_metric(const gsl_vector* x, void* params,
127 double* f, gsl_vector* grad);
128
129 FRIEND_TEST(
130 dirac_to_dirac_approx_short_function_test_modified_van_mises_distance_sq_derivative,
131 parameterized_test_modified_van_mises_distance_sq_derivative);
132};
133
134template <>
136 const gsl_vector* y, size_t L, size_t N, gsl_vector* x, wXf wXcallback,
137 wXd wXDcallback, GslminimizerResult* result,
138 const ApproximateOptions& options);
139
140template <>
142 double>::modified_van_mises_distance_sq(double* distance,
143 const gsl_vector* y, size_t L,
144 size_t N, size_t bMax,
145 gsl_vector* x, wXf wXcallback,
146 wXd wXDcallback);
147
148template <>
150 double>::modified_van_mises_distance_sq_derivative(gsl_matrix* gradient,
151 const gsl_vector* y,
152 size_t L, size_t N,
153 size_t bMax,
154 gsl_vector* x,
155 wXf wXcallback,
156 wXd wXDcallback);
157
159
160#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 T *y, size_t M, size_t L, size_t N, 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(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
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
bool approximate(const GSLVectorType *y, size_t L, size_t N, GSLVectorType *x, wXf wXcallback, wXd wXDcallback, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{}) override
reduce the data points using gsl vectors
Definition approximate_options.h:6
struct to hold the result of the minimization
Definition gsl_minimizer.h:32