Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Supporting assignment of measurement value to variable

Aperta
#128 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@TheGupta2012 ci sta già lavorando.

Dal 31/7/2024.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

enhancement qasm3
Feature Description

Both of the following OpenQASM 3 strings generated using autoqasm fail program validation due to Unsupported expression type <class 'openqasm3.ast.BitstringLiteral'>. However, if generated directly from autoqasm, it seems they should be valid programs.

First:

import autoqasm as aq

@aq.main
def my_program():
    ins.h(0)
    ins.cnot(0, 1)
    return ins.measure([0, 1])

qasm_str = my_program.build().to_ir()

print(qasm_str)
OPENQASM 3.0;
output bit[2] return_value;
qubit[2] __qubits__;
h __qubits__[0];
cnot __qubits__[0], __qubits__[1];
bit[2] __bit_0__ = "00";
__bit_0__[0] = measure __qubits__[0];
__bit_0__[1] = measure __qubits__[1];
return_value = __bit_0__;

Second:

import autoqasm as aq

@aq.main
def my_program():
    ins.h(0)
    ins.cnot(0, 1)
    result = ins.measure([0, 1])
    return result

qasm_str = my_program.build().to_ir()

print(qasm_str)
OPENQASM 3.0;
output bit[2] result;
qubit[2] __qubits__;
h __qubits__[0];
cnot __qubits__[0], __qubits__[1];
bit[2] __bit_0__ = "00";
__bit_0__[0] = measure __qubits__[0];
__bit_0__[1] = measure __qubits__[1];
result = __bit_0__;

And both raise the following exception from validate() method:

from pyqasm import loads

program = loads(qasm_str)

program.validate()
...

ValidationError: Unsupported expression type <class 'openqasm3.ast.BitstringLiteral'>
Lingua principale
Python
Stelle
29
Fork
33
Merge medio
2g 4h
PR unite (30g)
15

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 qBraid/pyqasm

Tutte le issue di qBraid/pyqasm

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.