Research code and exploratory notebooks for neural quantum states, matrix-product states, conditional mutual information (CMI), and one-dimensional quantum spin models.
The main focus is the rotated 1D cluster-state family, with the transverse-field Ising model (TFIM) used as a reference problem. This is the code behind my M.Sc. research at the University of Waterloo and Perimeter Institute; a manuscript is in preparation.
Measure every qubit of the 1D cluster state in a basis rotated by an angle
The CMI is exactly zero in the cluster_mps_cmi_length_scan.py, which computes the probabilities exactly from the bond-dimension-2 MPS, with no sampling:
python scripts/cluster_state/cluster_mps_cmi_length_scan.py --max-m 12 --n-theta 31 --fit-max 10nqs_project/
├── README.md
├── LICENSE
├── requirements.txt
├── CITATION.cff
├── docs/ # figures used in this README
├── tests/ # pytest checks for the CMI script
├── notebooks/
│ ├── cluster_state/
│ │ ├── mbqc.ipynb
│ │ ├── rcs_mps_dmrg.ipynb
│ │ └── netket_rbm_exploratory.ipynb
│ └── tfim/
│ └── tfim_rnn_vmc.ipynb
└── scripts/
└── cluster_state/
├── cluster_mps_cmi_length_scan.py
└── hes_mps_cmi_length.py
mbqc.ipynb— small PennyLane/NetworkX exploration of cluster states and rotated-basis measurement probabilities.rcs_mps_dmrg.ipynb— MPS/DMRG calculations for the rotated cluster-state Hamiltonian using TeNPy.netket_rbm_exploratory.ipynb— exploratory NetKet RBM/VMC calculations together with exact-diagonalization and CMI diagnostics.
tfim_rnn_vmc.ipynb— exact diagonalization, measurement distributions, CMI, autoregressive RNN learning, and an RNN-VMC prototype for the 1D TFIM.
cluster_mps_cmi_length_scan.py— exact bond-dimension-2 cluster-state MPS calculation of CMI decay versus measurement angle.hes_mps_cmi_length.py— exact MPS calculation of endpoint/local CMI for the entanglement-swapping stabilizer Hamiltonian.
The two scripts need only NumPy and Matplotlib. The notebooks need the full stack in requirements.txt (NetKet, JAX, PyTorch, TeNPy, PennyLane).
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt # or: pip install numpy matplotlib pytestThen start JupyterLab:
jupyter labpython scripts/cluster_state/cluster_mps_cmi_length_scan.py --max-m 12 --n-theta 21
python scripts/cluster_state/hes_mps_cmi_length.py --mode endpoint --max-m 18 --n-theta 16pytest testsThe tests compare the transfer-matrix probabilities and CMI with a brute-force state-vector calculation on an explicit chain (agreement to 1e-12), and check normalization and the vanishing CMI in the
Generated CSV/PNG outputs are intentionally excluded from Git by .gitignore so that the repository stays code-focused.
The notebooks are exploratory research records rather than a stable Python package. The standalone scripts are the cleaner entry points for reproducible CMI calculations.
If this code is useful to you, please cite it using CITATION.cff.
