qiskit-documentation/docs/api/qiskit/0.33/qiskit.circuit.library.UGat...

136 lines
3.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: UGate
description: API reference for qiskit.circuit.library.UGate
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.circuit.library.UGate
---
# UGate
<Class id="qiskit.circuit.library.UGate" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.19/qiskit/circuit/library/standard_gates/u.py" signature="UGate(theta, phi, lam, label=None)" modifiers="class">
Bases: `qiskit.circuit.gate.Gate`
Generic single-qubit rotation gate with 3 Euler angles.
Implemented using two X90 pulses on IBM Quantum systems:
$$
U(\theta, \phi, \lambda) =
RZ(\phi - \pi/2) RX(\pi/2) RZ(\pi - \theta) RX(\pi/2) RZ(\lambda - \pi/2)
$$
**Circuit symbol:**
```python
┌──────────┐
q_0: ┤ U(ϴ,φ,λ) ├
└──────────┘
```
**Matrix Representation:**
$$
\begin{align}\begin{aligned}\newcommand{\th}{\frac{\theta}{2}}\\\begin{split}U(\theta, \phi, \lambda) =
\begin{pmatrix}
\cos(\th) & -e^{i\lambda}\sin(\th) \\
e^{i\phi}\sin(\th) & e^{i(\phi+\lambda)}\cos(\th)
\end{pmatrix}\end{split}\end{aligned}\end{align}
$$
**Examples:**
$$
U\left(\theta, -\frac{\pi}{2}, \frac{\pi}{2}\right) = RX(\theta)
$$
$$
U(\theta, 0, 0) = RY(\theta)
$$
Create new U gate.
## Methods Defined Here
### control
<Function id="qiskit.circuit.library.UGate.control" signature="UGate.control(num_ctrl_qubits=1, label=None, ctrl_state=None)">
Return a (multi-)controlled-U 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.UGate.inverse" signature="UGate.inverse()">
Return inverted U gate.
$U(\theta,\phi,\lambda)^{\dagger} =U(-\theta,-\lambda,-\phi)$)
</Function>
## Attributes
### condition\_bits
<Attribute id="qiskit.circuit.library.UGate.condition_bits">
Get Clbits in condition.
**Return type**
`List`\[`Clbit`]
</Attribute>
### decompositions
<Attribute id="qiskit.circuit.library.UGate.decompositions">
Get the decompositions of the instruction from the SessionEquivalenceLibrary.
</Attribute>
### definition
<Attribute id="qiskit.circuit.library.UGate.definition">
Return definition in terms of other basic gates.
</Attribute>
### duration
<Attribute id="qiskit.circuit.library.UGate.duration">
Get the duration.
</Attribute>
### label
<Attribute id="qiskit.circuit.library.UGate.label">
Return instruction label
**Return type**
`str`
</Attribute>
### params
<Attribute id="qiskit.circuit.library.UGate.params">
return instruction params.
</Attribute>
### unit
<Attribute id="qiskit.circuit.library.UGate.unit">
Get the time unit of duration.
</Attribute>
</Class>