Skip to content

Commit

Permalink
costMatrixInit in fluid in working yet flawed state. Fails to pass te…
Browse files Browse the repository at this point in the history
…stParse?
  • Loading branch information
JosephBond committed Oct 2, 2023
1 parent 82b5516 commit b367935
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
11 changes: 5 additions & 6 deletions example/Util/DTW.purs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module Example.Util.DTW
( NumInf(..)
, costMatrixInit
, distEuclid
, distanceDTWWindow
)
where
( NumInf(..)
, costMatrixInit
, distEuclid
, distanceDTWWindow
) where

import Prelude

Expand Down
3 changes: 2 additions & 1 deletion fluid/example/dtw/cost-matrix.fld
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
let abs x y = if x - y < 0 then negate (x - y) else (x - y);

costMatrixInit rows cols window =
let ns = [0 .. rows];
ms = [0 .. cols]
in
[| (n,m) | (n, m) in (ns, ms) |]
[| let initV = if ((abs n m )<= window) then FNum (abs n m) else Infty in initV | (n, m) in (rows, cols) |]
in costMatrixInit 3 4 1

3 changes: 2 additions & 1 deletion test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ tests :: Array (String × Aff Unit)
-- , test_linking
-- ]
tests = test_scratchpad

test_scratchpad :: Array (String × Aff Unit)
test_scratchpad = second void <$> many [ { file: "dtw/cost-matrix", fwd_expect: "forced fail" }] 1
test_scratchpad = second void <$> many [ { file: "dtw/cost-matrix", fwd_expect: "forced fail" } ] 1

test_desugaring :: Array (String × Aff Unit)
test_desugaring = second void <$> many desugar_cases 1
Expand Down
2 changes: 1 addition & 1 deletion test/Spec/Specs.purs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ misc_cases =
, { file: "range", fwd_expect: "((0, 0) : ((0, 1) : ((1, 0) : ((1, 1) : []))))" }
, { file: "records", fwd_expect: "{a : 2, b : 6, c : 7, d : (5 : []), e : 7}" }
, { file: "reverse", fwd_expect: "(2 : (1 : []))" }
, { file: "dtw/next-indices", fwd_expect: "((1, 1) : ((1, 2) : ((1, 3) : ((2, 1) : ((2, 2) : ((2, 3) : ((2, 4) : ((3, 1) : ((3, 2) : ((3, 3) : ((3, 4) : ((3, 5) : ((4, 2) : ((4, 3) : ((4, 4) : ((4, 5) : ((4, 6) : ((5, 3) : ((5, 4) : ((5, 5) : ((5, 6) : ((5, 7) : []))))))))))))))))))))))"}
, { file: "dtw/next-indices", fwd_expect: "((1, 1) : ((1, 2) : ((1, 3) : ((2, 1) : ((2, 2) : ((2, 3) : ((2, 4) : ((3, 1) : ((3, 2) : ((3, 3) : ((3, 4) : ((3, 5) : ((4, 2) : ((4, 3) : ((4, 4) : ((4, 5) : ((4, 6) : ((5, 3) : ((5, 4) : ((5, 5) : ((5, 6) : ((5, 7) : []))))))))))))))))))))))" }
, { file: "dtw/cost-matrix", fwd_expect: "forced fail" }
]

Expand Down

0 comments on commit b367935

Please sign in to comment.