diff python/utils.py @ 284:f2cf16ad798f

added LCSS for trajectories
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 21 Dec 2012 18:33:36 -0500
parents abbd4bc13dac
children 5957aa1d69e1 8e66ced156dd
line wrap: on
line diff
--- a/python/utils.py	Fri Dec 21 18:20:12 2012 -0500
+++ b/python/utils.py	Fri Dec 21 18:33:36 2012 -0500
@@ -166,12 +166,12 @@
 #########################
 
 def LCSS(l1, l2, threshold, distance):
-    """returns the longest common subsequence similarity
-    based on the threshold on distance between two elements of lists l1, l2"""
-    from numpy import zeros
+    '''returns the longest common subsequence similarity
+    based on the threshold on distance between two elements of lists l1, l2'''
+    from numpy import zeros, int as npint
     m = len(l1)
     n = len(l2)
-    similarity = zeros((m+1,n+1))
+    similarity = zeros((m+1,n+1), dtype = npint)
     for i in xrange(1,m+1):
         for j in xrange(1,n+1):
             if distance(l1[i-1], l2[j-1])<threshold: