Mercurial > hg > qm-dsp
annotate maths/KLDivergence.h @ 256:43943a4382ef
* Add cosine distance and the self-similarity matrix used for SB rhythmic
similarity
* Pull out SB timbral similarity KL divergence into its own file
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 18 Jan 2008 14:40:20 +0000 |
parents | |
children | 499d438b52ba |
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@256 | 7 This file copyright 2008 QMUL |
c@256 | 8 All rights reserved. |
c@256 | 9 */ |
c@256 | 10 |
c@256 | 11 #ifndef KLDIVERGENCE_H |
c@256 | 12 #define KLDIVERGENCE_H |
c@256 | 13 |
c@256 | 14 #include <vector> |
c@256 | 15 |
c@256 | 16 using std::vector; |
c@256 | 17 |
c@256 | 18 /** |
c@256 | 19 * Calculate a symmetrised Kullback-Leibler divergence of Gaussian |
c@256 | 20 * models based on mean and variance vectors. All input vectors must |
c@256 | 21 * be of equal size. |
c@256 | 22 */ |
c@256 | 23 |
c@256 | 24 class KLDivergence |
c@256 | 25 { |
c@256 | 26 public: |
c@256 | 27 KLDivergence() { } |
c@256 | 28 ~KLDivergence() { } |
c@256 | 29 |
c@256 | 30 double distance(const vector<double> &means1, |
c@256 | 31 const vector<double> &variances1, |
c@256 | 32 const vector<double> &means2, |
c@256 | 33 const vector<double> &variances2); |
c@256 | 34 }; |
c@256 | 35 |
c@256 | 36 #endif |
c@256 | 37 |