Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Qiskit statevector simulator returns wrong result when skipping classical bits.

Abierto
#142 3 comentarios 0 reacciones 1 asignado Ver en GitHub

@ymagchi ya está trabajando en esto.

Desde el 26/6/2024.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

Hi!

I noticed that when "skipping" a classical bit, meaning not measuring to some bit $x$ but to bit $y$ with $ind(x) < ind(y)$, the cusvaer-enabled statevector simulator returns the wrong result, simply ignoring the result on bit $y$. This does not happen when not enabling cusvaer.

See the example below:

from qiskit.circuit import QuantumCircuit
from qiskit_aer import Aer

sim = Aer.get_backend("aer_simulator_statevector")
sim.set_option("cusvaer_enable", True)

circuit = QuantumCircuit(4, 5)
circuit.h(0)
circuit.cx(range(3), range(1, 4))
circuit.measure([0, 1, 2, 3], [0, 1, 2, 4])

print(circuit)

wrong_result = sim.run(circuit, shots=10000).result().get_counts()
print("Wrong:", wrong_result)

sim.set_option("cusvaer_enable", False)

correct_result = sim.run(circuit, shots=10000).result().get_counts()
print("Correct:", correct_result)
     ┌───┐          ┌─┐              
q_0: ┤ H ├──■───────┤M├──────────────
     └───┘┌─┴─┐     └╥┘     ┌─┐      
q_1: ─────┤ X ├──■───╫──────┤M├──────
          └───┘┌─┴─┐ ║      └╥┘┌─┐   
q_2: ──────────┤ X ├─╫───■───╫─┤M├───
               └───┘ ║ ┌─┴─┐ ║ └╥┘┌─┐
q_3: ────────────────╫─┤ X ├─╫──╫─┤M├
                     ║ └───┘ ║  ║ └╥┘
c: 5/════════════════╩═══════╩══╩══╩═
                     0       1  2  4 
Wrong: {'00000': 4993, '00111': 5007}
Correct: {'10111': 5026, '00000': 4974}

I suspect there might be some missing bookkeeping of the indices of classical registers in the cusvaer backend.

Thanks!
Nate

Lenguaje dominante
Jupyter Notebook
Estrellas
502
Forks
102
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NVIDIA/cuQuantum

Todos los issues de NVIDIA/cuQuantum

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.