20 #ifndef GAIA_KULLBACKLEIBLERDISTANCE_H 21 #define GAIA_KULLBACKLEIBLERDISTANCE_H 23 #include "distancefunction.h" 43 int _meanIdx, _covIdx, _icovIdx;
44 int _meanIdxEnd, _covIdxEnd, _icovIdxEnd;
54 for (
int i=0; i<size; i++) {
55 for (
int j=0; j<size; j++) {
56 result += m1[i*size + j] * m2[j*size + i];
71 const Real* v1,
const Real* v2,
80 for (
int i=0; i<size; i++) v[i] = v1[i] - v2[i];
82 for (
int i=0; i<size; i++) {
83 for (
int j=0; j<size; j++) {
84 result += (m1[i*size + j] + m2[i*size + j]) * v[j] * v[i];
95 #endif // GAIA_KULLBACKLEIBLERDISTANCE_H This class describes the layout of a point.
Definition: pointlayout.h:60
Real traceMatrixProduct(const Real *m1, const Real *m2, int size)
Compute the trace of the matrix product of m1 and m2.
Definition: kullbackleiblerdistance.h:52
Main Gaia namespace, which contains all the library functions.
Definition: addfield.cpp:22
Definition: distancefunction.h:37
Definition: parameter.h:34
Real operator()(const Point &p1, const Point &p2, int seg1, int seg2) const
This function computes the distance between the two given points.
Definition: kullbackleiblerdistance.cpp:65
This class computes the symmetric Kullback-Leibler distance of a given Region.
Definition: kullbackleiblerdistance.h:37
Real traceMatrixProductMean(const Real *m1, const Real *m2, const Real *v1, const Real *v2, int size)
Compute the trace of the product of 2 matrices and vectors using the formula: trace((m1+m2)*(v1-v2)*(...
Definition: kullbackleiblerdistance.h:70