qiskit-documentation/docs/api/qiskit/0.31/qiskit.circuit.library.HGat...

111 lines
2.6 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: HGate
description: API reference for qiskit.circuit.library.HGate
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.circuit.library.HGate
---
# HGate
<Class id="qiskit.circuit.library.HGate" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.18/qiskit/circuit/library/standard_gates/h.py" signature="HGate(label=None)" modifiers="class">
Bases: `qiskit.circuit.gate.Gate`
Single-qubit Hadamard gate.
This gate is a pi rotation about the X+Z axis, and has the effect of changing computation basis from $|0\rangle,|1\rangle$ to $|+\rangle,|-\rangle$ and vice-versa.
**Circuit symbol:**
```python
┌───┐
q_0: ┤ H ├
└───┘
```
**Matrix Representation:**
$$
\begin{split}H = \frac{1}{\sqrt{2}}
\begin{pmatrix}
1 & 1 \\
1 & -1
\end{pmatrix}\end{split}
$$
Create new H gate.
## Methods Defined Here
### control
<Function id="qiskit.circuit.library.HGate.control" signature="HGate.control(num_ctrl_qubits=1, label=None, ctrl_state=None)">
Return a (multi-)controlled-H gate.
One control qubit returns a CH 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.HGate.inverse" signature="HGate.inverse()">
Return inverted H gate (itself).
</Function>
## Attributes
### decompositions
<Attribute id="qiskit.circuit.library.HGate.decompositions">
Get the decompositions of the instruction from the SessionEquivalenceLibrary.
</Attribute>
### definition
<Attribute id="qiskit.circuit.library.HGate.definition">
Return definition in terms of other basic gates.
</Attribute>
### duration
<Attribute id="qiskit.circuit.library.HGate.duration">
Get the duration.
</Attribute>
### label
<Attribute id="qiskit.circuit.library.HGate.label">
Return instruction label
**Return type**
`str`
</Attribute>
### params
<Attribute id="qiskit.circuit.library.HGate.params">
return instruction params.
</Attribute>
### unit
<Attribute id="qiskit.circuit.library.HGate.unit">
Get the time unit of duration.
</Attribute>
</Class>