QuantumCore

Hands-on lab · 1 step

Compile the ZZ evolution from CNOT and RZ

Implement the two-qubit evolution e−i0.72Z⊗Z=diag(e−0.35i,e0.35i,e0.35i,e−0.35i)e^{-i\frac{0.7}{2}Z\otimes Z}=\mathrm{diag}(e^{-0.35i},e^{0.35i},e^{0.35i},e^{-0.35i}) exactly, using at most three gates from {CNOT,RZ}\{\mathrm{CNOT},R_Z\}. This is the elementary building block of every diagonal (IQP-type) feature map, including the ZZ feature map of Havlíček et al.

0/1 step passedBest score 0/100

Step 1: Implement exp(−0.35i Z⊗Z) exactly

Build a two-qubit circuit whose unitary equals

T=e−iθ2Z⊗Z∣θ=0.7=(e−0.35i0000e0.35i0000e0.35i0000e−0.35i).T=e^{-i\frac{\theta}{2}Z\otimes Z}\Big|_{\theta=0.7}=\begin{pmatrix}e^{-0.35i}&0&0&0\\0&e^{0.35i}&0&0\\0&0&e^{0.35i}&0\\0&0&0&e^{-0.35i}\end{pmatrix}.

Qubit 00 is the most significant bit, so the basis order is ∣00⟩,∣01⟩,∣10⟩,∣11⟩\lvert00\rangle,\lvert01\rangle,\lvert10\rangle,\lvert11\rangle, and the diagonal entry of ∣ab⟩\lvert ab\rangle is e−0.35i (−1)a⊕be^{-0.35i\,(-1)^{a\oplus b}} because Z⊗Z∣ab⟩=(−1)a⊕b∣ab⟩Z\otimes Z\lvert ab\rangle=(-1)^{a\oplus b}\lvert ab\rangle.

The gate conventions are RZ(θ)=e−iθZ/2=diag(e−iθ/2,eiθ/2)R_Z(\theta)=e^{-i\theta Z/2}=\mathrm{diag}(e^{-i\theta/2},e^{i\theta/2}) and CNOT∣a,b⟩=∣a,a⊕b⟩\mathrm{CNOT}\lvert a,b\rangle=\lvert a,a\oplus b\rangle (first listed qubit = control). Only CNOT and RZR_Z are allowed, at most three gates in total. The grader computes your circuit unitary UU and the process fidelity FU=∣Tr(T†U)∣/4F_U=\lvert\mathrm{Tr}(T^\dagger U)\rvert/4, which equals 11 exactly when U=eiγTU=e^{i\gamma}T for some real γ\gamma, and requires FU≥1−10−6F_U\ge1-10^{-6}.

  • 2 qubits
  • allowed gates: CNOT, RZ
  • at most 3 gates
  • no measurements

One gate per line or separated by ;, e.g. H(0); CNOT(0,1); RY(1, pi/3); measure(1 -> 0). Qubit 0 is the top wire (most significant bit); controls come first. # starts a comment.

Measure into a classical bit with measure(q -> c); apply a gate only when a bit is set with X(2) if c1==1 (several bits, first = most significant: if c[0,1]==3).

Circuit diagram of your answerEmpty circuitq0q1
Statevector amplitudes
BasisAmplitude α|α|Phase arg αProbability
|00⟩1
1.0000
0
100.00%
3 basis states with zero amplitude hidden