FA-91106 / Quantum circuit simulation / Open access
Reduced density matrix reads the kept bit big-endian · case 01
Keeping qubit 0 of a product state returns the other qubit reduced state.
ROOT CAUSE
Row and column indices are read from bit n-1-keep while the environment mask uses bit keep.
VERIFIED REPAIR
Read row and column from bit keep, consistent with the mask.
Unsuccessful approach: The attempted repair fixes the row index only, leaving the column index big-endian.
Case contract
Input [n, amps, keep]; trace out every qubit except keep (0 = LSB) from the pure state and return {"rho": 2x2 matrix of [re, im] entries with rho[r][c] = sum psi_r psi_c^*, trace-normalized, "purity": sum |rho_rc|^2}, all rounded to 6 decimals.
Why this case matters
Reduced states quantify entanglement and are used in debugging subsystem behavior; index or conjugation slips give non-physical matrices.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
n, amps, keep = x
psi = [complex(a, b) for a, b in amps]
m = 1 << keep
rho = [[0j, 0j], [0j, 0j]]
for i in range(len(psi)):
for j in range(len(psi)):
if (i & ~m) != (j & ~m):
continue
rho[(i >> (n - 1 - keep)) & 1][(j >> (n - 1 - keep)) & 1] += psi[i] * psi[j].conjugate()
tr = (rho[0][0] + rho[1][1]).real
rho = [[v / tr for v in row] for row in rho]
purity = sum(abs(rho[r][c]) ** 2 for r in range(2) for c in range(2))
f = lambda v: [round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0]
return {'rho': [[f(v) for v in row] for row in rho], 'purity': round(purity, 6) + 0.0}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: product keep 1', [2, [[0.6, 0], [0, 0.8], [0, 0], [0, 0]], 1], {'rho': [[[1.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]], 'purity': 1.0}], ['regression: product keep 0 complex', [2, [[0.6, 0], [0, 0.8], [0, 0], [0, 0]], 0], {'rho': [[[0.36, 0.0], [0.0, -0.48]], [[0.0, 0.48], [0.64, 0.0]]], 'purity': 1.0}], ['regression: random reduction 0', [3, [[0.069, -0.179], [-0.176, -0.715], [0.749, 0.757], [-0.786, 0.461], [0.287, -0.288], [-0.462, 0.389], [-0.216, 0.203], [0.456, 0.037]], 0], {'rho': [[[0.422483, 0.0], [-0.136327, -0.218796]], [[-0.136327, 0.218796], [0.577517, 0.0]]], 'purity': 0.644932}], ['control: bell keep 0', [2, [[0.707107, 0], [0, 0], [0, 0], [0.707107, 0]], 0], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: unnormalized ghz keep 2', [3, [[2, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [2, 0]], 2], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: random reduction 4', [3, [[-0.633, 0.511], [0.239, 0.051], [0.129, 0.555], [0.414, -0.526], [-0.93, 0.617], [-0.487, -0.199], [0.609, 0.703], [0.243, -0.571]], 1], {'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]], 'purity': 0.679793}], ['control: random reduction 6', [3, [[-0.509, 0.635], [-0.554, 0.902], [-0.528, 0.406], [0.035, -0.166], [0.785, 0.17], [0.113, 0.282], [-0.237, -0.733], [0.778, 0.455]], 1], {'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]], 'purity': 0.545127}]], [['regression: random reduction 1', [3, [[0.986, 1.972], [-1.424, 1.98], [-1.308, 1.935], [1.338, 1.563], [-1.898, 1.945], [-1.572, 1.06], [1.832, 0.52], [0.807, -1.748]], 0], {'rho': [[[0.549537, 0.0], [0.241932, 0.063109]], [[0.241932, -0.063109], [0.450463, 0.0]]], 'purity': 0.629935}], ['regression: random reduction 2', [3, [[-0.436, -0.609], [0.766, -0.544], [-0.426, -0.406], [0.661, 0.537], [-0.32, -0.358], [0.306, 0.359], [-0.048, -0.239], [-0.254, -0.85]], 0], {'rho': [[[0.313851, 0.0], [-0.134578, -0.188226]], [[-0.134578, 0.188226], [0.686149, 0.0]]], 'purity': 0.676383}], ['regression: random reduction 0', [3, [[0.069, -0.179], [-0.176, -0.715], [0.749, 0.757], [-0.786, 0.461], [0.287, -0.288], [-0.462, 0.389], [-0.216, 0.203], [0.456, 0.037]], 0], {'rho': [[[0.422483, 0.0], [-0.136327, -0.218796]], [[-0.136327, 0.218796], [0.577517, 0.0]]], 'purity': 0.644932}], ['control: random reduction 8', [3, [[-1.677, 1.763], [0.965, -0.593], [-1.405, -0.16], [0.617, -0.175], [-0.069, 0.647], [0.956, 1.91], [1.615, 1.856], [-0.044, 0.633]], 1], {'rho': [[[0.578893, 0.0], [0.238878, -0.116767]], [[0.238878, 0.116767], [0.421107, 0.0]]], 'purity': 0.653843}], ['control: random reduction 20', [3, [[1.607, 1.22], [-1.371, 1.824], [-0.549, -1.68], [-1.165, -1.776], [-1.934, 0.363], [-1.611, 1.355], [1.697, -1.137], [1.241, 0.112]], 1], {'rho': [[[0.568202, 0.0], [-0.32695, -0.072745]], [[-0.32695, 0.072745], [0.431798, 0.0]]], 'purity': 0.733679}], ['control: random reduction 24', [3, [[1.098, 0.419], [0.112, -1.975], [0.92, -0.042], [0.955, -0.47], [-0.284, 1.035], [-0.919, -1.361], [0.832, -0.502], [1.017, 1.37]], 1], {'rho': [[[0.61037, 0.0], [-0.101957, -0.05397]], [[-0.101957, 0.05397], [0.38963, 0.0]]], 'purity': 0.550979}], ['control: random reduction 25', [3, [[0.463, 1.771], [1.499, -1.228], [1.63, 0.415], [1.327, 1.246], [1.333, -1.092], [-1.896, -1.109], [1.712, -1.06], [0.426, -1.51]], 1], {'rho': [[[0.540662, 0.0], [0.22698, -0.166723]], [[0.22698, 0.166723], [0.459338, 0.0]]], 'purity': 0.66194}]], [['regression: random reduction 5', [2, [[-0.972, -0.109], [0.26, 0.259], [-0.134, -0.66], [-0.522, -0.043]], 0], {'rho': [[[0.775173, 0.0], [-0.100385, 0.309012]], [[-0.100385, -0.309012], [0.224827, 0.0]]], 'purity': 0.862571}], ['regression: random reduction 7', [2, [[-0.319, 0.362], [0.196, -0.039], [0.357, 0.708], [-0.468, -0.352]], 1], {'rho': [[[0.219179, 0.0], [0.051763, 0.355461]], [[0.051763, -0.355461], [0.780821, 0.0]]], 'purity': 0.915786}], ['regression: random reduction 2', [3, [[-0.436, -0.609], [0.766, -0.544], [-0.426, -0.406], [0.661, 0.537], [-0.32, -0.358], [0.306, 0.359], [-0.048, -0.239], [-0.254, -0.85]], 0], {'rho': [[[0.313851, 0.0], [-0.134578, -0.188226]], [[-0.134578, 0.188226], [0.686149, 0.0]]], 'purity': 0.676383}], ['control: random reduction 28', [3, [[-1.486, 1.31], [-1.913, -0.569], [0.963, -1.873], [0.598, 1.619], [-0.313, 1.537], [-1.23, 0.856], [-0.805, -1.408], [-0.713, -1.286]], 1], {'rho': [[[0.508192, 0.0], [-0.32577, -0.106161]], [[-0.32577, 0.106161], [0.491808, 0.0]]], 'purity': 0.734927}], ['control: bell keep 0', [2, [[0.707107, 0], [0, 0], [0, 0], [0.707107, 0]], 0], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: unnormalized ghz keep 2', [3, [[2, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [2, 0]], 2], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: random reduction 4', [3, [[-0.633, 0.511], [0.239, 0.051], [0.129, 0.555], [0.414, -0.526], [-0.93, 0.617], [-0.487, -0.199], [0.609, 0.703], [0.243, -0.571]], 1], {'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]], 'purity': 0.679793}]], [['regression: random reduction 10', [2, [[1.028, -0.183], [-1.245, 1.088], [-1.466, 1.868], [0.063, -1.172]], 1], {'rho': [[[0.352766, 0.0], [-0.295425, -0.28068]], [[-0.295425, 0.28068], [0.647234, 0.0]]], 'purity': 0.875471}], ['regression: random reduction 11', [2, [[0.608, -1.677], [-1.453, -1.131], [-0.939, -0.925], [-1.391, 1.723]], 1], {'rho': [[[0.497404, 0.0], [0.079671, 0.470271]], [[0.079671, -0.470271], [0.502596, 0.0]]], 'purity': 0.955018}], ['regression: random reduction 5', [2, [[-0.972, -0.109], [0.26, 0.259], [-0.134, -0.66], [-0.522, -0.043]], 0], {'rho': [[[0.775173, 0.0], [-0.100385, 0.309012]], [[-0.100385, -0.309012], [0.224827, 0.0]]], 'purity': 0.862571}], ['control: random reduction 6', [3, [[-0.509, 0.635], [-0.554, 0.902], [-0.528, 0.406], [0.035, -0.166], [0.785, 0.17], [0.113, 0.282], [-0.237, -0.733], [0.778, 0.455]], 1], {'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]], 'purity': 0.545127}], ['control: random reduction 8', [3, [[-1.677, 1.763], [0.965, -0.593], [-1.405, -0.16], [0.617, -0.175], [-0.069, 0.647], [0.956, 1.91], [1.615, 1.856], [-0.044, 0.633]], 1], {'rho': [[[0.578893, 0.0], [0.238878, -0.116767]], [[0.238878, 0.116767], [0.421107, 0.0]]], 'purity': 0.653843}], ['control: random reduction 20', [3, [[1.607, 1.22], [-1.371, 1.824], [-0.549, -1.68], [-1.165, -1.776], [-1.934, 0.363], [-1.611, 1.355], [1.697, -1.137], [1.241, 0.112]], 1], {'rho': [[[0.568202, 0.0], [-0.32695, -0.072745]], [[-0.32695, 0.072745], [0.431798, 0.0]]], 'purity': 0.733679}], ['control: random reduction 24', [3, [[1.098, 0.419], [0.112, -1.975], [0.92, -0.042], [0.955, -0.47], [-0.284, 1.035], [-0.919, -1.361], [0.832, -0.502], [1.017, 1.37]], 1], {'rho': [[[0.61037, 0.0], [-0.101957, -0.05397]], [[-0.101957, 0.05397], [0.38963, 0.0]]], 'purity': 0.550979}]], [['regression: random reduction 13', [3, [[0.278, -0.142], [0.711, 1.242], [1.341, -0.781], [0.535, 1.699], [1.247, 1.756], [1.976, 1.515], [0.169, 1.571], [1.287, -0.486]], 2], {'rho': [[[0.336611, 0.0], [0.097864, 0.040067]], [[0.097864, -0.040067], [0.663389, 0.0]]], 'purity': 0.575758}], ['regression: random reduction 14', [2, [[1.974, 1.455], [0.187, 0.409], [0.192, -0.999], [-1.245, 0.488]], 1], {'rho': [[[0.687682, 0.0], [-0.122554, 0.182645]], [[-0.122554, -0.182645], [0.312318, 0.0]]], 'purity': 0.667206}], ['regression: random reduction 9', [3, [[0.61, 0.432], [0.921, -0.251], [-0.196, 0.927], [-0.808, 0.05], [0.743, -0.342], [0.487, 0.369], [-0.844, 0.867], [-0.169, 0.678]], 2], {'rho': [[[0.502365, 0.0], [0.299281, -0.000926]], [[0.299281, 0.000926], [0.497635, 0.0]]], 'purity': 0.679151}], ['control: random reduction 25', [3, [[0.463, 1.771], [1.499, -1.228], [1.63, 0.415], [1.327, 1.246], [1.333, -1.092], [-1.896, -1.109], [1.712, -1.06], [0.426, -1.51]], 1], {'rho': [[[0.540662, 0.0], [0.22698, -0.166723]], [[0.22698, 0.166723], [0.459338, 0.0]]], 'purity': 0.66194}], ['control: random reduction 28', [3, [[-1.486, 1.31], [-1.913, -0.569], [0.963, -1.873], [0.598, 1.619], [-0.313, 1.537], [-1.23, 0.856], [-0.805, -1.408], [-0.713, -1.286]], 1], {'rho': [[[0.508192, 0.0], [-0.32577, -0.106161]], [[-0.32577, 0.106161], [0.491808, 0.0]]], 'purity': 0.734927}], ['control: bell keep 0', [2, [[0.707107, 0], [0, 0], [0, 0], [0.707107, 0]], 0], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: unnormalized ghz keep 2', [3, [[2, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [2, 0]], 2], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: product keep 1 | {'purity': 0.5392, 'rho': [[[0.36, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.64, 0.0]]]} | {'purity': 1.0, 'rho': [[[1.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]]} | Failed |
| regression: product keep 0 complex | {'purity': 1.0, 'rho': [[[1.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]]} | {'purity': 1.0, 'rho': [[[0.36, 0.0], [0.0, -0.48]], [[0.0, 0.48], [0.64, 0.0]]]} | Failed |
| regression: random reduction 0 | {'purity': 0.880816, 'rho': [[[0.936358, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.063642, 0.0]]]} | {'purity': 0.644932, 'rho': [[[0.422483, 0.0], [-0.136327, -0.218796]], [[-0.136327, 0.218796], [0.577517, 0.0]]]} | Failed |
| control: bell keep 0 | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | Passed |
| control: unnormalized ghz keep 2 | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | Passed |
| control: random reduction 4 | {'purity': 0.679793, 'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]]} | {'purity': 0.679793, 'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]]} | Passed |
| control: random reduction 6 | {'purity': 0.545127, 'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]]} | {'purity': 0.545127, 'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]]} | Passed |
SHA-256 / 0adccf161d3f4711c7ed6750c06cad6536e55cc5ae1267dea8f32315dfdb24b5
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
n, amps, keep = x
psi = [complex(a, b) for a, b in amps]
m = 1 << keep
rho = [[0j, 0j], [0j, 0j]]
for i in range(len(psi)):
for j in range(len(psi)):
if (i & ~m) != (j & ~m):
continue
rho[(i >> keep) & 1][(j >> (n - 1 - keep)) & 1] += psi[i] * psi[j].conjugate()
tr = (rho[0][0] + rho[1][1]).real
rho = [[v / tr for v in row] for row in rho]
purity = sum(abs(rho[r][c]) ** 2 for r in range(2) for c in range(2))
f = lambda v: [round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0]
return {'rho': [[f(v) for v in row] for row in rho], 'purity': round(purity, 6) + 0.0}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: product keep 1', [2, [[0.6, 0], [0, 0.8], [0, 0], [0, 0]], 1], {'rho': [[[1.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]], 'purity': 1.0}], ['regression: product keep 0 complex', [2, [[0.6, 0], [0, 0.8], [0, 0], [0, 0]], 0], {'rho': [[[0.36, 0.0], [0.0, -0.48]], [[0.0, 0.48], [0.64, 0.0]]], 'purity': 1.0}], ['regression: random reduction 0', [3, [[0.069, -0.179], [-0.176, -0.715], [0.749, 0.757], [-0.786, 0.461], [0.287, -0.288], [-0.462, 0.389], [-0.216, 0.203], [0.456, 0.037]], 0], {'rho': [[[0.422483, 0.0], [-0.136327, -0.218796]], [[-0.136327, 0.218796], [0.577517, 0.0]]], 'purity': 0.644932}], ['control: bell keep 0', [2, [[0.707107, 0], [0, 0], [0, 0], [0.707107, 0]], 0], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: unnormalized ghz keep 2', [3, [[2, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [2, 0]], 2], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: random reduction 4', [3, [[-0.633, 0.511], [0.239, 0.051], [0.129, 0.555], [0.414, -0.526], [-0.93, 0.617], [-0.487, -0.199], [0.609, 0.703], [0.243, -0.571]], 1], {'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]], 'purity': 0.679793}], ['control: random reduction 6', [3, [[-0.509, 0.635], [-0.554, 0.902], [-0.528, 0.406], [0.035, -0.166], [0.785, 0.17], [0.113, 0.282], [-0.237, -0.733], [0.778, 0.455]], 1], {'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]], 'purity': 0.545127}]], [['regression: random reduction 1', [3, [[0.986, 1.972], [-1.424, 1.98], [-1.308, 1.935], [1.338, 1.563], [-1.898, 1.945], [-1.572, 1.06], [1.832, 0.52], [0.807, -1.748]], 0], {'rho': [[[0.549537, 0.0], [0.241932, 0.063109]], [[0.241932, -0.063109], [0.450463, 0.0]]], 'purity': 0.629935}], ['regression: random reduction 2', [3, [[-0.436, -0.609], [0.766, -0.544], [-0.426, -0.406], [0.661, 0.537], [-0.32, -0.358], [0.306, 0.359], [-0.048, -0.239], [-0.254, -0.85]], 0], {'rho': [[[0.313851, 0.0], [-0.134578, -0.188226]], [[-0.134578, 0.188226], [0.686149, 0.0]]], 'purity': 0.676383}], ['regression: random reduction 0', [3, [[0.069, -0.179], [-0.176, -0.715], [0.749, 0.757], [-0.786, 0.461], [0.287, -0.288], [-0.462, 0.389], [-0.216, 0.203], [0.456, 0.037]], 0], {'rho': [[[0.422483, 0.0], [-0.136327, -0.218796]], [[-0.136327, 0.218796], [0.577517, 0.0]]], 'purity': 0.644932}], ['control: random reduction 8', [3, [[-1.677, 1.763], [0.965, -0.593], [-1.405, -0.16], [0.617, -0.175], [-0.069, 0.647], [0.956, 1.91], [1.615, 1.856], [-0.044, 0.633]], 1], {'rho': [[[0.578893, 0.0], [0.238878, -0.116767]], [[0.238878, 0.116767], [0.421107, 0.0]]], 'purity': 0.653843}], ['control: random reduction 20', [3, [[1.607, 1.22], [-1.371, 1.824], [-0.549, -1.68], [-1.165, -1.776], [-1.934, 0.363], [-1.611, 1.355], [1.697, -1.137], [1.241, 0.112]], 1], {'rho': [[[0.568202, 0.0], [-0.32695, -0.072745]], [[-0.32695, 0.072745], [0.431798, 0.0]]], 'purity': 0.733679}], ['control: random reduction 24', [3, [[1.098, 0.419], [0.112, -1.975], [0.92, -0.042], [0.955, -0.47], [-0.284, 1.035], [-0.919, -1.361], [0.832, -0.502], [1.017, 1.37]], 1], {'rho': [[[0.61037, 0.0], [-0.101957, -0.05397]], [[-0.101957, 0.05397], [0.38963, 0.0]]], 'purity': 0.550979}], ['control: random reduction 25', [3, [[0.463, 1.771], [1.499, -1.228], [1.63, 0.415], [1.327, 1.246], [1.333, -1.092], [-1.896, -1.109], [1.712, -1.06], [0.426, -1.51]], 1], {'rho': [[[0.540662, 0.0], [0.22698, -0.166723]], [[0.22698, 0.166723], [0.459338, 0.0]]], 'purity': 0.66194}]], [['regression: random reduction 5', [2, [[-0.972, -0.109], [0.26, 0.259], [-0.134, -0.66], [-0.522, -0.043]], 0], {'rho': [[[0.775173, 0.0], [-0.100385, 0.309012]], [[-0.100385, -0.309012], [0.224827, 0.0]]], 'purity': 0.862571}], ['regression: random reduction 7', [2, [[-0.319, 0.362], [0.196, -0.039], [0.357, 0.708], [-0.468, -0.352]], 1], {'rho': [[[0.219179, 0.0], [0.051763, 0.355461]], [[0.051763, -0.355461], [0.780821, 0.0]]], 'purity': 0.915786}], ['regression: random reduction 2', [3, [[-0.436, -0.609], [0.766, -0.544], [-0.426, -0.406], [0.661, 0.537], [-0.32, -0.358], [0.306, 0.359], [-0.048, -0.239], [-0.254, -0.85]], 0], {'rho': [[[0.313851, 0.0], [-0.134578, -0.188226]], [[-0.134578, 0.188226], [0.686149, 0.0]]], 'purity': 0.676383}], ['control: random reduction 28', [3, [[-1.486, 1.31], [-1.913, -0.569], [0.963, -1.873], [0.598, 1.619], [-0.313, 1.537], [-1.23, 0.856], [-0.805, -1.408], [-0.713, -1.286]], 1], {'rho': [[[0.508192, 0.0], [-0.32577, -0.106161]], [[-0.32577, 0.106161], [0.491808, 0.0]]], 'purity': 0.734927}], ['control: bell keep 0', [2, [[0.707107, 0], [0, 0], [0, 0], [0.707107, 0]], 0], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: unnormalized ghz keep 2', [3, [[2, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [2, 0]], 2], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: random reduction 4', [3, [[-0.633, 0.511], [0.239, 0.051], [0.129, 0.555], [0.414, -0.526], [-0.93, 0.617], [-0.487, -0.199], [0.609, 0.703], [0.243, -0.571]], 1], {'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]], 'purity': 0.679793}]], [['regression: random reduction 10', [2, [[1.028, -0.183], [-1.245, 1.088], [-1.466, 1.868], [0.063, -1.172]], 1], {'rho': [[[0.352766, 0.0], [-0.295425, -0.28068]], [[-0.295425, 0.28068], [0.647234, 0.0]]], 'purity': 0.875471}], ['regression: random reduction 11', [2, [[0.608, -1.677], [-1.453, -1.131], [-0.939, -0.925], [-1.391, 1.723]], 1], {'rho': [[[0.497404, 0.0], [0.079671, 0.470271]], [[0.079671, -0.470271], [0.502596, 0.0]]], 'purity': 0.955018}], ['regression: random reduction 5', [2, [[-0.972, -0.109], [0.26, 0.259], [-0.134, -0.66], [-0.522, -0.043]], 0], {'rho': [[[0.775173, 0.0], [-0.100385, 0.309012]], [[-0.100385, -0.309012], [0.224827, 0.0]]], 'purity': 0.862571}], ['control: random reduction 6', [3, [[-0.509, 0.635], [-0.554, 0.902], [-0.528, 0.406], [0.035, -0.166], [0.785, 0.17], [0.113, 0.282], [-0.237, -0.733], [0.778, 0.455]], 1], {'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]], 'purity': 0.545127}], ['control: random reduction 8', [3, [[-1.677, 1.763], [0.965, -0.593], [-1.405, -0.16], [0.617, -0.175], [-0.069, 0.647], [0.956, 1.91], [1.615, 1.856], [-0.044, 0.633]], 1], {'rho': [[[0.578893, 0.0], [0.238878, -0.116767]], [[0.238878, 0.116767], [0.421107, 0.0]]], 'purity': 0.653843}], ['control: random reduction 20', [3, [[1.607, 1.22], [-1.371, 1.824], [-0.549, -1.68], [-1.165, -1.776], [-1.934, 0.363], [-1.611, 1.355], [1.697, -1.137], [1.241, 0.112]], 1], {'rho': [[[0.568202, 0.0], [-0.32695, -0.072745]], [[-0.32695, 0.072745], [0.431798, 0.0]]], 'purity': 0.733679}], ['control: random reduction 24', [3, [[1.098, 0.419], [0.112, -1.975], [0.92, -0.042], [0.955, -0.47], [-0.284, 1.035], [-0.919, -1.361], [0.832, -0.502], [1.017, 1.37]], 1], {'rho': [[[0.61037, 0.0], [-0.101957, -0.05397]], [[-0.101957, 0.05397], [0.38963, 0.0]]], 'purity': 0.550979}]], [['regression: random reduction 13', [3, [[0.278, -0.142], [0.711, 1.242], [1.341, -0.781], [0.535, 1.699], [1.247, 1.756], [1.976, 1.515], [0.169, 1.571], [1.287, -0.486]], 2], {'rho': [[[0.336611, 0.0], [0.097864, 0.040067]], [[0.097864, -0.040067], [0.663389, 0.0]]], 'purity': 0.575758}], ['regression: random reduction 14', [2, [[1.974, 1.455], [0.187, 0.409], [0.192, -0.999], [-1.245, 0.488]], 1], {'rho': [[[0.687682, 0.0], [-0.122554, 0.182645]], [[-0.122554, -0.182645], [0.312318, 0.0]]], 'purity': 0.667206}], ['regression: random reduction 9', [3, [[0.61, 0.432], [0.921, -0.251], [-0.196, 0.927], [-0.808, 0.05], [0.743, -0.342], [0.487, 0.369], [-0.844, 0.867], [-0.169, 0.678]], 2], {'rho': [[[0.502365, 0.0], [0.299281, -0.000926]], [[0.299281, 0.000926], [0.497635, 0.0]]], 'purity': 0.679151}], ['control: random reduction 25', [3, [[0.463, 1.771], [1.499, -1.228], [1.63, 0.415], [1.327, 1.246], [1.333, -1.092], [-1.896, -1.109], [1.712, -1.06], [0.426, -1.51]], 1], {'rho': [[[0.540662, 0.0], [0.22698, -0.166723]], [[0.22698, 0.166723], [0.459338, 0.0]]], 'purity': 0.66194}], ['control: random reduction 28', [3, [[-1.486, 1.31], [-1.913, -0.569], [0.963, -1.873], [0.598, 1.619], [-0.313, 1.537], [-1.23, 0.856], [-0.805, -1.408], [-0.713, -1.286]], 1], {'rho': [[[0.508192, 0.0], [-0.32577, -0.106161]], [[-0.32577, 0.106161], [0.491808, 0.0]]], 'purity': 0.734927}], ['control: bell keep 0', [2, [[0.707107, 0], [0, 0], [0, 0], [0.707107, 0]], 0], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: unnormalized ghz keep 2', [3, [[2, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [2, 0]], 2], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: product keep 1 | {'purity': 4.160494, 'rho': [[[1.0, 0.0], [1.777778, 0.0]], [[0.0, 0.0], [0.0, 0.0]]]} | {'purity': 1.0, 'rho': [[[1.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]]} | Failed |
| regression: product keep 0 complex | {'purity': 7.716049, 'rho': [[[1.0, -1.333333], [0.0, 0.0]], [[1.777778, 1.333333], [0.0, 0.0]]]} | {'purity': 1.0, 'rho': [[[0.36, 0.0], [0.0, -0.48]], [[0.0, 0.48], [0.64, 0.0]]]} | Failed |
| regression: random reduction 0 | {'purity': 2.5576, 'rho': [[[0.814489, -0.668618], [-0.064129, 0.09489]], [[0.971377, 0.668618], [0.185511, -0.09489]]]} | {'purity': 0.644932, 'rho': [[[0.422483, 0.0], [-0.136327, -0.218796]], [[-0.136327, 0.218796], [0.577517, 0.0]]]} | Failed |
| control: bell keep 0 | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | Passed |
| control: unnormalized ghz keep 2 | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | Passed |
| control: random reduction 4 | {'purity': 0.679793, 'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]]} | {'purity': 0.679793, 'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]]} | Passed |
| control: random reduction 6 | {'purity': 0.545127, 'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]]} | {'purity': 0.545127, 'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]]} | Passed |
SHA-256 / c4ea02e8e74eb31e9042fdacca1ec67331b5c140e988eba1c7e584ce948114da
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
n, amps, keep = x
psi = [complex(a, b) for a, b in amps]
m = 1 << keep
rho = [[0j, 0j], [0j, 0j]]
for i in range(len(psi)):
for j in range(len(psi)):
if (i & ~m) != (j & ~m):
continue
rho[(i >> keep) & 1][(j >> keep) & 1] += psi[i] * psi[j].conjugate()
tr = (rho[0][0] + rho[1][1]).real
rho = [[v / tr for v in row] for row in rho]
purity = sum(abs(rho[r][c]) ** 2 for r in range(2) for c in range(2))
f = lambda v: [round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0]
return {'rho': [[f(v) for v in row] for row in rho], 'purity': round(purity, 6) + 0.0}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: product keep 1', [2, [[0.6, 0], [0, 0.8], [0, 0], [0, 0]], 1], {'rho': [[[1.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]], 'purity': 1.0}], ['regression: product keep 0 complex', [2, [[0.6, 0], [0, 0.8], [0, 0], [0, 0]], 0], {'rho': [[[0.36, 0.0], [0.0, -0.48]], [[0.0, 0.48], [0.64, 0.0]]], 'purity': 1.0}], ['regression: random reduction 0', [3, [[0.069, -0.179], [-0.176, -0.715], [0.749, 0.757], [-0.786, 0.461], [0.287, -0.288], [-0.462, 0.389], [-0.216, 0.203], [0.456, 0.037]], 0], {'rho': [[[0.422483, 0.0], [-0.136327, -0.218796]], [[-0.136327, 0.218796], [0.577517, 0.0]]], 'purity': 0.644932}], ['control: bell keep 0', [2, [[0.707107, 0], [0, 0], [0, 0], [0.707107, 0]], 0], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: unnormalized ghz keep 2', [3, [[2, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [2, 0]], 2], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: random reduction 4', [3, [[-0.633, 0.511], [0.239, 0.051], [0.129, 0.555], [0.414, -0.526], [-0.93, 0.617], [-0.487, -0.199], [0.609, 0.703], [0.243, -0.571]], 1], {'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]], 'purity': 0.679793}], ['control: random reduction 6', [3, [[-0.509, 0.635], [-0.554, 0.902], [-0.528, 0.406], [0.035, -0.166], [0.785, 0.17], [0.113, 0.282], [-0.237, -0.733], [0.778, 0.455]], 1], {'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]], 'purity': 0.545127}]], [['regression: random reduction 1', [3, [[0.986, 1.972], [-1.424, 1.98], [-1.308, 1.935], [1.338, 1.563], [-1.898, 1.945], [-1.572, 1.06], [1.832, 0.52], [0.807, -1.748]], 0], {'rho': [[[0.549537, 0.0], [0.241932, 0.063109]], [[0.241932, -0.063109], [0.450463, 0.0]]], 'purity': 0.629935}], ['regression: random reduction 2', [3, [[-0.436, -0.609], [0.766, -0.544], [-0.426, -0.406], [0.661, 0.537], [-0.32, -0.358], [0.306, 0.359], [-0.048, -0.239], [-0.254, -0.85]], 0], {'rho': [[[0.313851, 0.0], [-0.134578, -0.188226]], [[-0.134578, 0.188226], [0.686149, 0.0]]], 'purity': 0.676383}], ['regression: random reduction 0', [3, [[0.069, -0.179], [-0.176, -0.715], [0.749, 0.757], [-0.786, 0.461], [0.287, -0.288], [-0.462, 0.389], [-0.216, 0.203], [0.456, 0.037]], 0], {'rho': [[[0.422483, 0.0], [-0.136327, -0.218796]], [[-0.136327, 0.218796], [0.577517, 0.0]]], 'purity': 0.644932}], ['control: random reduction 8', [3, [[-1.677, 1.763], [0.965, -0.593], [-1.405, -0.16], [0.617, -0.175], [-0.069, 0.647], [0.956, 1.91], [1.615, 1.856], [-0.044, 0.633]], 1], {'rho': [[[0.578893, 0.0], [0.238878, -0.116767]], [[0.238878, 0.116767], [0.421107, 0.0]]], 'purity': 0.653843}], ['control: random reduction 20', [3, [[1.607, 1.22], [-1.371, 1.824], [-0.549, -1.68], [-1.165, -1.776], [-1.934, 0.363], [-1.611, 1.355], [1.697, -1.137], [1.241, 0.112]], 1], {'rho': [[[0.568202, 0.0], [-0.32695, -0.072745]], [[-0.32695, 0.072745], [0.431798, 0.0]]], 'purity': 0.733679}], ['control: random reduction 24', [3, [[1.098, 0.419], [0.112, -1.975], [0.92, -0.042], [0.955, -0.47], [-0.284, 1.035], [-0.919, -1.361], [0.832, -0.502], [1.017, 1.37]], 1], {'rho': [[[0.61037, 0.0], [-0.101957, -0.05397]], [[-0.101957, 0.05397], [0.38963, 0.0]]], 'purity': 0.550979}], ['control: random reduction 25', [3, [[0.463, 1.771], [1.499, -1.228], [1.63, 0.415], [1.327, 1.246], [1.333, -1.092], [-1.896, -1.109], [1.712, -1.06], [0.426, -1.51]], 1], {'rho': [[[0.540662, 0.0], [0.22698, -0.166723]], [[0.22698, 0.166723], [0.459338, 0.0]]], 'purity': 0.66194}]], [['regression: random reduction 5', [2, [[-0.972, -0.109], [0.26, 0.259], [-0.134, -0.66], [-0.522, -0.043]], 0], {'rho': [[[0.775173, 0.0], [-0.100385, 0.309012]], [[-0.100385, -0.309012], [0.224827, 0.0]]], 'purity': 0.862571}], ['regression: random reduction 7', [2, [[-0.319, 0.362], [0.196, -0.039], [0.357, 0.708], [-0.468, -0.352]], 1], {'rho': [[[0.219179, 0.0], [0.051763, 0.355461]], [[0.051763, -0.355461], [0.780821, 0.0]]], 'purity': 0.915786}], ['regression: random reduction 2', [3, [[-0.436, -0.609], [0.766, -0.544], [-0.426, -0.406], [0.661, 0.537], [-0.32, -0.358], [0.306, 0.359], [-0.048, -0.239], [-0.254, -0.85]], 0], {'rho': [[[0.313851, 0.0], [-0.134578, -0.188226]], [[-0.134578, 0.188226], [0.686149, 0.0]]], 'purity': 0.676383}], ['control: random reduction 28', [3, [[-1.486, 1.31], [-1.913, -0.569], [0.963, -1.873], [0.598, 1.619], [-0.313, 1.537], [-1.23, 0.856], [-0.805, -1.408], [-0.713, -1.286]], 1], {'rho': [[[0.508192, 0.0], [-0.32577, -0.106161]], [[-0.32577, 0.106161], [0.491808, 0.0]]], 'purity': 0.734927}], ['control: bell keep 0', [2, [[0.707107, 0], [0, 0], [0, 0], [0.707107, 0]], 0], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: unnormalized ghz keep 2', [3, [[2, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [2, 0]], 2], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: random reduction 4', [3, [[-0.633, 0.511], [0.239, 0.051], [0.129, 0.555], [0.414, -0.526], [-0.93, 0.617], [-0.487, -0.199], [0.609, 0.703], [0.243, -0.571]], 1], {'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]], 'purity': 0.679793}]], [['regression: random reduction 10', [2, [[1.028, -0.183], [-1.245, 1.088], [-1.466, 1.868], [0.063, -1.172]], 1], {'rho': [[[0.352766, 0.0], [-0.295425, -0.28068]], [[-0.295425, 0.28068], [0.647234, 0.0]]], 'purity': 0.875471}], ['regression: random reduction 11', [2, [[0.608, -1.677], [-1.453, -1.131], [-0.939, -0.925], [-1.391, 1.723]], 1], {'rho': [[[0.497404, 0.0], [0.079671, 0.470271]], [[0.079671, -0.470271], [0.502596, 0.0]]], 'purity': 0.955018}], ['regression: random reduction 5', [2, [[-0.972, -0.109], [0.26, 0.259], [-0.134, -0.66], [-0.522, -0.043]], 0], {'rho': [[[0.775173, 0.0], [-0.100385, 0.309012]], [[-0.100385, -0.309012], [0.224827, 0.0]]], 'purity': 0.862571}], ['control: random reduction 6', [3, [[-0.509, 0.635], [-0.554, 0.902], [-0.528, 0.406], [0.035, -0.166], [0.785, 0.17], [0.113, 0.282], [-0.237, -0.733], [0.778, 0.455]], 1], {'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]], 'purity': 0.545127}], ['control: random reduction 8', [3, [[-1.677, 1.763], [0.965, -0.593], [-1.405, -0.16], [0.617, -0.175], [-0.069, 0.647], [0.956, 1.91], [1.615, 1.856], [-0.044, 0.633]], 1], {'rho': [[[0.578893, 0.0], [0.238878, -0.116767]], [[0.238878, 0.116767], [0.421107, 0.0]]], 'purity': 0.653843}], ['control: random reduction 20', [3, [[1.607, 1.22], [-1.371, 1.824], [-0.549, -1.68], [-1.165, -1.776], [-1.934, 0.363], [-1.611, 1.355], [1.697, -1.137], [1.241, 0.112]], 1], {'rho': [[[0.568202, 0.0], [-0.32695, -0.072745]], [[-0.32695, 0.072745], [0.431798, 0.0]]], 'purity': 0.733679}], ['control: random reduction 24', [3, [[1.098, 0.419], [0.112, -1.975], [0.92, -0.042], [0.955, -0.47], [-0.284, 1.035], [-0.919, -1.361], [0.832, -0.502], [1.017, 1.37]], 1], {'rho': [[[0.61037, 0.0], [-0.101957, -0.05397]], [[-0.101957, 0.05397], [0.38963, 0.0]]], 'purity': 0.550979}]], [['regression: random reduction 13', [3, [[0.278, -0.142], [0.711, 1.242], [1.341, -0.781], [0.535, 1.699], [1.247, 1.756], [1.976, 1.515], [0.169, 1.571], [1.287, -0.486]], 2], {'rho': [[[0.336611, 0.0], [0.097864, 0.040067]], [[0.097864, -0.040067], [0.663389, 0.0]]], 'purity': 0.575758}], ['regression: random reduction 14', [2, [[1.974, 1.455], [0.187, 0.409], [0.192, -0.999], [-1.245, 0.488]], 1], {'rho': [[[0.687682, 0.0], [-0.122554, 0.182645]], [[-0.122554, -0.182645], [0.312318, 0.0]]], 'purity': 0.667206}], ['regression: random reduction 9', [3, [[0.61, 0.432], [0.921, -0.251], [-0.196, 0.927], [-0.808, 0.05], [0.743, -0.342], [0.487, 0.369], [-0.844, 0.867], [-0.169, 0.678]], 2], {'rho': [[[0.502365, 0.0], [0.299281, -0.000926]], [[0.299281, 0.000926], [0.497635, 0.0]]], 'purity': 0.679151}], ['control: random reduction 25', [3, [[0.463, 1.771], [1.499, -1.228], [1.63, 0.415], [1.327, 1.246], [1.333, -1.092], [-1.896, -1.109], [1.712, -1.06], [0.426, -1.51]], 1], {'rho': [[[0.540662, 0.0], [0.22698, -0.166723]], [[0.22698, 0.166723], [0.459338, 0.0]]], 'purity': 0.66194}], ['control: random reduction 28', [3, [[-1.486, 1.31], [-1.913, -0.569], [0.963, -1.873], [0.598, 1.619], [-0.313, 1.537], [-1.23, 0.856], [-0.805, -1.408], [-0.713, -1.286]], 1], {'rho': [[[0.508192, 0.0], [-0.32577, -0.106161]], [[-0.32577, 0.106161], [0.491808, 0.0]]], 'purity': 0.734927}], ['control: bell keep 0', [2, [[0.707107, 0], [0, 0], [0, 0], [0.707107, 0]], 0], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}], ['control: unnormalized ghz keep 2', [3, [[2, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [2, 0]], 2], {'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]], 'purity': 0.5}]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: product keep 1 | {'purity': 1.0, 'rho': [[[1.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]]} | {'purity': 1.0, 'rho': [[[1.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]]} | Passed |
| regression: product keep 0 complex | {'purity': 1.0, 'rho': [[[0.36, 0.0], [0.0, -0.48]], [[0.0, 0.48], [0.64, 0.0]]]} | {'purity': 1.0, 'rho': [[[0.36, 0.0], [0.0, -0.48]], [[0.0, 0.48], [0.64, 0.0]]]} | Passed |
| regression: random reduction 0 | {'purity': 0.644932, 'rho': [[[0.422483, 0.0], [-0.136327, -0.218796]], [[-0.136327, 0.218796], [0.577517, 0.0]]]} | {'purity': 0.644932, 'rho': [[[0.422483, 0.0], [-0.136327, -0.218796]], [[-0.136327, 0.218796], [0.577517, 0.0]]]} | Passed |
| control: bell keep 0 | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | Passed |
| control: unnormalized ghz keep 2 | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | {'purity': 0.5, 'rho': [[[0.5, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.5, 0.0]]]} | Passed |
| control: random reduction 4 | {'purity': 0.679793, 'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]]} | {'purity': 0.679793, 'rho': [[[0.525894, 0.0], [0.032047, 0.296983]], [[0.032047, -0.296983], [0.474106, 0.0]]]} | Passed |
| control: random reduction 6 | {'purity': 0.545127, 'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]]} | {'purity': 0.545127, 'rho': [[[0.57299, 0.0], [0.059796, 0.116878]], [[0.059796, -0.116878], [0.42701, 0.0]]]} | Passed |
SHA-256 / 48935ad1e6dec9bc6afb81e9ea813d83ce3f450163ccabb580fb07481ffa8fe2
Verification & scope
A deterministic bounded teaching model with a stipulated toy contract; amplitudes are rounded to fixed decimals for strict JSON output. It is not a production quantum SDK and claims no standards conformance. 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:51:32.897762+00:00.
Case digest / 7625756c7bf107158f701b139a4fc45d60535bd15b0e76da1ae66b5128b5aba7