Skip to content
Snippets Groups Projects
Commit d09ae963 authored by Martin Rusek's avatar Martin Rusek
Browse files

other: minor stuff

parent f8c64fb0
Branches
No related tags found
No related merge requests found
......@@ -377,6 +377,24 @@ void dtw::accumulate(vtr2<node<T>> &m, parameter const &params)
}
}
template<class T>
void dtw::accumulate(vtr2<node<T>> &m, vtr parameter const &params)
{
int lenA = (int)m.size();
int lenB = (int)m[0].size();
const int w = (int)(lenB * params.w);
for (int i = 1; i < lenA; i++) //row = y
{
const size_t start = max(1, (int)(ceil((i - 1) * (lenB / (double)lenA + 0.0000000001)) - w));
const size_t end = min(lenB, (int)(ceil(i * lenB / (double)lenA)) + w);
for (size_t j = start; j < end; j++) //col = x
{
m[i][j].value += std::min({ m[i - 1][j - 1].value, m[i - 1][j].value, m[i][j - 1].value });
}
}
}
template<class T>
vtr<coords> dtw::get_minimums(vtr2<node<T>> const &m, parameter const &params)
{
......
......@@ -30,6 +30,9 @@ public:
template<class T>
static void accumulate(vtr2<node<T>> &m, parameter const &params);
template<class T>
static void accumulate_mod(vtr2<node<T>> &m, parameter const &params);
template<class T>
static result_path get_warping(vtr2<node<T>> const &m, coords coord, parameter const &params);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment