""" 04_tiles_noise_scan.py Noise-robustness comparison: find the critical white-noise fraction p_c at which each criterion stops detecting entanglement of rho(p) = p * rho_Tiles + (1-p) * I/9 Reproduces (see the chat for the full discussion/derivation): - plain shadow-map / de Vicente Bloch-representation criterion: p_c ~ 0.9493 (tolerance ~5.07%) - DPS level 2: p_c ~ 0.951 (tolerance ~4.9%) i.e. DPS level 2 barely improves on the much cheaper order-1 correlation criterion for THIS state -- see 05_local_filtering.py for the much bigger lever (local filtering). Expected runtime: seconds for the shadow-map part; a few minutes for the DPS-2 bisection (12-16 SDP solves). """ import cvxpy as cp from common import noisy_tiles, shadow_map_nuclear_norm from dps_hierarchy import build_dps_problem, dps_feasible SOLVER = cp.SCS print("Shadow-map criterion threshold:") lo, hi = 0.0, 1.0 for _ in range(40): mid = (lo + hi) / 2 if shadow_map_nuclear_norm(noisy_tiles(mid)) > 1: hi = mid else: lo = mid print(f" p_c = {hi:.5f} (tolerance {100 * (1 - hi):.2f}%)") print("\nDPS level-2 threshold:") prob, rho_param, sigma = build_dps_problem(d=3, k=2) lo, hi = 0.0, 1.0 for i in range(16): mid = (lo + hi) / 2 ok = dps_feasible(prob, rho_param, noisy_tiles(mid), solver=SOLVER, eps=1e-7, warm_start=True) if ok: lo = mid else: hi = mid print(f" [{i + 1}] p={mid:.5f} feasible={ok}") print(f" p_c = {hi:.5f} (tolerance {100 * (1 - hi):.2f}%)")