Warning instead of `ValidationError` for creg size = 0
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
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- compilers, quantum-computing
Direzione di ricerca
The error comes from the check that rejects a non-positive creg size, reached through pyqasm.loads on the snippet in the issue. Find that check and the existing tests for creg size, then load the example with creg c[0]; to reproduce it. Done means that snippet loads with a warning suggesting the declaration be omitted, creg c[-1]; still raises ValidationError, and a size-0 creg used by a measurement still raises.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Currently, a program that includes a creg declaration with size 0 raises a ValidationError. The creg of size 0 is a convention used by pyqpanda3, which we are currently trying to integrate into the qBraid-SDK transpiler (https://github.com/qBraid/qBraid/pull/963). However, the ValidationError demonstrated below is causing errors in testing, see comment.
import pyqpanda3
program = pyqpanda3.core.QProg()
program << pyqpanda3.core.RX(0, 3.1415926) << pyqpanda3.core.CNOT(0, 2)
qasm = pyqpanda3.intermediate_compiler.convert_qprog_to_qasm(program)
print(qasm)
OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
creg c[0];
rx(3.14159260) q[0];
cx q[0],q[2];
import pyqasm
module = pyqasm.loads(qasm)
ValidationError: Failed to parse OpenQASM string: L4:C6: creg size must be positive
I think we should instead just emit a warning if creg size = 0, but still raise a ValidationError if creg size < 0. If creg size is set to 0, and no further creg operations exist in the program, I think the program should still be considered "valid", but we should emit a warning and recommend that instead of declaring a creg of size 0, they should just omit the creg declaration.
Obviously, if creg size is set to 0 and the program also contains a measurement operation, for example, that should still warrant a ValidationError.
- Lingua principale
- Python
- Stelle
- 29
- Fork
- 33
- Merge medio
- 2g 4h
- PR unite (30g)
- 15
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di qBraid/pyqasm
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement error-handling program-validation
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Move the QASM 2 printer and its branch pre-processing out of qasm2.pyForse già presa @danielgaskins l’ha presa 9 giorni fa. Apertaenhancement qasm2
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
qBraid/pyqasm#447 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] dumps() emits extern calls without a semicolon, producing unparsable QASMForse già presa @Jah-yee l’ha presa 17 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
qBraid/pyqasm#438 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Parse failures raise ValidationError with an empty message; the ANTLR diagnostic is lostForse già presa @tonycoder-hub l’ha presa 11 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 22/100
qBraid/pyqasm#436 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di qBraid/pyqasm
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
MISP/misp-workbench#496 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
fossasia/visdom-dev#69 ·
I maintainer di solito rispondono entro 3 giorni
-
[Bug] Parameters named like a property break to_xcal()Forse già presa @atharvasalunke1267 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
collective/icalendar#2018 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno