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,30 @@
|
||||
Addition and multiplication
|
||||
===========================
|
||||
|
||||
A + B (both 2x3)
|
||||
[1 2 3]
|
||||
[4 5 6]
|
||||
+
|
||||
[6 5 4]
|
||||
[3 2 1]
|
||||
=
|
||||
[7 7 7]
|
||||
[7 7 7]
|
||||
|
||||
X * Y (2x3 times 3x2 gives 2x2)
|
||||
[1 2 3]
|
||||
[4 5 6]
|
||||
*
|
||||
[ 7 8]
|
||||
[ 9 10]
|
||||
[11 12]
|
||||
=
|
||||
[ 58 64]
|
||||
[139 154]
|
||||
|
||||
multiply (i-j-k) and multiplyIkj agree: true
|
||||
X * I (3x3 identity) equals X: true
|
||||
|
||||
add 2x3 + 3x2 -> IllegalArgumentException: cannot add 2x3 and 3x2: both matrices must have the same shape
|
||||
multiply 2x3 * 2x3 -> IllegalArgumentException: cannot multiply 2x3 by 2x3: columns of A (3) must equal rows of B (2)
|
||||
add with a jagged row -> IllegalArgumentException: row 1 has 1 columns but row 0 has 2
|
||||
Reference in New Issue
Block a user