Warning instead of `ValidationError` for creg size = 0
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- compilers, quantum-computing
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 29
- Fork
- 33
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của qBraid/pyqasm
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement error-handling program-validation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Move the QASM 2 printer and its branch pre-processing out of qasm2.pyCó thể đã có người làm @danielgaskins đã nhận 10 ngày trước. Đang mởenhancement qasm2
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
qBraid/pyqasm#447 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] dumps() emits extern calls without a semicolon, producing unparsable QASMCó thể đã có người làm @Jah-yee đã nhận 18 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
qBraid/pyqasm#438 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Parse failures raise ValidationError with an empty message; the ANTLR diagnostic is lostCó thể đã có người làm @tonycoder-hub đã nhận 12 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 22/100
qBraid/pyqasm#436 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của qBraid/pyqasm
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fossasia/visdom-dev#77 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
aws-cloudformation/cfn-lint#4890 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
volcengine/OpenViking#6521 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
AstrBotDevs/AstrBot#10720 ·
Maintainer thường phản hồi trong vòng 1 ngày