Threaded Dirac-to-Dirac reduction.
Overview
dirac_to_dirac_approx_short_thread<T> is the multi-threaded variant of dirac_to_dirac_approx_short.
It provides the same functionality, interface, and behavior as the single-threaded implementation, but evaluates the distance metric and its gradient in parallel.
The optimization result is equivalent to the non-threaded version.
Use this implementation for:
- Large M (input components)
- Large L (reduced components)
- High-dimensional problems
- Performance-critical applications
Interface
Inherits:
- dirac_to_dirac_approx_i<T>
Template parameter:
All overloads of:
- approximate(...)
- modified_van_mises_distance_sq(...)
- modified_van_mises_distance_sq_derivative(...)
are identical to the non-threaded implementation.
Supported Input Formats
The same overload families as in dirac_to_dirac_approx_short are available:
- Raw pointer interface (T*)
- GSL vector interface (gsl_vector / gsl_vector_float)
- GSL matrix interface (gsl_matrix / gsl_matrix_float)
Memory layout and parameter semantics are unchanged.
Weights
- wY: weights of input Dirac mixture
- wX: weights of reduced mixture
If nullptr:
- Uniform weights are assumed
Example (Raw Pointer)
y,
M,
L,
N,
bMax,
x,
wX,
wY,
);
Definition dirac_to_dirac_approx_short.h:9
bool approximate(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, GslminimizerResult *result=nullptr, const ApproximateOptions &options=ApproximateOptions{}) override
reduce the data points using raw pointers
Definition dirac_to_dirac_approx_short.cpp:24
Example (GSL Vector)
Example (GSL Matrix)
Notes
- Produces the same results as dirac_to_dirac_approx_short
- Parallelizes internal distance and gradient evaluation
- Interface-compatible replacement for the non-threaded version
If threading is not required, use dirac_to_dirac_approx_short.