annotate maths/KLDivergence.h @ 321:f1e6be2de9a5

A threshold (delta) is added in the peak picking parameters structure (PPickParams). It is used as an offset when computing the smoothed detection function. A constructor for the structure PPickParams is also added to set the parameters to 0 when a structure instance is created. Hence programmes using the peak picking parameter structure and which do not set the delta parameter (e.g. QM Vamp note onset detector) won't be affected by the modifications. Functions modified: - dsp/onsets/PeakPicking.cpp - dsp/onsets/PeakPicking.h - dsp/signalconditioning/DFProcess.cpp - dsp/signalconditioning/DFProcess.h
author mathieub <mathieu.barthet@eecs.qmul.ac.uk>
date Mon, 20 Jun 2011 19:01:48 +0100
parents d5014ab8b0e5
children 701233f8ed41
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 /*
c@256 4 QM DSP Library
c@256 5
c@256 6 Centre for Digital Music, Queen Mary, University of London.
c@258 7 This file copyright 2008 QMUL.
c@309 8
c@309 9 This program is free software; you can redistribute it and/or
c@309 10 modify it under the terms of the GNU General Public License as
c@309 11 published by the Free Software Foundation; either version 2 of the
c@309 12 License, or (at your option) any later version. See the file
c@309 13 COPYING included with this distribution for more information.
c@256 14 */
c@256 15
c@256 16 #ifndef KLDIVERGENCE_H
c@256 17 #define KLDIVERGENCE_H
c@256 18
c@256 19 #include <vector>
c@256 20
c@256 21 using std::vector;
c@256 22
c@256 23 /**
c@258 24 * Helper methods for calculating Kullback-Leibler divergences.
c@256 25 */
c@256 26 class KLDivergence
c@256 27 {
c@256 28 public:
c@256 29 KLDivergence() { }
c@256 30 ~KLDivergence() { }
c@256 31
c@258 32 /**
c@258 33 * Calculate a symmetrised Kullback-Leibler divergence of Gaussian
c@258 34 * models based on mean and variance vectors. All input vectors
c@258 35 * must be of equal size.
c@258 36 */
c@258 37 double distanceGaussian(const vector<double> &means1,
c@258 38 const vector<double> &variances1,
c@258 39 const vector<double> &means2,
c@258 40 const vector<double> &variances2);
c@258 41
c@258 42 /**
c@258 43 * Calculate a Kullback-Leibler divergence of two probability
c@258 44 * distributions. Input vectors must be of equal size. If
c@258 45 * symmetrised is true, the result will be the symmetrised
c@258 46 * distance (equal to KL(d1, d2) + KL(d2, d1)).
c@258 47 */
c@258 48 double distanceDistribution(const vector<double> &d1,
c@258 49 const vector<double> &d2,
c@258 50 bool symmetrised);
c@256 51 };
c@256 52
c@256 53 #endif
c@256 54