Hadamard Test for Pauli-Z Operator

02a2c0f8-539a-4c13-8b1f-5bcb3eb6f520
2.0
Description

This circuit estimates the expectation value of a Pauli-Z operator using the Hadamard test.

Qiskit Circuit Code
Python
```python
from qiskit import QuantumCircuit

# This circuit implements the Hadamard test to estimate the expectation value of a unitary operator U.
# Prepare a quantum circuit with 2 qubits (1 ancilla qubit and 1 target qubit) and 1 classical bit for measurement
qc = QuantumCircuit(2, 1)

# Step 1: Prepare the target qubit in a superposition state |ψ⟩
qc.h(1)  # Apply Hadamard gate to qubit 1 to create |ψ⟩ = (|0⟩ + |1⟩)/√2

# Step 2: Prepare the ancilla qubit
# The ancilla qubit (qubit 0) is already initialized to |0⟩

# Step 3: Apply Hadamard gate to the ancilla qubit
qc.h(0)

# Step 4: Apply the controlled-U operation, where U is a Pauli-Z gate in this example
qc.cz(0, 1)  # Controlled-Z gate with ancilla as control and target qubit as target

# Step 5: Apply another Hadamard gate to the ancilla qubit
qc.h(0)

# Step 6: Measure the ancilla qubit to obtain the real part of ⟨ψ|U|ψ⟩
qc.measure(0, 0)
```
Quantum Execution Results
ibm_brisbane
N/A
N/A shots
Execution Notice:

'Failed to run program: \'409 Client Error: Conflict for url: https://api.quantum.ibm.com/runtime/jobs. {"errors":[{"message":"You have reached the limit of 3 pending jobs. Please wait for a job to complete or cancel one before submitting anything new.","code":3458,"solution":"Wait until some previous jobs were finished. You can cancel pending jobs to run new jobs.","more_info":"https://docs.quantum-computing.ibm.com/errors"}]}\''

Raw Result Data
Download Results
Back to Home