I am trying to build the Grover circuit using the IBM Quantum Composer circuit composer. The Grover example has a CZ gate. I can't find that gate in circuit composer.
2 Answers
There is no Controlled-Z in the circuit composer by default because this gate can be built from CNOT ($CX$) and Hadamard gate $H$. This is because we have the identity $$ Z = HXH$$ This implies that $CZ$ can be constructed as:
Now, in the qiskit composer, there is a button + Add that allows you to add this gate operation as a pre-defined gate and you can named it as CZ gate.
-
$\begingroup$ This is very helpful, thank you. The only downside I see is that the icon for the gate I add does not show the connection to the other qubit, only a box on line for one qubit. The cz gate for the Grover example shows a connection to both qubits.I am not sure how they did that. Are you allowed to design your own icons? $\endgroup$– PeteCommented Feb 5, 2021 at 20:52
Not sure how it was in 2021, currently (Oct 2022) the way to create a CZ gate in the IBM Quantum Composer is:
- Add a Z gate
- Edit it
Add control
- You can change the control and target qubit from the menu.