void vector_gautbl_maha_precomp (vector_gautbl_t *gautbl)
{
    int32 g;
    
    for (g = 0; g < gautbl->n_gau; g++)
	gautbl->lrd[g] = (float32) vector_maha_precomp (gautbl->var[g], gautbl->veclen);
}
Ejemplo n.º 2
0
/*
 * Precompute variances/(covariance-matrix-determinants) to simplify Mahalanobis distance
 * calculation (see libmain/gauden.*).  Also, calculate 1/(det) for the original codebooks,
 * based on the VQ vars.
 */
static void subvq_ivar_idet_precompute (subvq_t *vq, float64 floor)
{
    int32 s, r, c;
    float32 **idet;
    
    E_INFO("Precomputing 1/det(covar), 1/2*var\n");
    
    /* Temporary idet array for vars in subvq */
    idet = (float32 **) ckd_calloc_2d (vq->n_sv, vq->vqsize, sizeof(float32));
    
    for (s = 0; s < vq->n_sv; s++) {
	for (r = 0; r < vq->vqsize; r++) {
	    vector_nz_floor (vq->var[s][r], vq->svsize[s], floor);
	    
	    idet[s][r] = (float32) vector_maha_precomp (vq->var[s][r], vq->svsize[s]);
	}
    }
    vq->idet = idet;
}