LIBML
Version 3.2.4
LIBML DSP Software Library
|
Macros | |
#define | E(MAT, R, C) (*(MAT + nCols * (R) + (C))) |
Mapping between query and template. More... | |
#define | F32_MAX ((f32_t)__FLT_MAX__) |
Functions | |
tpt_status | tpt_dtw_init_window_q7 (q7_t *pWindow, const tpt_dtw_window windowType, const int32_t windowSize, uint32_t nRows, uint32_t nCols) |
Window for dynamic time warping computation. More... | |
void | tpt_dtw_path_f32 (int16_t *Path, uint32_t *PathLength, const f32_t *pDTW, uint32_t nRows, uint32_t nCols) |
tpt_status | tpt_dtw_distance_f32 (f32_t *pDTW, f32_t *distance, const f32_t *pDistance, const q7_t *pWindow, uint32_t nRows, uint32_t nCols) |
#define | E(MAT, R, C) (*(MAT + nCols * (R) + (C))) |
Dynamic Time Warping distance. More... | |
#define | WIN(R, C) ((pWindow == NULL) ? 1 : ((*(pWindow + nCols * (R) + (C))) == 1)) |
#define | F32_MAX ((f32_t)__FLT_MAX__) |
Dynamic Time Warping Distance.
This is not really a distance since triangular inequality is not respected.
The step pattern used is symmetric2. Future versions of this function will provide more customization options.
Dynamic Time Warping distance.
[in] | pDistance | Distance matrix (Query rows * Template columns) |
[in] | pWindow | Windowing matrix (can be NULL if no windowing used) |
[out] | pDTW | Temporary cost buffer (same size) |
[out] | distance | Distance |
The windowing matrix is used to impose some constraints on the search for a path. The algorithm will run faster (smaller search path) but may not be able to find a solution.
The distance matrix must be initialized only where the windowing matrix is containing 1. Thus, use of a window also decreases the number of distances which must be computed.
Mapping between query and template.
[in] | pDTW | Cost matrix (Query rows * Template columns) |
[out] | pPath | Warping path in cost matrix 2*(nb rows + nb columns) |
[out] | pathLength | Length of path in number of points |
The warping path has length which is at most 2*(query length + template length) in float. 2 because it is a list of coordinates : (query index, template index) coordinate.
The buffer pPath must be big enough to contain the warping path.
pathLength is the number of points in the returned path. The resturned path may be smaller than query + template.
#define F32_MAX ((f32_t)__FLT_MAX__) |
#define F32_MAX ((f32_t)__FLT_MAX__) |
tpt_status tpt_dtw_distance_f32 | ( | f32_t * | pDTW, |
f32_t * | distance, | ||
const f32_t * | pDistance, | ||
const q7_t * | pWindow, | ||
uint32_t | nRows, | ||
uint32_t | nCols | ||
) |
tpt_status tpt_dtw_init_window_q7 | ( | q7_t * | pWindow, |
const tpt_dtw_window | windowType, | ||
const int32_t | windowSize, | ||
uint32_t | nRows, | ||
uint32_t | nCols | ||
) |
Window for dynamic time warping computation.
[in] | windowType | Type of window |
[in] | windowSize | Window size |
[in,out] | pWindow | Window |
The input matrix must already contain a buffer and the number of rows (query length) and columns (template length) must be initialized. The function will fill the matrix with 0 and 1.
void tpt_dtw_path_f32 | ( | int16_t * | Path, |
uint32_t * | PathLength, | ||
const f32_t * | pDTW, | ||
uint32_t | nRows, | ||
uint32_t | nCols | ||
) |