This project involves approximating the Toffoli gate using five 2-qubit gates. The optimization process is carried out using the QGOpt optimizer to achieve a precise approximation.
To approximate the Toffoli gate, the following steps were taken:
- Initialization: Five 2-qubit matrices were initialized.
- Target Definition: The Toffoli gate was defined as the target for the optimization.
- Optimization: The QGOpt optimizer was run for 500 iterations to minimize the Hilbert-Schmidt distance between the target gate and the approximation.
The optimization process yielded the following results:
- Minimum Hilbert-Schmidt Distance: 0.3826834323650892
- Optimization Process: The optimization loop was visualized, showing the error versus iteration plot, which helped in analyzing the convergence of the optimizer.
- The optimizer used for this project is QGOpt. More information can be found in the QGOpt documentation.
- Target Gate: The Toffoli gate was set as the target for the optimization.
- Initialization: Five 2-qubit unitaries were initialized.
- Optimization Loop: The loop ran for 500 iterations, and the error versus iteration plot was generated.
- Results: The minimum Hilbert-Schmidt distance was recorded, and the optimization results were visualized.
- Python 3.6 or higher
- Jupyter Notebook
- QGOpt
-
Clone the repository:
git clone https://github.com/ArshMalik02/toffoli-approximation.git cd toffoli-approximation
-
Install the required packages:
pip install qgopt
-
Start Jupyter Notebook:
jupyter notebook
-
Open the
approx_toffoli.ipynb
notebook from the Jupyter interface.
Run the cells in the approx_toffoli.ipynb
notebook to see the implementation and results of the Toffoli gate approximation.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
- Special thanks to the developers of QGOpt for providing a robust optimization tool.