diff --git a/SequenceComparison/dtw.cpp b/SequenceComparison/dtw.cpp
index 4db4b0fae3ab48a34dcb3fe3885525d0151b862c..6567d43e6efc727e837cc6886fc6180832ea7c0f 100644
--- a/SequenceComparison/dtw.cpp
+++ b/SequenceComparison/dtw.cpp
@@ -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)
 {
diff --git a/SequenceComparison/dtw.h b/SequenceComparison/dtw.h
index fe41622513c807f2954cb8cbfbe5fe729713cf1a..4ad07c24ecdea14577e953296ef4fa0d487c8863 100644
--- a/SequenceComparison/dtw.h
+++ b/SequenceComparison/dtw.h
@@ -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);