Skip to content

qcpolimi/SparseSDAnsatz

Repository files navigation

Sparse SD Ansatz

Minimal codebase to optimize SNAP-displacement (SD) ansatzes for qudit state preparation.

The repository includes:

  • SD ansatz implementations,
  • sparse SD variants,
  • Optuna-based hyperparameter search,
  • noiseless and photon-loss simulations.

Installation

This project uses Python 3.10.

The recommended setup is with conda using the provided environment file:

conda env create -f environment.yml
conda activate SparseSDAnsatz

Main dependencies

The environment includes the main packages used by the project:

  • PyTorch
  • NumPy
  • SciPy
  • pandas
  • scikit-learn
  • matplotlib
  • Optuna
  • scikit-optimize
  • tqdm
  • networkx

Usage

The main entry point for running an optimization is:

python run_optuna_vectorized.py

Experiment settings such as target state, dimension, number of bumper levels, and optimization parameters can be edited directly in run_optuna_vectorized.py.

Repository structure

.
├── environment.yml
├── README.md
├── run_optuna_vectorized.py      # main script to launch Optuna experiments
├── optuna_study.py               # Optuna objective and experiment setup
├── train_gradient_based.py       # gradient-based training loop
├── function_generator.py         # helper utilities for generated targets
├── generate_target_states.py     # target-state generation / loading
│
├── quantum_circuit/
│   ├── ansatz_SD.py              # SD ansatz implementation
│   ├── ansatz_SD_sparse_batch.py # sparse SD ansatzes
│   ├── qudit_gates.py            # qudit operators and gate definitions
│   ├── photon_loss.py            # photon-loss noise channels
│   └── fidelities_leakage.py     # fidelity and leakage metrics
│
└── utils/
    ├── DataIO.py
    ├── load_save_checkpoint.py
    ├── parameter_encoding.py
    ├── parameter_encoding_unbounded.py
    ├── seconds_to_biggest_unit.py
    └── utils_quantum.py

Notes

  • Results are saved in the output folder defined by the experiment configuration.
  • The example configuration in run_optuna_vectorized.py can be used as a starting point for new experiments.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages