Skip to content

Commit 10068d1

Browse files
authored
Update matrices.md
1 parent 4779aaf commit 10068d1

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

notes/matrices.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ Handy conversions (for linearization / array-of-arrays):
3838
```
3939
Row-major (r, then c): Column-major (c, then r):
4040
→ → → → → → ↓ ↓ ↓
41-
↓ ↓ ↓
41+
↓ ↓ ↓
4242
← ← ← ← ← ← ↓ ↓ ↓
43-
↓ ↓ ↓
43+
↓ ↓ ↓
4444
→ → → → → → ↓ ↓ ↓
4545
```
4646

@@ -51,6 +51,7 @@ The offsets $(\Delta r,\Delta c)$ are applied as $(r+\Delta r,\ c+\Delta c)$.
5151
**4-neighborhood (“+”):**
5252

5353
```
54+
#
5455
(r-1,c)
5556
5657
(r,c-1) ← (r,c) → (r,c+1)
@@ -61,13 +62,13 @@ The offsets $(\Delta r,\Delta c)$ are applied as $(r+\Delta r,\ c+\Delta c)$.
6162
**8-neighborhood (“×” adds diagonals):**
6263

6364
```
64-
(r-1,c-1) (r-1,c) (r-1,c+1)
65-
\ ↑ /
66-
\ │ /
67-
(r,c-1) ←——— (r,c) ———→ (r,c+1)
68-
/ │ \
69-
/ ↓ \
70-
(r+1,c-1) (r+1,c) (r+1,c+1)
65+
(r-1,c-1) (r-1,c) (r-1,c+1)
66+
\ ↑ /
67+
\ │ /
68+
(r,c-1) ←——— (r,c) ———→ (r,c+1)
69+
/ │ \
70+
/ ↓ \
71+
(r+1,c-1) (r+1,c) (r+1,c+1)
7172
```
7273

7374
Typical direction arrays (keep them consistent to avoid bugs):

0 commit comments

Comments
 (0)