API Reference: qiskit.circuit.QuantumCircuit.h
The QuantumCircuit.h method appends a Hadamard operation to the selected qubit. The required parameter is qubit, which identifies the target qubit by index, register element, or compatible qubit reference. The operation maps computational-basis states into equal superposition states and is commonly used at the beginning of algorithms that require amplitude branching.
The method returns an instruction handle that is attached to the circuit. It does not measure the qubit and does not allocate classical memory. When applied to a qubit initialized as \(|0\rangle\), the resulting state is \((|0\rangle + |1\rangle)/\sqrt{2}\).
Parameters
| Parameter Name | Type | Description |
|---|---|---|
qubit |
int | Qubit |
The target qubit that receives the Hadamard operation. |
from qiskit import QuantumCircuit
qc = QuantumCircuit(1)
qc.h(0)
print(qc.draw(output="text"))
Example Output
{
"status": "success",
"operation": "Hadamard",
"target": 0
}
Used In Technical Article
Implementing Quantum Phase Estimation for Eigenvalue Evaluation