ThreeQubitDiagonalGate decomposition changes the unitary for some qubit orders

Aperta
#8,552 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start by locating ThreeQubitDiagonalGate and its decomposition, then run the reproduction with cirq.testing.assert_decompose_is_consistent_with_unitary. Compare the direct and decomposed unitaries across the six qubit orders; done means all orders pass the consistency check.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

kind/bug-report triage/discuss

Describe the issue

For some permutations of three LineQubits, decomposing a ThreeQubitDiagonalGate gives a different unitary. The direct and decomposed unitaries differ even when evaluated in the same operation-qubit order and compared up to global phase. Cirq's built-in consistency check detects this mismatch.

Explain how to reproduce the bug or problem

import cirq

q = cirq.LineQubit.range(3)
gate = cirq.ThreeQubitDiagonalGate([2, 3, 5, 7, 11, 13, 17, 19])
op = gate.on(q[1], q[0], q[2])
cirq.testing.assert_decompose_is_consistent_with_unitary(op)
AssertionError:
Not equal to tolerance rtol=1e-07, atol=1e-08

Mismatched elements: 4 / 64 (6.25%)
Mismatch at indices:
 [2, 2]: (0.004425697988050765-0.9999902065507034j) (ACTUAL), (0.28366218546322625-0.9589242746631385j) (DESIRED)
 [3, 3]: (0.907446781450196+0.4201670368266412j) (ACTUAL), (0.7539022543433046+0.6569865987187891j) (DESIRED)
 [4, 4]: (0.28366218546322625-0.9589242746631385j) (ACTUAL), (0.004425697988050785-0.9999902065507035j) (DESIRED)
 [5, 5]: (0.7539022543433045+0.6569865987187893j) (ACTUAL), (0.9074467814501962+0.4201670368266409j) (DESIRED)

The same check passes for gate.on(q[0], q[1], q[2]) and gate.on(q[2], q[1], q[0]). It fails for the other four orderings of the three qubits.

Tell us the version of Cirq where this happens

Cirq 1.7.0 and prerelease 1.8.0.dev20261121043546, Python 3.12.8, macOS 27.2 (arm64), NumPy 2.5.5.

Lingua principale
Python
Stelle
5.1k
Fork
1.3k
Merge medio
1g 12h
PR unite (30g)
48

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di quantumlib/Cirq

Tutte le issue di quantumlib/Cirq

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.