libsent/src/phmm/calc_mix.c

Go to the documentation of this file.
00001 
00018 /*
00019  * Copyright (c) 1991-2007 Kawahara Lab., Kyoto University
00020  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00021  * Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology
00022  * All rights reserved
00023  */
00024 
00025 #include <sent/stddefs.h>
00026 #include <sent/htk_hmm.h>
00027 #include <sent/htk_param.h>
00028 #include <sent/hmm.h>
00029 #include <sent/hmm_calc.h>
00030 
00040 LOGPROB
00041 calc_mix(HMMWork *wrk)
00042 {
00043   int i;
00044   LOGPROB logprob = LOG_ZERO;
00045   int n;
00046   LOGPROB *s;
00047   PROB *w;
00048   int *id;
00049 
00050   /* compute Gaussian set */
00051   (*(wrk->compute_gaussset))(wrk, wrk->OP_state->b, wrk->OP_state->mix_num, NULL);
00052   /* computed Gaussians will be set in:
00053      score ... OP_calced_score[0..OP_calced_num]
00054      id    ... OP_calced_id[0..OP_calced_num] */
00055   
00056   n = wrk->OP_calced_num;
00057   s = wrk->OP_calced_score;
00058   w = wrk->OP_state->bweight;
00059   id = wrk->OP_calced_id;
00060 
00061   /* sum */
00062   for(i=0;i<n;i++) {
00063     s[i] += w[id[i]];
00064   }
00065   logprob = addlog_array(s, n);
00066   if (logprob <= LOG_ZERO) return LOG_ZERO;
00067   return (logprob * INV_LOG_TEN);
00068 }

Generated on Tue Dec 18 15:59:56 2007 for Julius by  doxygen 1.5.4