dtw 1.0.0.0 → 1.0.1.0
raw patch · 2 files changed
+9/−8 lines, 2 filesdep −MemoTriedep ~vectorPVP ok
version bump matches the API change (PVP)
Dependencies removed: MemoTrie
Dependency ranges changed: vector
API changes (from Hackage documentation)
Files
- dtw.cabal +4/−6
- src/Data/DTW.hs +5/−2
dtw.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dtw-version: 1.0.0.0+version: 1.0.1.0 synopsis: (Fast) Dynamic Time Warping description: This package implements dynamic time warping as described here <http://en.wikipedia.org/w/index.php?title=Dynamic_time_warping>@@ -23,10 +23,9 @@ library build-depends: base >= 4.6 && < 4.9,- vector >= 0.10 && < 0.11,+ vector >= 0.10 && < 0.12, vector-space >= 0.10 && < 0.11,- containers >= 0.5 && < 0.6,- MemoTrie >= 0.6 && < 0.7+ containers >= 0.5 && < 0.6 exposed-modules: Data.DTW ghc-options: -Wall hs-source-dirs: src@@ -43,8 +42,7 @@ containers, test-framework, test-framework-quickcheck2,- QuickCheck <2.8,- MemoTrie+ QuickCheck <2.8 ghc-options: -O2 -Wall hs-source-dirs: src default-language: Haskell2010
src/Data/DTW.hs view
@@ -48,7 +48,6 @@ import qualified Data.Vector.Unboxed as UV import qualified Data.Vector.Storable as SV -import Data.MemoTrie import Data.Function @@ -132,7 +131,7 @@ dtwMemoWindowed δ inWindow as bs = go (len as - 1) (len bs - 1) where -- wrap go' in a memoziation function so that each value -- is calculated only once- go = memo2 go'+ go = vecMemo2 (len as) (len bs) go' -- handle special cases, origin cost is zero, -- border cost is infinity go' 0 0 = Result 0 [(0,0)]@@ -150,6 +149,10 @@ newCost = δ (ix as x) (ix bs y) + cost minResult {-# INLINABLE dtwMemoWindowed #-}++vecMemo2 :: Int -> Int -> (Int -> Int -> a) -> Int -> Int -> a+vecMemo2 w h f = \x y -> v V.! (x + y*w)+ where v = V.generate (w*h) (\i -> let (y,x) = i `divMod` w in f x y) -------------------------------------------------------------------------------------