Edinburgh Speech Tools
2.4-release
Edinburgh Speech Tools
Introduction to the Edinburgh Speech Tools
Licence, Installation and acknowledgements
Executable Programs
Basic Classes
Speech Classes
Linguistic Classes
Utility Functions
Signal Processing
Client-Server Mechanisms
Grammar
Classification and Regression Trees
The Tilt Intonation Model
XML support
align
ch_lab
ch_utt
design_filter
sig2fv
wagon_test
wfst_run
Bibliographic References
Classes
Files
File List
audio
base_class
doc
grammar
include
instantiate
ling_class
rxp
sigpr
unix
win32
EST.h
EST_audio.h
EST_bool.h
EST_ChannelType.h
EST_Chunk.h
EST_cluster.h
EST_cmd_line.h
EST_cmd_line_options.h
EST_common.h
EST_Complex.h
EST_Contents.h
EST_cutils.h
EST_DMatrix.h
EST_dynamic_model.h
EST_error.h
EST_Event.h
EST_Featured.h
EST_FeatureData.h
EST_Features.h
EST_features_aux.h
EST_FileType.h
EST_FMatrix.h
EST_FringeServer.h
EST_grammar.h
EST_Handleable.h
EST_HMM.h
EST_IMatrix.h
EST_inline_utils.h
EST_io_aux.h
EST_iostream.h
EST_kalman.h
EST_lattice.h
EST_lattice_io.h
EST_ling_class.h
EST_math.h
EST_model_types.h
EST_multistats.h
EST_Ngrammar.h
EST_Option.h
EST_Pathname.h
EST_PST.h
EST_Regex.h
EST_rw_status.h
EST_SCFG.h
EST_SCFG_Chart.h
EST_Server.h
EST_ServiceTable.h
EST_sigpr.h
EST_simplestats.h
EST_SingleChannelWave.h
EST_SMatrix.h
EST_socket.h
EST_sort.h
EST_speech_class.h
EST_stats.h
EST_strcasecmp.h
EST_String.h
EST_string_aux.h
EST_StringTrie.h
EST_system.h
EST_TBox.h
EST_TBuffer.h
EST_TDeque.h
EST_THandle.h
EST_THash.h
EST_tilt.h
EST_TIterator.h
EST_TKVL.h
EST_TList.h
EST_TMatrix.h
EST_TNamedEnum.h
EST_Token.h
EST_Track.h
EST_track_aux.h
EST_TrackMap.h
EST_TSimpleMatrix.h
EST_TSimpleVector.h
EST_TSortable.h
EST_TTimeIndex.h
EST_TVector.h
EST_types.h
EST_UList.h
EST_unix.h
EST_util_class.h
EST_Val.h
EST_Val_defs.h
EST_viterbi.h
EST_Wagon.h
EST_walloc.h
EST_Wave.h
EST_wave_aux.h
EST_WFST.h
siod.h
siod_defs.h
siod_est.h
intonation
ling_class
main
rxp
sigpr
siod
speech_class
stats
testsuite
utils
•
All
Classes
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Pages
EST_math.h
1
/*************************************************************************/
2
/* */
3
/* Centre for Speech Technology Research */
4
/* University of Edinburgh, UK */
5
/* Copyright (c) 1994,1995,1996 */
6
/* All Rights Reserved. */
7
/* */
8
/* Permission is hereby granted, free of charge, to use and distribute */
9
/* this software and its documentation without restriction, including */
10
/* without limitation the rights to use, copy, modify, merge, publish, */
11
/* distribute, sublicense, and/or sell copies of this work, and to */
12
/* permit persons to whom this work is furnished to do so, subject to */
13
/* the following conditions: */
14
/* 1. The code must retain the above copyright notice, this list of */
15
/* conditions and the following disclaimer. */
16
/* 2. Any modifications must be clearly marked as such. */
17
/* 3. Original authors' names are not deleted. */
18
/* 4. The authors' names are not used to endorse or promote products */
19
/* derived from this software without specific prior written */
20
/* permission. */
21
/* */
22
/* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23
/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24
/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25
/* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26
/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27
/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28
/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29
/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30
/* THIS SOFTWARE. */
31
/* */
32
/*************************************************************************/
33
/* Author : Alan W Black */
34
/* Date : August 1996 */
35
/*-----------------------------------------------------------------------*/
36
/* OS system dependent math routines */
37
/* You may use this instead of math.h to get a system independent */
38
/* interface to the math functions (or include in addition, it's up to */
39
/* you) */
40
/*=======================================================================*/
41
#ifndef __EST_MATH_H__
42
#define __EST_MATH_H__
43
44
#if defined(__APPLE__)
45
/* Not sure why I need this here, but I do */
46
extern
"C"
int
isnan(
double
);
47
#endif
48
49
/* this isn't included from c, but just to be safe... */
50
#ifdef __cplusplus
51
#include <cmath>
52
#include <climits>
53
#include <cfloat>
54
#else
55
#include <math.h>
56
#include <limits.h>
57
#include <float.h>
58
#endif
59
60
using namespace
std;
61
62
#ifdef __cplusplus
63
extern
"C"
{
64
#endif
65
66
/* Although isnan(double) exists on all machine isnanf(float) does not */
67
/* Automatic conversion between floats to doubles for out of range */
68
/* values in ANSI is undefined so we can't depend on that, but I */
69
70
/* Solaris 2.X and SGIs IRIX*/
71
#if defined(__svr4__) || defined(__SYSTYPE_SVR4__)
72
#include <ieeefp.h>
73
#endif
74
75
/* SunOS 4.1.X */
76
/* It doesn't exist on SunOS. One could use the macro that Solaris uses */
77
/* but I can't including it here, besides the follow will almost definitely */
78
/* have the same effect */
79
/* The defines are of course heuristics, this fails for NetBSD */
80
#if defined(__sun__) && defined(__sparc__) && !defined(__svr4__)
81
#define isnanf(X) isnan(X)
82
#endif
83
84
/* Linux (and presumably Hurd too as Linux is GNU libc based) */
85
/* Sorry I haven't confirmed this cpp symbol yet */
86
#if defined(linux)
87
#define isnanf(X) __isnanf(X)
88
#endif
89
90
/* OS/2 with gcc EMX */
91
#if defined(__EMX__)
92
#define isnanf(X) isnan(X)
93
#define finite(X) isfinite(X)
94
#endif
95
96
/* AIX */
97
#if defined(_AIX)
98
#define isnanf(X) isnan(X)
99
#endif
100
101
/* Apple OSX */
102
#if defined(__APPLE__)
103
#define isnanf(X) isnan((double)(X))
104
/* on some previous versions of OSX we seemed to need the following */
105
/* but not on 10.4 */
106
/* #define isnan(X) __isnan(X) */
107
#endif
108
109
/* FreeBSD *and other 4.4 based systems require anything, isnanf is defined */
110
#if defined(__FreeBSD__)
111
112
#endif
113
114
/* Cygwin (at least cygwin 1.7 with gcc 4.3.4) */
115
#if defined(__CYGWIN__)
116
#if __GNUG__ > 3
117
#define isnanf(X) isnan(X)
118
#endif
119
#endif
120
121
/* WIN32 has stupid names for things */
122
#if defined(SYSTEM_IS_WIN32)
123
#define isfinite(X) _finite(X)
124
#define finite(X) _finite(X)
125
#define round(X) win32_round(X)
126
inline
double
win32_round(
double
d) {
return
(d>0.0)?floor(d+0.5):ceil(d-0.5);}
127
#endif
128
129
/* These are making assumptions about the under lying architecture */
130
/* that could be wrong (though most probably in a conservative way) */
131
#ifndef MAXFLOAT
132
#define MAXFLOAT ((float)3.0e+37)
133
#endif
134
#ifndef FLT_MAX
135
#define FLT_MAX ((float)3.0e+37)
136
#endif
137
#ifndef MINFLOAT
138
#define MINFLOAT ((float)1e-37)
139
#endif
140
#ifndef FLT_MAX
141
#define FLT_MIN ((float)1e-37)
142
#endif
143
144
#ifndef PI
145
#define PI 3.14159265358979323846
146
#endif
147
#ifndef M_PI
148
#define M_PI PI
149
#endif
150
151
#ifndef RAND_MAX
152
#define RAND_MAX 32767
153
#endif
154
155
#define SAFE_LOG_ZERO -9538
156
157
#define EST_NINT(X) ((int)((X)+0.5))
158
159
inline
double
safe_log(
const
double
x)
160
{
161
double
l;
162
if
(x == 0)
163
return
SAFE_LOG_ZERO;
164
l=log(x);
165
if
(l<SAFE_LOG_ZERO)
166
return
SAFE_LOG_ZERO;
167
else
168
return
l;
169
}
170
171
inline
double
safe_exp(
const
double
x)
172
{
173
if
(x<=SAFE_LOG_ZERO)
174
return
0;
175
else
176
return
exp(x);
177
}
178
179
inline
double
safe_log10(
const
double
x)
180
{
181
double
l;
182
if
(x == 0)
183
return
SAFE_LOG_ZERO;
184
l=log10(x);
185
if
(l<SAFE_LOG_ZERO)
186
return
SAFE_LOG_ZERO;
187
else
188
return
l;
189
}
190
191
inline
double
safe_exp10(
const
double
x)
192
{
193
if
(x<=SAFE_LOG_ZERO)
194
return
0;
195
else
196
return
pow(10.0,x);
197
}
198
199
200
#ifdef __cplusplus
201
}
202
#endif
203
204
205
#endif
/*__EST_CUTILS_H__ */
include
EST_math.h
Generated on Wed Dec 24 2014 09:16:35 for Edinburgh Speech Tools by
1.8.3.1