This file is indexed.

/usr/include/sphinxtrain/gauden.h is in sphinxtrain-dev 1.0.8-0ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
/* ====================================================================
 * Copyright (c) 1995-2000 Carnegie Mellon University.  All rights 
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * This work was supported in part by funding from the Defense Advanced 
 * Research Projects Agency and the National Science Foundation of the 
 * United States of America, and the CMU Sphinx Speech Consortium.
 *
 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 
 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 *
 */
/*********************************************************************
 *
 * File: gauden.h
 * 
 * Description: 
 *	
 * Author: 
 * 	Eric H. Thayer (eht@cs.cmu.edu)
 *********************************************************************/

#ifndef GAUDEN_H
#define GAUDEN_H

#ifdef __cplusplus
extern "C" {
#endif
#if 0
}
#endif

#define D_FACTOR 2.0
#define MIN_VAR 1.0E-20

#include <s3/s3.h>
#include <s3/vector.h>

#include <stdio.h>

typedef struct gauden_s {
    uint32 n_feat;
    uint32 *veclen;

    uint32 n_mgau;
    uint32 n_density;
    uint32 n_top;

    float32 ***norm;
    vector_t ***mean;
    vector_t ***var;
    vector_t ****fullvar;

    vector_t ***macc;
    vector_t ***vacc;
    vector_t ****fullvacc;
    float32  ***dnom;

    vector_t ***l_macc;
    vector_t ***l_vacc;
    vector_t ****l_fullvacc;
    float32  ***l_dnom;
} gauden_t;

#define MAX_LOG_DEN	10.0


int
gauden_set_min_var(float32 min);

gauden_t *
gauden_alloc(void);

int
gauden_set_feat(gauden_t *g,
		uint32 n_feat,
		const uint32 *veclen);

int
gauden_set_n_top(gauden_t *g,
		 uint32 n_top);	/* # of densities to compute for output prob */
int
gauden_set_n_mgau(gauden_t *g,
		  uint32 n);

int
gauden_set_n_density(gauden_t *g,
		     uint32 n);

vector_t ***
gauden_mean(gauden_t *g);

int
gauden_set_mean(gauden_t *g,
		vector_t ***mean);

vector_t ***
gauden_var(gauden_t *g);

int
gauden_set_var(gauden_t *g,
	       vector_t ***variance);

vector_t ****
gauden_fullvar(gauden_t *g);

int
gauden_set_fullvar(gauden_t *g,
		   vector_t ****variance);

vector_t ***
gauden_alloc_param(uint32 n_cb,
		   uint32 n_stream,
		   uint32 n_density,
		   const uint32 *veclen);

vector_t ****
gauden_alloc_param_full(uint32 n_cb,
			uint32 n_feat,
			uint32 n_density,
			const uint32 *veclen);

int
gauden_set_const_dim_mgau(gauden_t *g,
			  uint32 n_mgau,	/* # of mixture gaussians */
			  uint32 n_density);	/* # of densities per mixture gaussian */

#define gauden_n_mgau(g) (g)->n_mgau
#define gauden_n_top(g) (g)->n_top
#define gauden_n_feat(g) (g)->n_feat
#define gauden_n_density(g) (g)->n_density
#define gauden_veclen(g) (g)->veclen

int
gauden_s2_set_mean(gauden_t *g,
		   uint32 mgau,
		   float32 **mean);
int
gauden_s2_set_var(gauden_t *g,
		  uint32 mgau,
		  float32 **var);

int
gauden_floor_variance(gauden_t *g);

int
gauden_compute(float64 **den,
	       uint32 **den_idx,
	       vector_t *obs,
	       gauden_t *g,
	       uint32 mgau,
	       uint32 **prev_den_idx);   /* Previous frame's top N densities (or NULL) */

int
gauden_compute_log(float64 **den,
		   uint32 **den_idx,
		   vector_t *obs,
		   gauden_t *g,
		   uint32 mgau,
		   uint32 **prev_den_idx);   /* Previous frame's top N densities (or NULL) */

float64 *
gauden_scale_densities_fwd(float64 ***den,
			   uint32 ***den_idx,
			   uint32 *cb,
			   uint32 n_cb,
			   gauden_t *g);

int
gauden_scale_densities_bwd(float64 ***den,
			   uint32 ***den_idx,
			   float64 **scale,
			   uint32 *cb,
			   uint32 n_cb,
			   gauden_t *g);

int
gauden_compute_euclidean(float64 ***den,
			 uint32 ***den_idx,
			 vector_t *obs,
			 gauden_t *g);

int
gauden_normalize(float64 ***den,
		 gauden_t *g);	/* normalize (n_mgau x n_feat x n_top) density values */

void
gauden_print(FILE *fp,
	     float64 ***den,
	     uint32 ***den_idx,
	     gauden_t *g,
	     uint32 *inv,
	     uint32 n_inv);

