PocketSphinx
0.6
|
00001 /* ==================================================================== 00002 * Copyright (c) 1999-2004 Carnegie Mellon University. All rights 00003 * reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 00012 * 2. Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in 00014 * the documentation and/or other materials provided with the 00015 * distribution. 00016 * 00017 * This work was supported in part by funding from the Defense Advanced 00018 * Research Projects Agency and the National Science Foundation of the 00019 * United States of America, and the CMU Sphinx Speech Consortium. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 00022 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00023 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00024 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 00025 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 * 00033 * ==================================================================== 00034 * 00035 */ 00036 00037 /* 00038 * vector.h -- vector routines. 00039 * 00040 * ********************************************** 00041 * CMU ARPA Speech Project 00042 * 00043 * Copyright (c) 1997 Carnegie Mellon University. 00044 * ALL RIGHTS RESERVED. 00045 * ********************************************** 00046 */ 00047 00048 00049 #ifndef __VECTOR_H__ 00050 #define __VECTOR_H__ 00051 00052 /* System headers. */ 00053 #include <stdio.h> 00054 00055 /* SphinxBase headers. */ 00056 #include <sphinxbase/prim_type.h> 00057 00058 typedef float32 *vector_t; 00059 00060 /* 00061 * The reason for some of the "trivial" routines below is that they could be OPTIMIZED for SPEED 00062 * at some point. 00063 */ 00064 00065 00066 /* Floor all elements of v[0..dim-1] to min value of f */ 00067 void vector_floor(vector_t v, int32 dim, float64 f); 00068 00069 00070 /* Floor all non-0 elements of v[0..dim-1] to min value of f */ 00071 void vector_nz_floor(vector_t v, int32 dim, float64 f); 00072 00073 00074 /* 00075 * Normalize the elements of the given vector so that they sum to 1.0. If the sum is 0.0 00076 * to begin with, the vector is left untouched. Return value: The normalization factor. 00077 */ 00078 float64 vector_sum_norm(vector_t v, int32 dim); 00079 00080 00081 /* Print vector in one line, in %11.4e format, terminated by newline */ 00082 void vector_print(FILE *fp, vector_t v, int32 dim); 00083 00084 00085 /* Return TRUE iff given vector is all 0.0 */ 00086 int32 vector_is_zero (float32 *vec, /* In: Vector to be checked */ 00087 int32 len); /* In: Length of above vector */ 00088 00089 #endif /* VECTOR_H */ 00090 00091 00092 /* 00093 * Log record. Maintained by RCS. 00094 * 00095 * Revision 1.1.1.1 2004/03/29 20:29:40 rkm 00096 * 00097 * 00098 * Revision 1.1.1.1 2004/03/05 16:55:44 rkm 00099 * 00100 * 00101 * Revision 1.1.1.1 2000/02/28 18:05:54 rkm 00102 * Imported Sources 00103 * 00104 * Revision 1.1.1.1 1999/11/23 20:24:18 rkm 00105 * imported sources 00106 * 00107 * Revision 1.2 1995/10/09 20:55:35 eht 00108 * Changes for prim_type.h 00109 * 00110 * Revision 1.1 1995/08/15 13:44:14 eht 00111 * Initial revision 00112 * 00113 * 00114 */