qiskit-documentation/docs/api/qiskit/0.38/qiskit.circuit.library.U3Ga...

151 lines
3.8 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: U3Gate
description: API reference for qiskit.circuit.library.U3Gate
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.circuit.library.U3Gate
---
# U3Gate
<Class id="qiskit.circuit.library.U3Gate" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.21/qiskit/circuit/library/standard_gates/u3.py" signature="U3Gate(theta, phi, lam, label=None)" modifiers="class">
Bases: [`qiskit.circuit.gate.Gate`](qiskit.circuit.Gate "qiskit.circuit.gate.Gate")
Generic single-qubit rotation gate with 3 Euler angles.
**Circuit symbol:**
```python
┌───────────┐
q_0: ┤ U3(ϴ,φ,λ) ├
└───────────┘
```
**Matrix Representation:**
$$
\begin{align}\begin{aligned}\newcommand{\th}{\frac{\theta}{2}}\\\begin{split}U3(\theta, \phi, \lambda) =
\begin{pmatrix}
\cos\left(\th\right) & -e^{i\lambda}\sin\left(\th\right) \\
e^{i\phi}\sin\left(\th\right) & e^{i(\phi+\lambda)}\cos\left(\th\right)
\end{pmatrix}\end{split}\end{aligned}\end{align}
$$
<Admonition title="Note" type="note">
The matrix representation shown here differs from the [OpenQASM 2.0 specification](https://doi.org/10.48550/arXiv.1707.03429) by a global phase of $e^{i(\phi+\lambda)/2}$.
</Admonition>
**Examples:**
$$
U3\left(\theta, -\frac{\pi}{2}, \frac{\pi}{2}\right) = RX(\theta)
$$
$$
U3(\theta, 0, 0) = RY(\theta)
$$
Create new U3 gate.
## Methods Defined Here
### control
<Function id="qiskit.circuit.library.U3Gate.control" signature="U3Gate.control(num_ctrl_qubits=1, label=None, ctrl_state=None)">
Return a (multi-)controlled-U3 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.U3Gate.inverse" signature="U3Gate.inverse()">
Return inverted U3 gate.
$U3(\theta,\phi,\lambda)^{\dagger} =U3(-\theta,-\lambda,-\phi)$)
</Function>
## Attributes
### condition\_bits
<Attribute id="qiskit.circuit.library.U3Gate.condition_bits">
Get Clbits in condition.
**Return type**
`List`\[[`Clbit`](qiskit.circuit.Clbit "qiskit.circuit.classicalregister.Clbit")]
</Attribute>
### decompositions
<Attribute id="qiskit.circuit.library.U3Gate.decompositions">
Get the decompositions of the instruction from the SessionEquivalenceLibrary.
</Attribute>
### definition
<Attribute id="qiskit.circuit.library.U3Gate.definition">
Return definition in terms of other basic gates.
</Attribute>
### duration
<Attribute id="qiskit.circuit.library.U3Gate.duration">
Get the duration.
</Attribute>
### label
<Attribute id="qiskit.circuit.library.U3Gate.label">
Return instruction label
**Return type**
`str`
</Attribute>
### name
<Attribute id="qiskit.circuit.library.U3Gate.name">
Return the name.
</Attribute>
### num\_clbits
<Attribute id="qiskit.circuit.library.U3Gate.num_clbits">
Return the number of clbits.
</Attribute>
### num\_qubits
<Attribute id="qiskit.circuit.library.U3Gate.num_qubits">
Return the number of qubits.
</Attribute>
### params
<Attribute id="qiskit.circuit.library.U3Gate.params">
return instruction params.
</Attribute>
### unit
<Attribute id="qiskit.circuit.library.U3Gate.unit">
Get the time unit of duration.
</Attribute>
</Class>