annotate hmm/hmm.h @ 483:fdaa63607c15

Untabify, indent, tidy
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 31 May 2019 11:54:32 +0100
parents d5014ab8b0e5
children d48276a3ae24
rev   line source
c@244 1 /*
c@244 2 * hmm.h
c@244 3 *
c@244 4 * Created by Mark Levy on 12/02/2006.
c@309 5 * Copyright 2006 Centre for Digital Music, Queen Mary, University of London.
c@309 6
c@309 7 This program is free software; you can redistribute it and/or
c@309 8 modify it under the terms of the GNU General Public License as
c@309 9 published by the Free Software Foundation; either version 2 of the
c@309 10 License, or (at your option) any later version. See the file
c@309 11 COPYING included with this distribution for more information.
c@244 12 *
c@244 13 */
c@244 14
cannam@483 15 #ifndef _HMM_H
cannam@483 16 #define _HMM_H
cannam@483 17
cannam@483 18 #ifdef __cplusplus
cannam@483 19 extern "C" {
cannam@483 20 #endif
cannam@483 21
c@244 22 #ifndef PI
c@244 23 #define PI 3.14159265358979323846264338327950288
c@244 24 #endif
c@244 25
c@244 26 typedef struct _model_t {
cannam@483 27 int N; /* number of states */
cannam@483 28 double* p0; /* initial probs */
cannam@483 29 double** a; /* transition probs */
cannam@483 30 int L; /* dimensionality of data */
cannam@483 31 double** mu; /* state means */
cannam@483 32 double** cov; /* covariance, tied between all states */
c@244 33 } model_t;
c@244 34
cannam@483 35 void hmm_train(double** x, int T, model_t* model); /* with scaling */
cannam@483 36
cannam@483 37 void forward_backwards(double*** xi, double** gamma,
cannam@483 38 double* loglik, double* loglik1, double* loglik2,
cannam@483 39 int iter, int N, int T,
cannam@483 40 double* p0, double** a, double** b);
cannam@483 41
cannam@483 42 void baum_welch(double* p0, double** a, double** mu, double** cov,
cannam@483 43 int N, int T, int L, double** x, double*** xi, double** gamma);
cannam@483 44
cannam@483 45 void viterbi_decode(double** x, int T, model_t* model, int* q); /* using logs */
cannam@483 46
c@244 47 model_t* hmm_init(double** x, int T, int L, int N);
c@244 48 void hmm_close(model_t* model);
cannam@483 49
cannam@483 50 void invert(double** cov, int L, double** icov, double* detcov); /* uses LAPACK */
cannam@483 51
cannam@483 52 double gauss(double* x, int L, double* mu, double** icov,
cannam@483 53 double detcov, double* y, double* z);
cannam@483 54
cannam@483 55 double loggauss(double* x, int L, double* mu, double** icov,
cannam@483 56 double detcov, double* y, double* z);
cannam@483 57
c@244 58 void hmm_print(model_t* model);
c@244 59
c@245 60 #ifdef __cplusplus
c@245 61 }
c@244 62 #endif
c@244 63
c@245 64 #endif
c@245 65