#include <stdio.h>
#include <s3types.h>
#include <logmath.h>
Go to the source code of this file.
Classes | |
| struct | arraysize_t |
| wrapper of array size More... | |
| struct | point_t |
| wrapper of a point in integer More... | |
| struct | fpoint_t |
| struct | vector_gautbl_t |
Typedefs | |
| typedef float32 * | vector_t |
Functions | |
| void | vector_floor (vector_t v, int32 dim, float64 f) |
| void | vector_nz_floor (vector_t v, int32 dim, float64 f) |
| int32 | vector_normalize (vector_t v, uint32 dim) |
| float64 | vector_sum_norm (vector_t v, int32 dim) |
| S3DECODER_EXPORT void | vector_print (FILE *fp, vector_t v, int32 dim) |
| S3DECODER_EXPORT int32 | vector_is_zero (float32 *vec, int32 len) |
| int32 | vector_is_nan (float32 *vec, int32 len) |
| int32 | vector_maxcomp_int32 (int32 *val, int32 len) |
| int32 | vector_mincomp_int32 (int32 *val, int32 len) |
| int32 | vector_maxcomp_float32 (float32 *val, int32 len) |
| int32 | vector_mincomp_float32 (float32 *val, int32 len) |
| void | vector_accum (float32 *dst, float32 *src, int32 len) |
| int32 | vector_cmp (float32 *v1, float32 *v2, int32 len) |
| int32 | vector_mean (float32 *mean, float32 **data, int32 n_vec, int32 n_dim) |
| float64 | vector_dist_eucl (float32 *v1, float32 *v2, int32 len) |
| float64 | vector_maha_precomp (float32 *var, int32 len) |
| float64 | vector_dist_maha (float32 *vec, float32 *mean, float32 *varinv, float64 norm, int32 len) |
| S3DECODER_EXPORT float64 | vector_vqgen (float32 **data, int32 rows, int32 cols, int32 vqrows, float64 epsilon, int32 maxiter, float32 **mean, int32 *map, int32 seed) |
| int32 | vector_vqlabel (float32 *vec, float32 **mean, int32 rows, int32 cols, float64 *sqerr) |
| float64 | vector_pdf_entropy (float32 *p, int32 len) |
| float64 | vector_pdf_cross_entropy (float32 *p1, float32 *p2, int32 len) |
| void | vector_gautbl_alloc (vector_gautbl_t *gautbl, int32 n_gau, int32 veclen, logmath_t *logmath) |
| void | vector_gautbl_free (vector_gautbl_t *gautbl) |
| void | vector_gautbl_var_floor (vector_gautbl_t *gautbl, float64 floor) |
| void | vector_gautbl_maha_precomp (vector_gautbl_t *gau) |
| void | vector_gautbl_eval_logs3 (vector_gautbl_t *gau, int32 offset, int32 count, float32 *x, int32 *scr, logmath_t *logmath) |
|
|
|
|
||||||||||||||||
|
Accumulate src into dst
|
|
||||||||||||||||
|
Compare the two given vectors.
|
|
||||||||||||||||
|
Return the Euclidean distance (actually, distance^2) between the two given vectors.
|
|
||||||||||||||||||||||||
|
Mahalanobis distance, using some precomputed portions of variance and determinant. (Actually not "distance" at all, but Gaussian density value.) Computed in log domain. Return value: logbase-e(likelihood value).
|
|
||||||||||||||||
|
Floor all elements of v[0..dim-1] to min value of f
|
|
||||||||||||||||||||
|
The obvious allocation and free routines for vector_gautbl_t.{mean,var,lrd}. Also sets gautbl->{n_mgau, veclen, distfloor}; the last to the equivalent of S3_LOGPROB_ZERO. |
|
||||||||||||||||||||||||||||
|
Compare the input vector to the given range of subvector codewords in the given codebook, Enter the computed Mahalanobis distances, converted into logs3 values, into the given score array. (Why bother with the {offset,count} range?? For "blocking" such computation so that cache behaviour is improved.)
|
|
|
|
|
|
Carry out the vector_maha_precomp, above, over all the Gaussians in the given table, updating gau->lrd[] as a result. The needed memory must have been already allocated by the caller. |
|
||||||||||||
|
Floor all the variance values in the given Gaussians table.
|
|
||||||||||||
|
Return TRUE iff one of the component of the vector is nan
|
|
||||||||||||
|
Return TRUE iff given vector is all 0.0
|
|
||||||||||||
|
Given a Gaussian density with mean vector m and diagonal variance vector v, and some input vector x, all of length n, the Mahalanobis distance of x from the Gaussian mean m is given by: {1/sqrt((2pi)^n * det(v))} * exp{-Sum((x[i] - m[i])^2 / (2v[i]))} To speed up this evaluation, the first sub-expression ({1/sqrt...}) can be precomputed at initialization, and so can 1/2v[i] in the second sub-expression. Secondly, recognition systems work with log-likelihood values, so these distances or likelihood values are computed in log-domain. Carry out the above precomputations on the given variance vector; update var with 1/2var IN PLACE, and return the value of the first sub-expression as a log value. (The variance values are assumed to be strictly > 0.0.
|
|
||||||||||||
|
|
|
||||||||||||
|
Search for the max or min valued component in the given vector. The vector length must be strictly > 0 (val[] must have at least one valid value). If more than one component qualifies, the first one is chosen. Return value: the INDEX of the selected val[] component (not the value itself). |
|
||||||||||||||||||||
|
Compute the mean vector from the given set of vector data.
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
Normalize the vector.
|
|
||||||||||||||||
|
Floor all non-0 elements of v[0..dim-1] to min value of f |
|
||||||||||||||||
|
Return cross-entropy of two PDFs; like vector_entropy, but (-sum(p1 * log2(p2))). (The PDF values must be >= 0.0, of course.) The zero elements of p2 are skipped.
|
|
||||||||||||
|
Treat the given vector as a PDF and compute its entropy (-sum(p * log2(p))). (The PDF values must be >= 0.0, of course.) The zero elements of the PDF are skipped.
|
|
||||||||||||||||
|
Print vector in one line, in 11.4e format, terminated by newline |
|
||||||||||||
|
Normalize the elements of the given vector so that they sum to 1.0. If the sum is 0.0 to begin with, the vector is left untouched. @ The normalization factor. |
|
||||||||||||||||||||||||||||||||||||||||
|
Generate a vector quantized table for the input data, using the K-means algorithm, and the Euclidean distance measure. Return value: The squared quantization error of the final result.
|
|
||||||||||||||||||||||||
|
Find the entry (row) of mean that is closest (according to Euclidean distance) to vec. Return value: index of the selected row.
|
1.3.9.1