# CZ Gate

The CZ gate (or CPhase gate) is two-qubit operation defined as:

$\ CZ = \begin{pmatrix} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 0 & -1 \end{pmatrix}$

Note: For multi-qubit gates, it must always be checked whether the topology (connectivity) allows for a direct implementation of the operation. A compilation step may be required in order to map an operation.

As an example, on the Starmon-5 backend q[0] and q[1] are not connected. An operation such as cz q[0],q[1] should therefore be rewritten as cz q[0],q[2] or compiled by inserting swap gates, when the intended operation is indeed a a cz between q[0] and q[1].