142 lines
3.7 KiB
Plaintext
142 lines
3.7 KiB
Plaintext
---
|
||
title: SXGate
|
||
description: API reference for qiskit.circuit.library.SXGate
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.circuit.library.SXGate
|
||
---
|
||
|
||
# SXGate
|
||
|
||
<Class id="qiskit.circuit.library.SXGate" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.25/qiskit/circuit/library/standard_gates/sx.py" signature="qiskit.circuit.library.SXGate(label=None)" modifiers="class">
|
||
Bases: [`Gate`](qiskit.circuit.Gate "qiskit.circuit.gate.Gate")
|
||
|
||
The single-qubit Sqrt(X) gate ($\sqrt{X}$).
|
||
|
||
Can be applied to a [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") with the [`sx()`](qiskit.circuit.QuantumCircuit#sx "qiskit.circuit.QuantumCircuit.sx") method.
|
||
|
||
**Matrix Representation:**
|
||
|
||
$$
|
||
\begin{split}\sqrt{X} = \frac{1}{2} \begin{pmatrix}
|
||
1 + i & 1 - i \\
|
||
1 - i & 1 + i
|
||
\end{pmatrix}\end{split}
|
||
$$
|
||
|
||
**Circuit symbol:**
|
||
|
||
```python
|
||
┌────┐
|
||
q_0: ┤ √X ├
|
||
└────┘
|
||
```
|
||
|
||
<Admonition title="Note" type="note">
|
||
A global phase difference exists between the definitions of $RX(\pi/2)$ and $\sqrt{X}$.
|
||
|
||
$$
|
||
\begin{split}RX(\pi/2) = \frac{1}{\sqrt{2}} \begin{pmatrix}
|
||
1 & -i \\
|
||
-i & 1
|
||
\end{pmatrix}
|
||
= e^{-i \pi/4} \sqrt{X}\end{split}
|
||
$$
|
||
</Admonition>
|
||
|
||
Create new SX gate.
|
||
|
||
## Attributes
|
||
|
||
### condition\_bits
|
||
|
||
<Attribute id="qiskit.circuit.library.SXGate.condition_bits">
|
||
Get Clbits in condition.
|
||
</Attribute>
|
||
|
||
### decompositions
|
||
|
||
<Attribute id="qiskit.circuit.library.SXGate.decompositions">
|
||
Get the decompositions of the instruction from the SessionEquivalenceLibrary.
|
||
</Attribute>
|
||
|
||
### definition
|
||
|
||
<Attribute id="qiskit.circuit.library.SXGate.definition">
|
||
Return definition in terms of other basic gates.
|
||
</Attribute>
|
||
|
||
### duration
|
||
|
||
<Attribute id="qiskit.circuit.library.SXGate.duration">
|
||
Get the duration.
|
||
</Attribute>
|
||
|
||
### label
|
||
|
||
<Attribute id="qiskit.circuit.library.SXGate.label">
|
||
Return instruction label
|
||
</Attribute>
|
||
|
||
### name
|
||
|
||
<Attribute id="qiskit.circuit.library.SXGate.name">
|
||
Return the name.
|
||
</Attribute>
|
||
|
||
### num\_clbits
|
||
|
||
<Attribute id="qiskit.circuit.library.SXGate.num_clbits">
|
||
Return the number of clbits.
|
||
</Attribute>
|
||
|
||
### num\_qubits
|
||
|
||
<Attribute id="qiskit.circuit.library.SXGate.num_qubits">
|
||
Return the number of qubits.
|
||
</Attribute>
|
||
|
||
### params
|
||
|
||
<Attribute id="qiskit.circuit.library.SXGate.params">
|
||
return instruction params.
|
||
</Attribute>
|
||
|
||
### unit
|
||
|
||
<Attribute id="qiskit.circuit.library.SXGate.unit">
|
||
Get the time unit of duration.
|
||
</Attribute>
|
||
|
||
## Methods
|
||
|
||
### control
|
||
|
||
<Function id="qiskit.circuit.library.SXGate.control" signature="control(num_ctrl_qubits=1, label=None, ctrl_state=None)">
|
||
Return a (multi-)controlled-SX gate.
|
||
|
||
One control returns a CSX gate.
|
||
|
||
**Parameters**
|
||
|
||
* **num\_ctrl\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) – number of control qubits.
|
||
* **label** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)") *or None*) – An optional label for the gate \[Default: None]
|
||
* **ctrl\_state** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)") *or*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)") *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.SXGate.inverse" signature="inverse()">
|
||
Return inverse SX gate (i.e. SXdg).
|
||
</Function>
|
||
</Class>
|
||
|