Swap Test for Inner Product Estimation

8f0068cb-ae99-4c55-8a77-b9221916e5e3
3.0
Description

This circuit performs a swap test to estimate the inner product of two quantum states.

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

# Swap Test Circuit for Inner Product Estimation
qc = QuantumCircuit(3, 1)

# Prepare quantum states on qubits 1 and 2
qc.h(1)   # |ψ⟩ = |+⟩ state on qubit 1
# Qubit 2 remains in |0⟩ state (|ϕ⟩)

# Apply Hadamard gate to ancilla qubit 0
qc.h(0)

# Apply controlled-SWAP gate between qubits 1 and 2, controlled by qubit 0
qc.cswap(0, 1, 2)

# Apply Hadamard gate to qubit 0
qc.h(0)

# Measure qubit 0
qc.measure(0, 0)
```
Quantum Execution Results
ibm_kyiv
unknown
1024 shots
Measurement Counts
{
  "0": 723,
  "1": 301
}
Raw Result Data
Download Results
Back to Home