Implementation code for "Efficient Circuits for Leaf-Separable State Preparation", developed as part of the REU 2025 program at the University of Tennessee, Knoxville, Industrial and Systems Engineering Department.
Authors: Sunil Vittal, Anthony Wilkie, Nika Rastegari, Mostafa Atallah, Rebekah Herrman
Quantum algorithms for efficient state preparation using the Weight Distribution Blocks (WDB) framework:
-
WDB Algorithm - Hierarchically decomposes state preparation using partition trees (leaf size ≤ k), WDB amplitude computation, controlled addition, and HW-K leaf encoding. Uses ~(n/k) ancilla qubits with lower circuit depth.
-
Ancilla-Free WDB - Space-optimized variant without auxiliary qubits, achieving zero ancilla overhead with slightly higher gate depth.
-
HW-K Encoder - Prepares fixed Hamming weight states using Ehrlich ordering and Reconfigurable Beam-Splitter (RBS) gates for leaf-level state preparation.
-
Leaf-Separable States - States expressible as |ψ⟩ = Σᵢ Aᵢ |ψᵢ⟩ where each |ψᵢ⟩ = ⊗ⱼ |φᵢⱼ⟩ over leaf partitions. Includes generation and verification tools.
Performance: Tested for 4-15 qubits, partition sizes 2-8 | Built with: PennyLane | Developed on: Windows 11, Python 3.12
Note This code generates target states with only real amplitudes. Refer to "Efficient Circuits for Leaf-Separable State Preparation" for the concepts behind using this approach for complex amplitudes.
state-prep-reu2025/
├── src/
│ ├── core/
│ │ ├── wdb_algorithm.py # Weight Distribution Blocks core implementation
│ │ ├── ancilla_free_wdb.py # Ancilla-free WDB variant
│ │ ├── hw_k_encoder.py # Hamming Weight-K encoding for leaf nodes
│ │ ├── leaf_state_generator.py # Leaf-separable state generation
│ │ └── state_prep_pipeline.py # Complete state preparation pipeline
│ └── utils/
│ ├── basis_states.py # Basis state utilities and Ehrlich ordering
│ └── gate_counting.py # Gate counting and analysis utilities
├── scripts/
│ ├── fidelity_analysis_pipeline.py # Fidelity analysis for different algorithms
│ ├── generate_gate_count_data.py # Gate count data generation
│ └── plot_analysis_results.py # Visualization of analysis results
├── data/ # Generated data and plots
├── requirements.txt # Python dependencies
└── README.md # This file
Prerequisites: Python 3.10+
# Clone and setup
git clone https://github.com/your-repo/state-prep-reu2025.git
cd state-prep-reu2025
# Create virtual environment
python -m venv venv
# Activate (Windows: venv\Scripts\activate | Linux/macOS: source venv/bin/activate)
venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtRun WDB Algorithm:
python -m src.core.state_prep_pipelineRun Ancilla-Free WDB:
python -m src.core.ancilla_free_wdbProgrammatic Usage:
from src.core.state_prep_pipeline import algorithm
from src.core.wdb_algorithm import build_partition_tree
# Run algorithm (n qubits, k partition size, ell max Hamming weight)
gate_counts = algorithm(n=4, k=2, ell=2, complex=False)
# Build partition tree
partition_tree = build_partition_tree(qubits=list(range(8)), k=4)# Generate gate count data
python -m scripts.generate_gate_count_data
# Create visualization plots
python -m scripts.plot_analysis_results
# Run fidelity analysis
python -m scripts.fidelity_analysis_pipelineOutputs saved to data/gate_counts/ and data/plots/.
- Hardcoded test amplitudes (state_prep_pipeline.py:105) - Uses specific 4-qubit state; should use
generate_leaf_separable_statefor dynamic generation
@software{state_prep_reu2025,
title = {Efficient Circuits for Leaf-Separable State Preparation},
author = {Vittal, Sunil and Wilkie, Anthony and Rastegari, Nika and
Atallah, Mostafa and Herrman, Rebekah},
year = {2025},
institution = {University of Tennessee, Knoxville},
department = {Industrial and Systems Engineering}
}Research conducted as part of the NSF REU (NSF CNS-2244512) 2025 program at UTK ISE Department. Special thanks to the research team and NSF REU Program.
For questions or collaboration: matalla3@vols.utk.edu