annotate SparseHMM.h @ 130:080fe18f5ebf fixedlag

refactored Viterbi * perhaps I even discovered a bug (probablity sum was not reset for every frame)
author Matthias Mauch <mail@matthiasmauch.net>
date Fri, 03 Jul 2015 12:22:44 +0100
parents 5945b8905d1f
children b877df85ad9e
rev   line source
matthiasm@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@9 2
matthiasm@0 3 /*
Chris@9 4 pYIN - A fundamental frequency estimator for monophonic audio
Chris@9 5 Centre for Digital Music, Queen Mary, University of London.
Chris@9 6
Chris@9 7 This program is free software; you can redistribute it and/or
Chris@9 8 modify it under the terms of the GNU General Public License as
Chris@9 9 published by the Free Software Foundation; either version 2 of the
Chris@9 10 License, or (at your option) any later version. See the file
Chris@9 11 COPYING included with this distribution for more information.
matthiasm@0 12 */
matthiasm@0 13
matthiasm@0 14 #ifndef _SPARSEHMM_H_
matthiasm@0 15 #define _SPARSEHMM_H_
matthiasm@0 16
matthiasm@0 17 #include <vector>
mail@130 18 #include <queue>
matthiasm@0 19 #include <cstdio>
matthiasm@0 20
matthiasm@0 21 using std::vector;
mail@130 22 using std::deque;
matthiasm@0 23 using std::pair;
matthiasm@0 24
matthiasm@0 25 class SparseHMM
matthiasm@0 26 {
matthiasm@0 27 public:
mail@130 28 SparseHMM();
mail@130 29 virtual const std::vector<double>
mail@130 30 calculateObsProb(const vector<pair<double, double> >);
mail@130 31 virtual void build();
mail@130 32 const std::vector<int> decodeViterbi(std::vector<vector<double> > obs);
mail@130 33 void initialise(vector<double> firstObs);
mail@130 34 int process(vector<double> newObs);
mail@130 35 vector<int> finalise();
mail@130 36 // "sparse" HMM definition
mail@130 37 int m_nState;
mail@130 38 int m_nTrans;
mail@130 39 vector<double> m_init;
mail@130 40 vector<size_t> m_from;
mail@130 41 vector<size_t> m_to;
mail@130 42 vector<double> m_transProb;
mail@130 43
mail@130 44 // variables for decoding
mail@130 45 deque<double> m_scale;
mail@130 46 deque<vector<int> > m_psi;
mail@130 47 vector<double> m_delta;
mail@130 48 vector<double> m_oldDelta;
matthiasm@0 49 };
matthiasm@0 50
Chris@9 51 #endif