157 lines
3.3 KiB
Plaintext
157 lines
3.3 KiB
Plaintext
---
|
||
title: ZGate
|
||
description: API reference for qiskit.circuit.library.ZGate
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.circuit.library.ZGate
|
||
---
|
||
|
||
# ZGate
|
||
|
||
<Class id="qiskit.circuit.library.ZGate" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.20/qiskit/circuit/library/standard_gates/z.py" signature="ZGate(label=None)" modifiers="class">
|
||
Bases: `qiskit.circuit.gate.Gate`
|
||
|
||
The single-qubit Pauli-Z gate ($\sigma_z$).
|
||
|
||
**Matrix Representation:**
|
||
|
||
$$
|
||
\begin{split}Z = \begin{pmatrix}
|
||
1 & 0 \\
|
||
0 & -1
|
||
\end{pmatrix}\end{split}
|
||
$$
|
||
|
||
**Circuit symbol:**
|
||
|
||
```python
|
||
┌───┐
|
||
q_0: ┤ Z ├
|
||
└───┘
|
||
```
|
||
|
||
Equivalent to a $\pi$ radian rotation about the Z axis.
|
||
|
||
<Admonition title="Note" type="note">
|
||
A global phase difference exists between the definitions of $RZ(\pi)$ and $Z$.
|
||
|
||
$$
|
||
\begin{split}RZ(\pi) = \begin{pmatrix}
|
||
-1 & 0 \\
|
||
0 & 1
|
||
\end{pmatrix}
|
||
= -Z\end{split}
|
||
$$
|
||
</Admonition>
|
||
|
||
The gate is equivalent to a phase flip.
|
||
|
||
$$
|
||
\begin{split}|0\rangle \rightarrow |0\rangle \\
|
||
|1\rangle \rightarrow -|1\rangle\end{split}
|
||
$$
|
||
|
||
Create new Z gate.
|
||
|
||
## Methods Defined Here
|
||
|
||
### control
|
||
|
||
<Function id="qiskit.circuit.library.ZGate.control" signature="ZGate.control(num_ctrl_qubits=1, label=None, ctrl_state=None)">
|
||
Return a (multi-)controlled-Z gate.
|
||
|
||
One control returns a CZ gate.
|
||
|
||
**Parameters**
|
||
|
||
* **num\_ctrl\_qubits** (*int*) – number of control qubits.
|
||
* **label** (*str or None*) – An optional label for the gate \[Default: None]
|
||
* **ctrl\_state** (*int or str or None*) – control state expressed as integer, string (e.g. ‘110’), or None. If None, use all 1s.
|
||
|
||
**Returns**
|
||
|
||
controlled version of this gate.
|
||
|
||
**Return type**
|
||
|
||
[ControlledGate](qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate")
|
||
</Function>
|
||
|
||
### inverse
|
||
|
||
<Function id="qiskit.circuit.library.ZGate.inverse" signature="ZGate.inverse()">
|
||
Return inverted Z gate (itself).
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### condition\_bits
|
||
|
||
<Attribute id="qiskit.circuit.library.ZGate.condition_bits">
|
||
Get Clbits in condition.
|
||
|
||
**Return type**
|
||
|
||
`List`\[`Clbit`]
|
||
</Attribute>
|
||
|
||
### decompositions
|
||
|
||
<Attribute id="qiskit.circuit.library.ZGate.decompositions">
|
||
Get the decompositions of the instruction from the SessionEquivalenceLibrary.
|
||
</Attribute>
|
||
|
||
### definition
|
||
|
||
<Attribute id="qiskit.circuit.library.ZGate.definition">
|
||
Return definition in terms of other basic gates.
|
||
</Attribute>
|
||
|
||
### duration
|
||
|
||
<Attribute id="qiskit.circuit.library.ZGate.duration">
|
||
Get the duration.
|
||
</Attribute>
|
||
|
||
### label
|
||
|
||
<Attribute id="qiskit.circuit.library.ZGate.label">
|
||
Return instruction label
|
||
|
||
**Return type**
|
||
|
||
`str`
|
||
</Attribute>
|
||
|
||
### name
|
||
|
||
<Attribute id="qiskit.circuit.library.ZGate.name">
|
||
Return the name.
|
||
</Attribute>
|
||
|
||
### num\_clbits
|
||
|
||
<Attribute id="qiskit.circuit.library.ZGate.num_clbits">
|
||
Return the number of clbits.
|
||
</Attribute>
|
||
|
||
### num\_qubits
|
||
|
||
<Attribute id="qiskit.circuit.library.ZGate.num_qubits">
|
||
Return the number of qubits.
|
||
</Attribute>
|
||
|
||
### params
|
||
|
||
<Attribute id="qiskit.circuit.library.ZGate.params">
|
||
return instruction params.
|
||
</Attribute>
|
||
|
||
### unit
|
||
|
||
<Attribute id="qiskit.circuit.library.ZGate.unit">
|
||
Get the time unit of duration.
|
||
</Attribute>
|
||
</Class>
|
||
|