Coder Social home page Coder Social logo

aqc-research's Introduction

Platform Python Qiskit License Code style: Black

Approximate Quantum Compiling for Quantum Simulation

Table of Contents


About This Project

In this project we demonstrate two closely related approaches:

  1. Approximate Quantum Compiling (AQC) aims to find a quantum circuit that approximates the action of some unitary matrix (target). In the folder docs one can find the introductory notebooks. The notebook called problem_and_ansatz.ipynb explains what kind of problem is being solved and what approximating circuit (ansatz) is being used. The AQC computational model is based on papers [1],[2] and implements the method described therein.
  2. Approximate State Preparation (ASP) aims to reduce the depth of Trotter circuit for solving time-evolution problems. Likewise the first case, we optimize an ansatz circuit to reproduce the target quantum states from zero one |0>. The notebook time_evolution.ipynb illustrates the method presented in the papers [3],[4].

How to use

The package can be installed from sources, please refer to the contributing guideline.

Alternatively, on Linux system a quick installation can be done, where we suggest to use virtual environment:

mkdir -p ${HOME}/venv &&
python3 -m venv ${HOME}/venv/aqc &&
source ${HOME}/venv/aqc/bin/activate &&
python3 -m pip install --upgrade pip &&
pip3 install wheel &&
pip3 install qiskit[visualization] psutil joblib black ipython scikit-learn jupyter pylint &&
pip3 cache purge &&
cd /path/to/your/working/directory &&
git clone "https://github.com/qiskit-community/aqc-research.git" &&
echo "all done"

On Mac OS the quotations are needed 'qiskit[visualization]', see in-depth installation guidelines on the Qiskit official web-site.

There are three notebooks demonstrating: (1) the problem formulation for Approximate Quantum Compiling (AQC) "problem_and_ansatz.ipynb", (2) how to find approximate circuit given a target unitary matrix "aqc.ipynb", (3) how to use Approximate State Preparation (ASP) for time-evolution and shortening the circuit depth "time_evolution.ipynb".

If running this notebook without installation, directly from the root folder of the package downloaded from the GitHub, the following bash snippet helps to resolve module paths, for example:

(export PYTHONPATH=`pwd` && echo "Python path: ${PYTHONPATH}" && jupyter notebook docs/problem_and_ansatz.ipynb)

For the large scale problems using notebooks might be cumbersome. In this case, user can run the approbate Python scripts straight on a (remote) powerful computer, see examples below. We encourage to tweak parameters directly in the script, which will be copied into the output directory along with simulation results. It should be always possible to reproduce the result by re-running the saved scripts and user settings.

Time Evolution example

Time evolution module illustrates the method described in [4]. It can be run either from the notebook "time_evolution.ipynb" or directly in terminal using the script run_time_evol.py. The latter script offers an opportunity for changing parameter settings. The class UserOptions in aqc_research/model_sp_lhs/user_options.py contains all tunable user options along with their description.

There are few generic command-line options when running in terminal:

cd /path/to/your/working/directory/
python3 run_time_evol.py -h

options:
  -h, --help            show this help message and exit
  -n , --num_qubits     number of qubits (default: 5)
  -t, --target_only     flag: compute target states and exit (default: False)
  -g , --tag            tag that makes simulation results distinguishable (default: )
  -f , --targets_file   path to a file with precomputed targets (default: )

The majority of the parameters are defined in the class UserOptions and should be tweaked in the launching script run_time_evol.py, according to the example therein, before the start.

Once desired parameters have been set, it is straightforward to run the simulation, for example:

python3 run_time_evol.py --num_qubits 12 --tag test

At first, the target states will be computed or loaded, if already exist. The default path for cached target states is: ./results/trotter_evol. Next, the ansatz circuit will be optimized for several time horizons as described in [4]. In case of default settings, the output results will be stored in the folder: ./results/trotter_evol/12qubits/<Date_Time>_test. The notebook "time_evolution.ipynb" helps to explore the content of that folder.

Lastly, one can choose the rename the script run_time_evol.py to something else to keep the original one intact. Does not matter what the name is, the script will be copied to the output result directory for completeness and reproducibility of numerical experiments.


How to Give Feedback

We encourage your feedback! You can share your thoughts with us by:


Contribution Guidelines

For information on how to contribute to this project, please take a look at CONTRIBUTING.MD.


Acknowledgements

This module is based on the theory and experiment described in [4] and accompanying papers.

The code and tutorials, this module rests on, were written by Albert Akhriev, Niall Robertson and Anton Dekusar. We would like to express the deepest gratitude and appreciation to Merav Aharoni from IBM Research Haifa for the support and guidance regarding Matrix Product State (MPS) package implemented in Qiskit.


References

[1] L. Madden, and A. Simonetto, Best approximate quantum compiling problems, ACM Transactions on Quantum Computing, vol.3, no.2, pp.1-29, 2022, arXiv:2106.05649

[2] L. Madden, A. Akhriev and A. Simonetto, Sketching the Best Approximate Quantum Compiling Problem, 2022 IEEE International Conference on Quantum Computing and Engineering (QCE), arXiv:2205.04025

[3] N.F. Robertson, A. Akhriev, J. Vala, S. Zhuk, Escaping barren plateaus in approximate quantum compiling, arXiv:2210.09191

[4] N.F. Robertson, A. Akhriev, J. Vala, S. Zhuk, Approximate Quantum Compiling for Quantum Simulation: A Tensor Network based approach, arXiv:2301.08609

License

Apache License 2.0

aqc-research's People

Contributors

a-ta-v avatar adekusar-drl avatar 1ucian0 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.