Question: impiement the function create _ multi _ control _ U ( qc , b , r , ancilla, control _ u _ gate ) with
impiement the function createmulticontrolUqc b r ancilla, controlugate with inputs:
qc : a handle to a QuantumCircuit
b : a quantum register with n lenb control qubits
r : a single result qubit
ancilla : a quantum register with mathrmn ancillary qubits
controlugate : a reference to a function that when called as controlugateqc ctrlqubit, resqubit will implement the controlledU gate with the specified control qubit operating on the result qubit.
Your circuit can use only the specified gates and must ensure that the ancillary qubits are all transformed back to rangle
In :
# your code here
raise NotImplementedError
In : from numpy import pi
from qiskit import QuantumCircuit, QuantumRegister, execute
from qiskit.providers.aer import Aer
def controlphasegateqc ctrl res:
qccppi ctrl res
b QuantumRegisterb
r QuantumRegisterr
a QuantumRegistera
qc QuantumCircuit r b a
qchb
qchr
createmulticontrolUqc br a controlphasegate
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
