annotate SparseHMM.h @ 164:a7d9c6142f8f tip

Added tag v1.2 for changeset 4a97f7638ffd
author Chris Cannam
date Thu, 06 Feb 2020 15:02:47 +0000
parents 3faac48d491d
children
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:
Chris@146 28 SparseHMM(int fixedLag); // set fixedLag == 0 when doing full Viterbi
Chris@146 29
Chris@146 30 virtual std::vector<double> calculateObsProb
Chris@156 31 (const vector<pair<double, double> > &) = 0;
Chris@146 32
mail@130 33 virtual void build();
Chris@145 34 std::vector<int> decodeViterbi(std::vector<vector<double> > obs);
mail@131 35 void reset();
mail@130 36 void initialise(vector<double> firstObs);
mail@130 37 int process(vector<double> newObs);
Chris@145 38 vector<int> track();
Chris@146 39
mail@130 40 // "sparse" HMM definition
mail@132 41 int m_fixedLag;
mail@130 42 int m_nState;
mail@130 43 int m_nTrans;
mail@130 44 vector<double> m_init;
mail@130 45 vector<size_t> m_from;
mail@130 46 vector<size_t> m_to;
mail@130 47 vector<double> m_transProb;
mail@130 48
mail@130 49 // variables for decoding
mail@130 50 deque<double> m_scale;
mail@130 51 deque<vector<int> > m_psi;
mail@130 52 vector<double> m_delta;
mail@130 53 vector<double> m_oldDelta;
matthiasm@0 54 };
matthiasm@0 55
Chris@9 56 #endif