"""Rebuild the mollifier weight files lam_L0174.npy and lam_L0175.npy from the CSV copies in this folder and check that they are byte-identical to the files used in the certificate runs (SHA-256 below, also printed in CERTIFICATE_0.174*.log and in the paper's table "Inputs of the certificate"). The CSV files store every float64 weight with Python's shortest round-trip repr, so the conversion is exact. Run this once before `python certify_all.py 0.174`. python restore_weights.py Licence: MIT (see README.yaml). (c) 2026 Pedro Caceres. """ import hashlib import os import sys import numpy as np EXPECTED = { "lam_L0174": "d71b379ee04a299191ec31c420d4dcca6bba3fc61c707eb9ee4c71c0c49b1235", "lam_L0175": "813b546321eeb78d020e4dee44019e1e27904ca4483fc5b95c90f730e1804a07", } here = os.path.dirname(os.path.abspath(__file__)) ok = True for name, sha in EXPECTED.items(): rows = open(os.path.join(here, name + ".csv"), encoding="ascii").read().splitlines()[1:] idx = [int(r.split(",")[0]) for r in rows] assert idx == list(range(1, len(rows) + 1)), name + ": indices not 1..D" lam = np.array([float(r.split(",")[1]) for r in rows], dtype="