Quantum Computing Asked by Hirokoudai on February 15, 2021
I asked about decomposition gate of CCRY last week, and the answer was:
However, I now also want to do this for CCCRY. Please someone tell me.
There is an automatic way to design a gate, utilizing qiskit
. When drawing the figure of a quantum, you can use the code circ.decompose().draw()
to show a decomposed circuit.
Code first:
from qiskit import QuantumCircuit,QuantumRegister
from qiskit.circuit.library.standard_gates import RYGate
from qiskit.circuit import Parameter
import matplotlib.pyplot as plt
qr=QuantumRegister(4)
circ=QuantumCircuit(qr)
a=Parameter('a') # You can replace a with theta here
CCCRY=RYGate(a).control(3)
circ.append(CCCRY,qr)
circ.decompose().draw('mpl')
plt.show()
And this gives the following decomposition:
In this figure, $U_3(theta,phi,lambda)=RZ(phi)RX(-pi/2)RZ(theta)RX(pi/2)RZ(lambda)$, so $U_3(theta,0,0)=RY(theta)$.
Answered by Yitian Wang on February 15, 2021
You can use the same trick by replacing $RY(theta)$ by $CRY(theta)$ i.e
$$ CCCRY = CC(CRY) $$
Then you can continue the simplification process till you find an excutable circuit.
Answered by Appo on February 15, 2021
In general, you can design $n$-controlled $U$ gate, $CCCcdots CU = C^{n}U $, using the technique from Mike and Ike on page 184, starting with
where
and here your $Controlled-U$ is $CR_y$ which is
Answered by KAJ226 on February 15, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP