Add matrix module: addition, multiplication, transpose, spiral and rotation programs, dry-run traces, operation counts, seeded law checks, six pitfalls (10 tests)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4pD5LRLNWAecBNsj9
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
26ece9cc9b
commit
35ef0872de
@@ -0,0 +1,27 @@
|
||||
Operation counts (counted, not timed)
|
||||
=====================================
|
||||
|
||||
multiplications for an n x n product (i-j-k loop)
|
||||
n = 10 1,000 multiplications
|
||||
n = 100 1,000,000 multiplications
|
||||
n = 200 8,000,000 multiplications
|
||||
doubling n from 100 to 200 multiplies the work by 8
|
||||
|
||||
2x3 times 3x2: 12 multiplications (m * n * p = 2 * 3 * 2)
|
||||
|
||||
in-place transpose swaps, n x n
|
||||
n = 3 3 swaps (n * (n - 1) / 2 = 3)
|
||||
n = 100 4,950 swaps (n * (n - 1) / 2 = 4,950)
|
||||
|
||||
layer rotation four-cell moves, n x n
|
||||
n = 3 2 moves (n * n / 4 rounded down = 2)
|
||||
n = 4 4 moves (n * n / 4 rounded down = 4)
|
||||
n = 100 2,500 moves (n * n / 4 rounded down = 2,500)
|
||||
|
||||
spiral: cells visited vs rows * cols
|
||||
1 x 1 visits = 1 rows * cols = 1
|
||||
1 x 7 visits = 7 rows * cols = 7
|
||||
7 x 1 visits = 7 rows * cols = 7
|
||||
3 x 4 visits = 12 rows * cols = 12
|
||||
5 x 5 visits = 25 rows * cols = 25
|
||||
40 x 25 visits = 1,000 rows * cols = 1,000
|
||||
Reference in New Issue
Block a user