1mlib_SignalDTWScalar_S16(3MmLeIdBi)aLib Library Functmiloinbs_SignalDTWScalar_S16(3MLIB)
2
3
4

NAME

6       mlib_SignalDTWScalar_S16 - perform dynamic time warping on scalar data
7

SYNOPSIS

9       cc [ flag... ] file... -lmlib [ library... ]
10       #include <mlib.h>
11
12       mlib_status mlib_SignalDTWScalar_S16(mlib_d64 *dist,
13            const mlib_s16 *dobs, mlib_s32 lobs, mlib_s32 sobs,
14            void *state);
15
16

DESCRIPTION

18       The  mlib_SignalDTWScalar_S16()  function performs dynamic time warping
19       on scalar data.
20
21
22       Assume the reference data are
23
24             r(y), y=1,2,...,N
25
26
27
28       and the observed data are
29
30             o(x), x=1,2,...,M
31
32
33
34       the dynamic time warping is to find a mapping function (a path)
35
36             p(i) = {px(i),py(i)}, i=1,2,...,Q
37
38
39
40       with the minimum distance.
41
42
43       In K-best paths  case,  K  paths  with  the  K  minimum  distances  are
44       searched.
45
46
47       The distance of a path is defined as
48
49                     Q
50             dist = SUM d(r(py(i)),o(px(i))) * m(px(i),py(i))
51                    i=1
52
53
54
55       where  d(r,o) is the dissimilarity between data point/vector r and data
56       point/vector o; m(x,y) is the  path  weighting  coefficient  associated
57       with  path point (x,y); N is the length of the reference data; M is the
58       length of the observed data; Q is the length of the path.
59
60
61       Using L1 norm (sum of absolute differences)
62
63                      L-1
64             d(r,o) = SUM |r(i) - o(i)|
65                      i=0
66
67
68
69       Using L2 norm (Euclidean distance)
70
71                             L-1
72             d(r,o) = SQRT { SUM (r(i) - o(i))**2 }
73                             i=0
74
75
76
77       where L is the length of each data vector.
78
79
80       To scalar data where L=1, the two norms are the same.
81
82             d(r,o) = |r - o| = SQRT {(r - o)**2 }
83
84
85
86       The constraints of dynamic time warping are:
87
88           1.     Endpoint constraints
89
90                        px(1) = 1
91                        1 ≤ py(1) ≤ 1 + delta
92
93                  and
94
95                        px(Q) = M
96                        N-delta ≤ py(Q) ≤ N
97
98
99           2.     Monotonicity Conditions
100
101                        px(i) ≤ px(i+1)
102                        py(i) ≤ py(i+1)
103
104
105           3.     Local Continuity Constraints
106
107                  See Table 4.5 on page 211 in Rabiner and Juang's book.
108
109                  Itakura Type:
110
111                        py
112                        |
113                        *----*----*
114                        |p4  |p1  |p0
115                        |    |    |
116                        *----*----*
117                        |    |p2  |
118                        |    |    |
119                        *----*----*-- px
120                              p3
121
122                  Allowable paths are
123
124                        p1->p0    (1,0)
125                        p2->p0    (1,1)
126                        p3->p0    (1,2)
127
128                  Consecutive (1,0)(1,0) is disallowed. So path p4->p1->p0  is
129                  disallowed.
130
131           4.     Global Path Constraints
132
133                  Due to local continuity constraints, certain portions of the
134                  (px,py) plane are excluded from the region the optimal warp‐
135                  ing path can traverse. This forms global path constraints.
136
137           5.     Slope Weighting
138
139                  See  Equation  4.150-3  on  page  216 in Rabiner and Juang's
140                  book.
141
142
143       A path in (px,py) plane can be represented in chain code. The value  of
144       the chain code is defined as following.
145
146             ============================
147             shift ( x , y ) | chain code
148             ----------------------------
149                 ( 1 , 0 )   |     0
150                 ( 0 , 1 )   |     1
151                 ( 1 , 1 )   |     2
152                 ( 2 , 1 )   |     3
153                 ( 1 , 2 )   |     4
154                 ( 3 , 1 )   |     5
155                 ( 3 , 2 )   |     6
156                 ( 1 , 3 )   |     7
157                 ( 2 , 3 )   |     8
158             ============================
159
160                 py
161                 |
162                 *  8  7  *
163                 |
164                 *  4  *  6
165                 |
166                 1  2  3  5
167                 |
168                 x--0--*--*-- px
169
170
171
172       where  x  marks  the start point of a path segment, the numbers are the
173       values of the chain code for the segment that ends at the point.
174
175
176       In following example, the observed data with 11 data points are  mapped
177       into the reference data with 9 data points
178
179                 py
180                 |
181              9  | * * * * * * * * * *-*
182                 |                  /
183                 | * * * * * * * *-* * *
184                 |              /
185                 | * * * * * * * * * * *
186                 |            /
187                 | * * * * *-* * * * * *
188                 |        /
189                 | * * * * * * * * * * *
190                 |       |
191                 | * * * * * * * * * * *
192                 |      /
193                 | * * * * * * * * * * *
194                 |    /
195                 | * * * * * * * * * * *
196                 |  /
197              1  | * * * * * * * * * * *
198                 |
199                 +------------------------ px
200                   1                   11
201
202
203
204       The chain code that represents the path is
205
206             (2 2 2 1 2 0 2 2 0 2 0)
207
208
209
210       See  Fundamentals  of Speech Recognition by Lawrence Rabiner and Biing-
211       Hwang Juang, Prentice Hall, 1993.
212

PARAMETERS

214       The function takes the following arguments:
215
216       dist     The distance of the optimal path.
217
218
219       dobs     The observed data array.
220
221
222       lobs     The length of the observed data array.
223
224
225       sobs     The  scaling  factor  of  the  observed  data   array,   where
226                actual_data = input_data * 2**(-scaling_factor).
227
228
229       state    Pointer to the internal state structure.
230
231

RETURN VALUES

233       The  function  returns MLIB_SUCCESS if successful. Otherwise it returns
234       MLIB_FAILURE.
235

ATTRIBUTES

237       See attributes(5) for descriptions of the following attributes:
238
239
240
241
242       ┌─────────────────────────────┬─────────────────────────────┐
243       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
244       ├─────────────────────────────┼─────────────────────────────┤
245       │Interface Stability          │Committed                    │
246       ├─────────────────────────────┼─────────────────────────────┤
247       │MT-Level                     │MT-Safe                      │
248       └─────────────────────────────┴─────────────────────────────┘
249

SEE ALSO

251       mlib_SignalDTWScalarInit_S16(3MLIB),   mlib_SignalDTWScalar_S16(3MLIB),
252       mlib_SignalDTWScalarPath_S16(3MLIB),              mlib_SignalDTWScalar‐
253       Free_S16(3MLIB), attributes(5)
254
255
256
257SunOS 5.11                        23 May 2007  mlib_SignalDTWScalar_S16(3MLIB)
Impressum