@explorable-viz/fluid 0.7.94 → 0.7.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
1
  let zero m n image =
2
2
  let (m_max, n_max) = dims image
3
- in if (m >= 1) `and` (m <= m_max) `and` (n >= 1) `and` (n <= n_max)
3
+ in if (m >= 1) `and` (m <= m_max) `and` (n >= 1) `and` (n <= n_max)
4
4
  then image!(m, n)
5
5
  else 0;
6
6
 
7
- let wrap m n image =
7
+ let wrap m n image =
8
8
  let (m_max, n_max) = dims image
9
9
  in image!( ((m - 1) `mod` m_max) + 1, ((n - 1) `mod` n_max) + 1);
10
10
 
11
- let extend m n image =
11
+ let extend m n image =
12
12
  let (m_max, n_max) = dims image;
13
13
  m' = min (max m 1) m_max;
14
14
  n' = min (max n 1) n_max
@@ -22,20 +22,18 @@ let convolve image kernel lookup =
22
22
  let ((m, n), (i, j)) = (dims image, dims kernel);
23
23
  (half_i, half_j) = (i `quot` 2, j `quot` 2);
24
24
  area = i * j
25
- in [| let interMatrix = """Intermediate matrix for element (${m'}, ${n'})"""
26
- [|
27
- let x = m' + i' - 1 - half_i;
28
- y = n' + j' - 1 - half_j in
29
- """Multiply these two elements"""
30
- lookup x y image * kernel!(i', j')
31
- | (i', j') in (i, j) |]
32
- in matrixSum interMatrix `quot` area
33
- | (m', n') in (m, n) |];
25
+ in [| let interMatrix =
26
+ """Intermediate matrix for element (${m'}, ${n'})"""
27
+ [| let x = m' + i' - 1 - half_i;
28
+ y = n' + j' - 1 - half_j in
29
+ lookup x y image * kernel!(i', j')
30
+ | (i', j') in (i, j) |]
31
+ in matrixSum interMatrix `quot` area
32
+ | (m', n') in (m, n) |];
34
33
 
35
- let matMul a b =
36
- let ((m, n), (i, j)) = (dims a, dims b) in
34
+ let matMul a b =
35
+ let ((m, n), (i, j)) = (dims a, dims b) in
37
36
  if not (n == i)
38
- then error "Dimensions don't line up"
39
- else """Intermediate matrix"""
40
- [| sum [ a!(i', k) * b!(k, j') | k <- enumFromTo 1 n]
41
- | (i', j') in (m, j) |];
37
+ then error "Dimension mismatch"
38
+ else [| sum [ a!(i', k) * b!(k, j') | k <- enumFromTo 1 n]
39
+ | (i', j') in (m, j) |];