Datasets:
Formats:
csv
Languages:
English
Size:
< 1K
Tags:
mathematics
information-theory
quantum-information
representation-theory
bosonic-memory
task-relative-compression
File size: 2,574 Bytes
e740887 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | """Regression checks for dephasing, photon loss, spectral gaps, and worked atlas."""
from pathlib import Path
import sys
import numpy as np
from scipy.linalg import expm
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "code"))
from orynthra import simplex_code, observable_closure, LinearEdge, permutation_matrix
def test_dephasing_destroys_exact_distinguishability():
v, _, _ = simplex_code(6, 2)
rho = []
for j in range(6):
pure = np.outer(v[:, j], v[:, j])
pure[0, 1:] = 0
pure[1:, 0] = 0
rho.append(pure)
assert np.isclose(np.trace(pure), 1)
for i in range(6):
for j in range(i):
assert np.isclose(np.trace(rho[i] @ rho[j]), 1/18)
def test_h6_fails_one_photon_loss_knill_laflamme_condition():
v, _, _ = simplex_code(6, 2)
n1 = np.diag([0, 4, 3, 2, 1, 0])
logical_error_gram = v.T @ n1 @ v
eigenvalues = np.linalg.eigvalsh(logical_error_gram)
assert np.allclose(eigenvalues, [0, 0, 1, 2, 3, 4])
assert not np.allclose(logical_error_gram,
np.eye(6) * np.trace(logical_error_gram)/6)
def test_gap_sensitive_commutator_bound_on_seeded_unitaries():
rng = np.random.default_rng(20261009)
n = 6
energies = np.cumsum(rng.uniform(0.5, 1.5, n))
gap = np.min(np.diff(energies))
h = np.diag(energies)
a = permutation_matrix(list(range(1, n)) + [0])
b = permutation_matrix([1, 0] + list(range(2, n)))
assert np.isclose(np.linalg.norm(a @ b - b @ a, 2), np.sqrt(3))
for t in [0, 0.001, 0.02, 0.1, 1]:
us = []
for _ in range(2):
x = rng.normal(size=(n, n)) + 1j*rng.normal(size=(n, n))
x = (x + x.conj().T)/2
u = np.diag(np.exp(1j*rng.uniform(-1, 1, n))) @ expm(1j*t*x)
us.append(u)
ua, ub = us
eta = sum(np.linalg.norm(h @ u - u @ h, "fro") for u in us)
physical_comm = np.linalg.norm(ua @ ub - ub @ ua, 2)
assert physical_comm <= 2*eta/gap + 1e-12
eps = np.linalg.norm(ua-a, 2) + np.linalg.norm(ub-b, 2)
assert np.sqrt(3) <= 2*eps + 2*eta/gap + 1e-12
def test_two_domain_worked_example():
j = np.array([[0,1,0],[1,0,0],[0,0,1]])
loop = np.array([[1,0,0],[0,0,1],[0,1,0]])
obs = [np.array([[1,0,0]]), np.array([[1,0,0]])]
edges = [LinearEdge(0,1,j), LinearEdge(1,0,j)]
bases, _ = observable_closure(obs, edges)
assert [len(b) for b in bases] == [2,2]
bases, _ = observable_closure(obs, edges+[LinearEdge(0,0,loop)])
assert [len(b) for b in bases] == [3,3]
|