float64
gauden_mixture(float64 **den,
	       uint32 **den_idx,
	       float32 **w,
	       gauden_t *g);

void
gauden_free(gauden_t *g);

void
gauden_free_acc(gauden_t *g);

int32
gauden_alloc_acc(gauden_t *g);

void
gauden_free_l_acc(gauden_t *g);

int32
gauden_alloc_l_acc(gauden_t *g, uint32 n_lcl,
		   int32 mean_reest,
		   int32 var_reest,
		   int32 fullvar);

void
gauden_free_param(vector_t ***p);

void
gauden_free_param_full(vector_t ****p);

vector_t ***gauden_l_macc(gauden_t *g);

vector_t ***gauden_l_vacc(gauden_t *g);

float32 ***gauden_l_dnom(gauden_t *g);

void
gauden_accum_param(vector_t ***out,
		   vector_t ***in,
		   uint32 n_mgau,
		   uint32 n_feat,
		   uint32 n_density,
		   const uint32 *veclen);

void
gauden_accum_param_full(vector_t ****out,
			vector_t ****in,
			uint32 n_mgau,
			uint32 n_feat,
			uint32 n_density,
			const uint32 *veclen);

void
gauden_norm_wt_mean(vector_t ***in_mean,
		    vector_t ***wt_mean,
		    float32 ***dnom,
		    uint32 n_mgau,
		    uint32 n_feat,
		    uint32 n_density,
		    const uint32 *veclen);

void
gauden_norm_wt_var(vector_t ***in_var,
		   vector_t ***wt_var,
		   int32 pass2var,
		   float32 ***dnom,
		   vector_t ***mean,
		   uint32 n_mgau,
		   uint32 n_feat,
		   uint32 n_density,
		   const uint32 *veclen,
		   int32 tiedvar);

void
gauden_norm_wt_fullvar(vector_t ****in_var,
		       vector_t ****wt_var,
		       int32 pass2var,
		       float32 ***dnom,
		       vector_t ***mean,
		       uint32 n_mgau,
		       uint32 n_feat,
		       uint32 n_density,
		       const uint32 *veclen,
		       int32 tiedvar);
int
gauden_eval_precomp(gauden_t *g);

int
gauden_var_thresh_percentile(vector_t ***var,
			     float32 **var_thresh,
			     uint32 n_mgau,
			     uint32 n_stream,
			     uint32 n_density,
			     const uint32 *veclen,
			     float32 percent);

int
gauden_smooth_var(vector_t ***var,
		  float32 **var_thresh,
		  uint32 n_mgau,
		  uint32 n_stream,
		  uint32 n_density,
		  const uint32 *veclen);

/* primitives */
float32
diag_norm(vector_t var,
	  uint32 len);

void
diag_eval_precomp(vector_t var,
		  uint32 len);

float64
log_diag_eval(vector_t obs,
	      float32  norm,
	      vector_t mean,
	      vector_t var_fact, /* 1 / (2 * sigma ^ 2) */
	      uint32 veclen);	

float64
log_full_eval(vector_t obs,
	      float32  norm,
	      vector_t mean,
	      vector_t *var_inv, /* var^-1 */
	      uint32 veclen);	
	  
int
gauden_massage_var(vector_t ***var,
                  float32 fudge_factor,
                  uint32 n_mgau,
                  uint32 n_stream,
                  uint32 n_density,
                  const uint32 *veclen);

void
gauden_norm_wt_mmie_mean(vector_t ***in_mean,
			 vector_t ***wt_mean,
			 vector_t ***wt_num_mean,
			 vector_t ***wt_den_mean,
			 vector_t ***in_var,
			 vector_t ***wt_num_var,
			 vector_t ***wt_den_var,
			 float32 ***num_dnom,
			 float32 ***den_dnom,
			 uint32 n_mgau,
			 uint32 n_feat,
			 uint32 n_density,
			 const uint32 *veclen,
			 float32 constE);

void
gauden_norm_wt_mmie_var(vector_t ***in_var,
			vector_t ***wt_var,
			vector_t ***wt_num_var,
			vector_t ***wt_den_var,
			float32 ***num_dnom,
			float32 ***den_dnom,
			vector_t ***in_mean,
			vector_t ***wt_mean,
			vector_t ***wt_num_mean,
			vector_t ***wt_den_mean,
			uint32 n_mgau,
			uint32 n_feat,
			uint32 n_density,
			const uint32 *veclen,
			float32 constE);

float32
cal_constD(vector_t in_mean,
	   vector_t wt_num_mean,
	   vector_t wt_den_mean,
	   vector_t in_var,
	   vector_t wt_num_var,
	   vector_t wt_den_var,
	   float32 num_dnom,
	   float32 den_dnom,
	   uint32 n_veclen,
	   float32 constE);

uint32
solve_quadratic(float64 x, float64 y, float64 z, float64 *root1, float64 *root2);

#ifdef __cplusplus
}
#endif

#endif /* GAUDEN_H */