This folder is a cleaned public version of the Circuit Harmonic Matrix covariance workflow. It contains only the scripts needed to compute and plot Fourier-coefficient covariance/correlation data using exact two-copy parameter twirling, with optional Monte Carlo validation.
ansatze.py— minimal PennyLane/JAX circuit library for Monte Carlo validation.exact_covariance_twirled.py— exact two-copy parameter-twirled covariance for one circuit configuration.twirled_correlation_matrices_compute.py— batch computation over qubit/depth/layer sweeps.twirled_correlation_matrices_plot.py— correlation heatmap grids from batch.npzoutputs.twirled_variance_profile_plot.py— Fourier-coefficient variance profile plots.experiment_gui.py— Tkinter launcher for the same command-line workflow.
cov_estimator.pywas excluded because the uploaded version is tied to parameter-tying experiments and importstying.diagnose_delta_norms.pywas excluded because it is a pruning/Cov-shift diagnostic and imports pruning metadata.- Phase-alignment, Fisher/QFIM, pruning, gate-schematic, and prediction-launcher paths were removed from the GUI.
Core exact twirling requires numpy; plotting requires matplotlib. Monte Carlo validation additionally requires pennylane and jax. tqdm is optional for progress bars.
Single exact covariance run:
python exact_covariance_twirled.py \
--out_dir outputs/exact_twirled/C18_n6_L1_d4 \
--ansatz CIRCUIT_18 --n_qubits 6 --n_layers 1 --train_depth 4 \
--encoder_axis RX --obs_kind OZ --max_states 20000000 --progressBatch covariance/correlation run:
python twirled_correlation_matrices_compute.py \
--out_dir outputs/twirled_covariance/C18_n6_d1-4 \
--ansatz CIRCUIT_18 --n_qubits_list 6 --train_depth_list 1 2 3 4 \
--n_layers 1 --encoder_axis RX --obs_kind OZ --max_omega 6 \
--n_theta_samples 4096 --batch_size 64 --progressCorrelation plots:
python twirled_correlation_matrices_plot.py \
--indir outputs/twirled_covariance/C18_n6_d1-4 \
--outdir outputs/figures/C18_n6_d1-4/correlation_heatmapsVariance profiles:
python twirled_variance_profile_plot.py \
--indir outputs/twirled_covariance/C18_n6_d1-4 \
--outdir outputs/figures/C18_n6_d1-4/variance_profiles \
--mode relmaxGUI:
python experiment_gui.py