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

Adam Glos¹ ² ³

Özlem Salehi¹ ³

¹Institute of Theoretical and Applied Informatics, Polish Academy of Sciences
²Algorithmiq Ltd
³QWorld Association

Meet the Interns

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

NOT Gate

CNOT Gate

Toffoli Gate

5 Controlled

Toffoli Gate

What is MCT?

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)
N(n)=2(N(\lceil\frac{n}{2}\rceil)+N(\lfloor\frac{n}{2}\rfloor+1))\\\text{ with }N(3)=14,N(4)=18

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.

Features

  • make_mct
  • generate_mct_cases
  • ...

qumcat

features: make_mct

QUMCAT

Linear Depth

Log Depth

No Ancilla

Variable Ancilla

control

ancilla

target

Features: generate_mct_cases

\tilde{U} U_{MCT}^\dagger - I = 0 \Leftrightarrow \tilde{U} = U_{MCT}

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

\tilde{U} U_{MCT}^\dagger \cdot \overline{[\tilde{U} U_{MCT}^\dagger]_{00}} - I = 0

to remove the global phase

| \tilde{U} | U_{MCT}^\dagger - I = 0

absolute here is applied element-wisely

example of MCT with 2 controls

example of Relative-phase MCT with 2 controls

\tilde{U} U_{MCT}^\dagger - I = 0 \Leftrightarrow \tilde{U} = U_{MCT}

Testing - Clean ancilla

MCT

Relative-phase MCT

\tilde{U}' = (I_{C,T} \otimes \langle 0_A|) \tilde{U} (I_{C,T} \otimes |0_A\rangle)
\tilde{U}' U_{MCT}^\dagger \cdot \overline{[\tilde{U}' U_{MCT}^\dagger]_{00}} - I = 0
| \tilde{U}' | U_{MCT}^\dagger - I = 0

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.

\tilde{U} U_{MCT}^\dagger - I = 0 \Leftrightarrow \tilde{U} = U_{MCT}

Testing - dirty ancilla

\tilde{U} (U_{MCT}^\dagger \otimes I_A ) \cdot \overline{[\tilde{U} (U_{MCT}^\dagger \otimes I_A )]_{00}} - I = 0

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

\tilde{U} U_{MCT}^\dagger - I = 0 \Leftrightarrow \tilde{U} = U_{MCT}

Testing - dirty ancilla

Relative-phase MCT

( (\tilde{D}^R)^\dagger \otimes I_A ) \tilde{U} (U_{MCT}^\dagger \otimes I_A ) - I = 0
\tilde{D}^R = (I_{C,T} \otimes \langle 0|_A) \tilde{U} (U_{MCT} \otimes I_A) (I_{C,T} \otimes |0 \rangle_A)
\tilde{U} (U_{MCT}^\dagger \otimes I_A ) - D^R \otimes I_A = 0
U_{MCT}^R = D^RU_{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:

\tilde{U} U_{MCT}^\dagger - I = 0 \Leftrightarrow \tilde{U} = U_{MCT}

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)

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