-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #787 from explorable-viz/example-fluid
MatrixUpdate Created
- Loading branch information
Showing
12 changed files
with
127 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
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 | ||
[| let initV = if or (and (n == 1) (m == 1)) (and (abs n m <= window) (not (or (n == 1) (m == 1)))) | ||
then FNum 0 | ||
else Infty | ||
in initV | (n, m) in (rows, cols) |] | ||
in costMatrixInit 5 7 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let abs x y = if x - y < 0 then negate (x - y) else (x - y); | ||
initV n m window = if (or (and (n == 0) (m == 0)) (and ((abs n m) <= window) (not (or (n == 0) (m == 0))))) | ||
then FNum 0 | ||
else Infty | ||
in initV 1 0 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
let mat = [| (n, m) | (n,m) in (3, 3)|] | ||
in matrixUpdate mat (1,1) 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
let minAndPrev (i, j) im1 jm1 ijm1 = | ||
let minimal = minimum [im1,jm1,ijm1] | ||
in | ||
if minimal == im1 | ||
then (((i - 1), j), minimal) | ||
else if minimal == jm1 | ||
then ((i, (j - 1)), minimal) | ||
else | ||
(((i - 1), (j - 1)), ijm1) | ||
in minAndPrev (4,5) 3 4 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let nextIndices n m window = | ||
[(i, j) | i <- [1 .. n], | ||
j <- [(max 1 (i - window)) .. (min m (i + window))]] | ||
in | ||
nextIndices 5 7 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters