Resource-tailored multi-controlled NOT implementation
Mentors: Adam Glos, Özlem Salehi
Mentors: Adam Glos, Özlem Salehi
Interns: Shraddha Aangiras, Ankit Khandelwal, Handy Kurniawan, Maha Haj Meftah, Rutvij Menavlikar, Owais Ishtiaq Siddiqui
Mentors
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9787435/adam.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9787434/ozlem.jpg)
Adam Glos¹ ² ³
Özlem Salehi¹ ³
¹Institute of Theoretical and Applied Informatics, Polish Academy of Sciences
²Algorithmiq Ltd
³QWorld Association
Meet the Interns
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9792544/maha.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9788094/rutvi.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9787433/handy.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9787476/owais.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9788075/anki.jpeg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9787477/shrad.jpg)
Handy Kurniawan
University of Tartu
Ankit Khandelwal
Indian Institute of Science
maha haj meftah
University of Carthage
shraddha aangiras
RU PV College
Owais Siddiqui
COMSATS University Islamabad
Rutvij Menavlikar
IIIT Hyderabad
Index
What is MCT?
MCT stands for Multi Controlled Toffoli
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9786661/myplot.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9786661/myplot.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9786661/myplot.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9786661/myplot.png)
NOT Gate
CNOT Gate
Toffoli Gate
5 Controlled
Toffoli Gate
What is MCT?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2204417/images/9787393/1920px-Qcircuit_ToffolifromCNOT.svg.png)
Toffoli Gate and its Decomposition
- MCT is a very common gate used in various algorithms.
- Various decompositions are given in the literature but are not readily available to the end user.
- Only a few implementations exist in quantum computing libraries, but these do not account for the user's resources.
Motivation
Create a python library that chooses the best implementation given the number of controls and the specified resources.
- We considered ~25 papers to look at various decompositions present in the literature.
- Different decompositions focus on different resources like T gate count, CNOT count, total gate count, circuit depth, T gate depth and ancilla qubit count.
- Different decompositions also use different basis gates like Clifford+T, NCV, NCVW etc.
Literature Review
We have created a concise summary of most of the papers we considered.
Literature RevieW Cont.
We also looked at various implementations present in quantum computing libraries like Qiskit, Pennylane, Pyquil, Cirq, etc.
Library | Method | Control Qubits | Ancilla Qubits |
Cost |
---|---|---|---|---|
Qiskit | Recursive | n | 1 |
|
V-chain | n | n-2 | 6n-6 | |
V-chain dirty | n | n-2 | 12n-22 | |
No ancilla | 5, 6, 7 | 0, 0, 0 | 92, 188, 764 | |
Cirq | Decompose multi controlled X | 5, 6, 7 | 3, 4, 5 (two less than control qubits) | 37, 54, 120 |
Pennylane | Split and V-chain | n | 1 | 48(n-3) |
Pyquil uses block encoding of matrices to implement complex gates like MCX.
- Most implementations present in libraries are based on Elementary gates for quantum computation¹.
- There are better decompositions available depending on resource requirements but are not implemented.
- Linear depth decompositions are known but have not been implemented.
- Huge resource savings are possible.
Findings
¹Barenco, A., Bennett, C., Cleve, R., DiVincenzo, D., Margolus, N., Shor, P., Sleator, T., Smolin, J., & Weinfurter, H. (1995). Elementary gates for quantum computation. Phys. Rev. A, 52, 3457–3467.
Qumcat
Quantum Multi Controlled Not Automated Toolkit (QUMCAT) is a python library to provide the best implementation for an MCT gate given the number of controls and available resources like depth, count or ancilla qubits.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2027332/images/9797019/pasted-from-clipboard.png)
Features
- make_mct
- generate_mct_cases
- ...
qumcat
features: make_mct
QUMCAT
Linear Depth
Log Depth
No Ancilla
Variable Ancilla
control
ancilla
target
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2027332/images/9795530/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2027332/images/9795532/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2027332/images/9792205/pasted-from-clipboard.png)
Features: generate_mct_cases
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2027332/images/9795205/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2027332/images/9795209/pasted-from-clipboard.png)
Unitary matrix from Qiskit MCT implementation of 'noancilla'
Unitary matrix from qumcat implementation
testing
- No ancilla
- Clean ancilla
- Dirty ancilla
- Clean-wasted ancilla
method
Testing - No Ancilla
MCT
Relative-phase MCT
to remove the global phase
absolute here is applied element-wisely
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2027332/images/9789524/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2027332/images/9789525/pasted-from-clipboard.png)
example of MCT with 2 controls
example of Relative-phase MCT with 2 controls
Testing - Clean ancilla
MCT
Relative-phase MCT
The projection is needed since we are only interested in the control + target qubit conditioned ancilla enters and leaves at \(|0_A\rangle\)
then the new unitary matrix is tested with the same procedure as 'noancilla'
Ancilla qubits should be initialized as all-zero state and remain the same after the application of MCT.
Testing - dirty ancilla
Ancilla qubits are arbitrary states, but the state is left "the same" after the application of MCT, i.e., applying Identity Gate
In MCT case, the generated unitary matrix is "the same" as tensoring 'no ancilla' unitary matrix with the identity matrix
MCT
Testing - dirty ancilla
Relative-phase MCT
Any relative-phase Toffoli can be written as
Since \(\tilde{U}\) should act trivially on ancilla, and with \(U^R_{MCT}\) on the controls and target, the test should take the form
diagonal unitary matrix
for some \(D^R\). Then construct the following operator:
After constructing the operator, the testing for relative-phase Toffoli takes this form:
Testing - clean-wasted ancilla
5
Test
4
Implement
6
Launch v0.1
Planned Work
1
Conception
3
Prioritize decompositions
2
Literature Review
7
Paper
A.G. has been partially supported by National Science Center under grant agreements 2019/33/B/ST6/02011, and 2020/37/N/ST6/02220. O.S. acknowledges support from National Science Center under grant agreement 2019/33/B/ST6/02011. We also thank Ryszard Kukulski for valuable discussions.
References
Acknoledgements
Barenco, A., Bennett, C., Cleve, R., DiVincenzo, D., Margolus, N., Shor, P., Sleator, T., Smolin, J., & Weinfurter, H. (1995). Elementary gates for quantum computation. Phys. Rev. A, 52, 3457–3467.
Thank You
- Linear depth (1-auxiliary)
- Log depth ([n-2]-auxiliary)
- No auxiliary
- Variable auxiliary
- many more...
Implementations
- No ancilla
- Clean ancilla
- Dirty ancilla
- Clean-wasted ancilla
Testing
Features
Literature RevieW Cont.
A short summary of some of the papers whose decompositions were optimal.
Paper | Section | Control Qubits | Ancilla Qubits | Gate Cost |
---|---|---|---|---|
Barenco et al. | Corollary 7.4 | n | 1 | 48(n-3) |
Balauca et al. | 4.1 (One clean ancilla) | n | 1 (clean ancilla) | 8(4n-13) |
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2176091/images/9794633/pasted-from-clipboard.png)
A graph representing gate cost for single ancilla decomposition methods used by Barenco et al., Balauca et al. and qiskit:
Copy of P19
By Shraddha Shankar Aangiras
Copy of P19
- 24