ProjectQ-Framework / ProjectQ

ProjectQ: An open source software framework for quantum computing
https://projectq.ch
Apache License 2.0
893 stars 275 forks source link

How to Implement Multi-Controlled X Gate in ProjectQ Like Qiskit's qc.mcx([0, 1, 3], 2)? #478

Closed saifawan2703 closed 3 weeks ago

saifawan2703 commented 1 month ago

Hello ProjectQ Community,

I am transitioning from Qiskit to ProjectQ and I’m trying to replicate a specific operation. In Qiskit, I can use the following code to apply a multi-controlled X gate: qc.mcx([0, 1, 3], 2) I would like to know how to achieve the same functionality in ProjectQ. Is there a built-in function for multi-controlled X gates, or do I need to implement it manually? If manual implementation is required, could someone provide an example?

Thank you for your help!

damiansteiger commented 1 month ago

You can achieve this with a ControlledGate or C(), see https://projectq.readthedocs.io/en/latest/_doc_gen/projectq.ops.html#projectq.ops.ControlledGate