1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2008 QMUL.
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
16 #ifndef KLDIVERGENCE_H
17 #define KLDIVERGENCE_H
24 * Helper methods for calculating Kullback-Leibler divergences.
33 * Calculate a symmetrised Kullback-Leibler divergence of Gaussian
34 * models based on mean and variance vectors. All input vectors
35 * must be of equal size.
37 double distanceGaussian(const vector
<double> &means1
,
38 const vector
<double> &variances1
,
39 const vector
<double> &means2
,
40 const vector
<double> &variances2
);
43 * Calculate a Kullback-Leibler divergence of two probability
44 * distributions. Input vectors must be of equal size. If
45 * symmetrised is true, the result will be the symmetrised
46 * distance (equal to KL(d1, d2) + KL(d2, d1)).
48 double distanceDistribution(const vector
<double> &d1
,
49 const vector
<double> &d2
,