annotate maths/KLDivergence.h @ 515:08bcc06c38ec tip master

Remove fast-math
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 28 Jan 2020 15:27:37 +0000
parents bb78ca3fe7de
children
rev   line source
c@256 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@256 2 /*
c@256 3 QM DSP Library
c@256 4
c@256 5 Centre for Digital Music, Queen Mary, University of London.
c@258 6 This file copyright 2008 QMUL.
c@309 7
c@309 8 This program is free software; you can redistribute it and/or
c@309 9 modify it under the terms of the GNU General Public License as
c@309 10 published by the Free Software Foundation; either version 2 of the
c@309 11 License, or (at your option) any later version. See the file
c@309 12 COPYING included with this distribution for more information.
c@256 13 */
c@256 14
cannam@489 15 #ifndef QM_DSP_KLDIVERGENCE_H
cannam@489 16 #define QM_DSP_KLDIVERGENCE_H
c@256 17
c@256 18 #include <vector>
c@256 19
c@256 20 /**
c@258 21 * Helper methods for calculating Kullback-Leibler divergences.
c@256 22 */
c@256 23 class KLDivergence
c@256 24 {
c@256 25 public:
c@256 26 KLDivergence() { }
c@256 27 ~KLDivergence() { }
c@256 28
c@258 29 /**
c@258 30 * Calculate a symmetrised Kullback-Leibler divergence of Gaussian
c@258 31 * models based on mean and variance vectors. All input vectors
c@258 32 * must be of equal size.
c@258 33 */
cannam@493 34 double distanceGaussian(const std::vector<double> &means1,
cannam@493 35 const std::vector<double> &variances1,
cannam@493 36 const std::vector<double> &means2,
cannam@493 37 const std::vector<double> &variances2);
c@258 38
c@258 39 /**
c@258 40 * Calculate a Kullback-Leibler divergence of two probability
c@258 41 * distributions. Input vectors must be of equal size. If
c@258 42 * symmetrised is true, the result will be the symmetrised
c@258 43 * distance (equal to KL(d1, d2) + KL(d2, d1)).
c@258 44 */
cannam@493 45 double distanceDistribution(const std::vector<double> &d1,
cannam@493 46 const std::vector<double> &d2,
c@258 47 bool symmetrised);
c@256 48 };
c@256 49
c@256 50 #endif
c@256 51