Mercurial > hg > qm-dsp
comparison hmm/hmm.c @ 414:7e8d1f26b098
Fix compiler warnings with -Wall -Wextra
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Mon, 28 Sep 2015 12:33:17 +0100 |
parents | d5014ab8b0e5 |
children | fdaa63607c15 |
comparison
equal
deleted
inserted
replaced
413:ec7318974497 | 414:7e8d1f26b098 |
---|---|
260 free(icov[i]); | 260 free(icov[i]); |
261 free(icov); | 261 free(icov); |
262 | 262 |
263 free(gauss_y); | 263 free(gauss_y); |
264 free(gauss_z); | 264 free(gauss_z); |
265 } | |
266 | |
267 void mlss_reestimate(double* p0, double** a, double** mu, double** cov, int N, int T, int L, int* q, double** x) | |
268 { | |
269 /* fit a single Gaussian to observations in each state */ | |
270 | |
271 /* calculate the mean observation in each state */ | |
272 | |
273 /* calculate the overall covariance */ | |
274 | |
275 /* count transitions */ | |
276 | |
277 /* estimate initial probs from transitions (???) */ | |
278 } | 265 } |
279 | 266 |
280 void baum_welch(double* p0, double** a, double** mu, double** cov, int N, int T, int L, double** x, double*** xi, double** gamma) | 267 void baum_welch(double* p0, double** a, double** mu, double** cov, int N, int T, int L, double** x, double*** xi, double** gamma) |
281 { | 268 { |
282 int i, j, t; | 269 int i, j, t; |
747 } | 734 } |
748 | 735 |
749 /* probability of multivariate Gaussian given mean, inverse and determinant of covariance */ | 736 /* probability of multivariate Gaussian given mean, inverse and determinant of covariance */ |
750 double gauss(double* x, int L, double* mu, double** icov, double detcov, double* y, double* z) | 737 double gauss(double* x, int L, double* mu, double** icov, double detcov, double* y, double* z) |
751 { | 738 { |
752 int i, j; | 739 int i; |
753 double s = 0; | 740 double s = 0; |
754 for (i = 0; i < L; i++) | 741 for (i = 0; i < L; i++) |
755 y[i] = x[i] - mu[i]; | 742 y[i] = x[i] - mu[i]; |
756 for (i = 0; i < L; i++) | 743 for (i = 0; i < L; i++) |
757 { | 744 { |
768 } | 755 } |
769 | 756 |
770 /* log probability of multivariate Gaussian given mean, inverse and determinant of covariance */ | 757 /* log probability of multivariate Gaussian given mean, inverse and determinant of covariance */ |
771 double loggauss(double* x, int L, double* mu, double** icov, double detcov, double* y, double* z) | 758 double loggauss(double* x, int L, double* mu, double** icov, double detcov, double* y, double* z) |
772 { | 759 { |
773 int i, j; | 760 int i; |
774 double s = 0; | 761 double s = 0; |
775 double ret; | 762 double ret; |
776 for (i = 0; i < L; i++) | 763 for (i = 0; i < L; i++) |
777 y[i] = x[i] - mu[i]; | 764 y[i] = x[i] - mu[i]; |
778 for (i = 0; i < L; i++) | 765 for (i = 0; i < L; i++) |