FAILURE MAP
← Case archive

FA-6036 / Linear algebra / Open access

Matrix multiply row column · case 01

Rows of the right operand are used where columns are required.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Rows of the right operand are used where columns are required.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return [[sum(x*y for x,y in zip(row,col)) for col in zip(*b)] for row in a]

Unsuccessful approach: Multiplying row and column sums introduces cross terms.

Case contract

Integer matrix/vector entries, rectangular rows, compatible multiplication dimensions, and square matrices for determinant, trace, inverse, symmetry and characteristic-polynomial operations. Rational matrix outputs are reduced Fraction strings. Matrix multiply row column. Exact operational definition: [[sum(x*y for x,y in zip(row,col)) for col in zip(*b)] for row in a]

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Linear algebra results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(a, b):
    return [[sum(x*y for x,y in zip(row,col)) for col in b] for row in a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([[1, 2], [3, 4]], [[5, 6], [7, 8]])', solve(*([[1, 2], [3, 4]], [[5, 6], [7, 8]])), [[19, 22], [43, 50]])
check('fixture 2: ([[1, 0], [0, 1]], [[2, 3], [4, 5]])', solve(*([[1, 0], [0, 1]], [[2, 3], [4, 5]])), [[2, 3], [4, 5]])
check('fixture 3: ([[2]], [[3]])', solve(*([[2]], [[3]])), [[6]])
check('fixture 4: ([[0, 0]], [[1], [2]])', solve(*([[0, 0]], [[1], [2]])), [[0]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: ([[1, 2], [3, 4]], [[5, 6], [7, 8]])[[17, 23], [39, 53]][[19, 22], [43, 50]]Failed
fixture 2: ([[1, 0], [0, 1]], [[2, 3], [4, 5]])[[2, 4], [3, 5]][[2, 3], [4, 5]]Failed
fixture 3: ([[2]], [[3]])[[6]][[6]]Passed
fixture 4: ([[0, 0]], [[1], [2]])[[0, 0]][[0]]Failed

SHA-256 / f19f4af7857db8b24f1b758cdff6fe13377d83940dc8f85ad5d1d49677c564fe

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(a, b):
    return [[sum(row)*sum(col) for col in zip(*b)] for row in a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([[1, 2], [3, 4]], [[5, 6], [7, 8]])', solve(*([[1, 2], [3, 4]], [[5, 6], [7, 8]])), [[19, 22], [43, 50]])
check('fixture 2: ([[1, 0], [0, 1]], [[2, 3], [4, 5]])', solve(*([[1, 0], [0, 1]], [[2, 3], [4, 5]])), [[2, 3], [4, 5]])
check('fixture 3: ([[2]], [[3]])', solve(*([[2]], [[3]])), [[6]])
check('fixture 4: ([[0, 0]], [[1], [2]])', solve(*([[0, 0]], [[1], [2]])), [[0]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: ([[1, 2], [3, 4]], [[5, 6], [7, 8]])[[36, 42], [84, 98]][[19, 22], [43, 50]]Failed
fixture 2: ([[1, 0], [0, 1]], [[2, 3], [4, 5]])[[6, 8], [6, 8]][[2, 3], [4, 5]]Failed
fixture 3: ([[2]], [[3]])[[6]][[6]]Passed
fixture 4: ([[0, 0]], [[1], [2]])[[0]][[0]]Passed

SHA-256 / 72da711cbc2364bd311169b23336f1423235f2c6556f09258a209a13f7b9a643

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(a, b):
    return [[sum(x*y for x,y in zip(row,col)) for col in zip(*b)] for row in a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([[1, 2], [3, 4]], [[5, 6], [7, 8]])', solve(*([[1, 2], [3, 4]], [[5, 6], [7, 8]])), [[19, 22], [43, 50]])
check('fixture 2: ([[1, 0], [0, 1]], [[2, 3], [4, 5]])', solve(*([[1, 0], [0, 1]], [[2, 3], [4, 5]])), [[2, 3], [4, 5]])
check('fixture 3: ([[2]], [[3]])', solve(*([[2]], [[3]])), [[6]])
check('fixture 4: ([[0, 0]], [[1], [2]])', solve(*([[0, 0]], [[1], [2]])), [[0]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: ([[1, 2], [3, 4]], [[5, 6], [7, 8]])[[19, 22], [43, 50]][[19, 22], [43, 50]]Passed
fixture 2: ([[1, 0], [0, 1]], [[2, 3], [4, 5]])[[2, 3], [4, 5]][[2, 3], [4, 5]]Passed
fixture 3: ([[2]], [[3]])[[6]][[6]]Passed
fixture 4: ([[0, 0]], [[1], [2]])[[0]][[0]]Passed

SHA-256 / 87b6f4dc5fce743ce171f7204195da3fbb3a4982b02b75ac9c560560651b41fb

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:37:56.850761+00:00.

Case digest / 8d30947f6f79ee2ba88327eac572688c26c07ed2ce4c814cda8fed70d7e8e100