Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control on another quantum circuit #165

Closed
francler1 opened this issue Sep 6, 2023 · 2 comments
Closed

Control on another quantum circuit #165

francler1 opened this issue Sep 6, 2023 · 2 comments
Assignees

Comments

@francler1
Copy link

I was wondering if it is possible to create a control between one/more qubits and another quantum circuit. I am looking for something like this

qpp:QCircuit qc1(3);
 
// add some gates to qc1 OR even prepare a state for q1

qpp::QCircuit qc2(3);
qc2.compose( qc1 /*target*/, {0,1,2} /* control */ );

I hope this is understandable. In case, the same thing I am looking for can be obtained in Qiskit with:

qreg = QuantumRegister(3)
 
QuantumCircuit qc1(3)

# add some gates or prepare state in qc1

QuantumCircuit qc2(qreg)
qc2.compose(qc1.control(1), qreg[::], inplace=True)
@vsoftco
Copy link
Member

vsoftco commented Sep 6, 2023

@francler1 Thank you for the suggestion. Currently this function is not (yet) implemented. We are working on implementing it, and will close this issue when ready.

@vsoftco vsoftco self-assigned this Sep 8, 2023
@vsoftco
Copy link
Member

vsoftco commented Jan 10, 2024

@francler1 Done in v5.0 d5bfeb2. See qpp::QCircuit::compose_CTRL_circuit().

@vsoftco vsoftco closed this as completed Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants