137 lines
3.3 KiB
Plaintext
137 lines
3.3 KiB
Plaintext
---
|
||
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.24/qiskit/circuit/library/standard_gates/h.py" signature="HGate(label=None)" modifiers="class">
|
||
Bases: [`Gate`](qiskit.circuit.Gate "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.
|
||
|
||
Can be applied to a [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") with the [`h()`](qiskit.circuit.QuantumCircuit#h "qiskit.circuit.QuantumCircuit.h") method.
|
||
|
||
**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
|
||
|
||
<span id="qiskit-circuit-library-hgate-control" />
|
||
|
||
### 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>
|
||
|
||
<span id="qiskit-circuit-library-hgate-inverse" />
|
||
|
||
### inverse
|
||
|
||
<Function id="qiskit.circuit.library.HGate.inverse" signature="HGate.inverse()">
|
||
Return inverted H gate (itself).
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### condition\_bits
|
||
|
||
<Attribute id="qiskit.circuit.library.HGate.condition_bits">
|
||
Get Clbits in condition.
|
||
</Attribute>
|
||
|
||
### 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
|
||
</Attribute>
|
||
|
||
### name
|
||
|
||
<Attribute id="qiskit.circuit.library.HGate.name">
|
||
Return the name.
|
||
</Attribute>
|
||
|
||
### num\_clbits
|
||
|
||
<Attribute id="qiskit.circuit.library.HGate.num_clbits">
|
||
Return the number of clbits.
|
||
</Attribute>
|
||
|
||
### num\_qubits
|
||
|
||
<Attribute id="qiskit.circuit.library.HGate.num_qubits">
|
||
Return the number of qubits.
|
||
</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>
|
||
|