Supporting assignment of measurement value to variable
维护者通常 1 天内回复
@TheGupta2012 已经在做这个了。
开始于 2024年7月31日。
评估
这个 Issue 还没有评估数据。
描述
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'>
- 主要语言
- Python
- 星标
- 29
- 派生
- 33
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 15
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
qBraid/pyqasm 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 63/100
维护者通常 1 天内回复
-
enhancement error-handling program-validation
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
Move the QASM 2 printer and its branch pre-processing out of qasm2.py可能已有人在做 @danielgaskins 于 7 天前认领。 未关闭enhancement qasm2
难度 4/5 3-5 天 新手友好度 22/100
维护者通常 1 天内回复
-
[BUG] dumps() emits extern calls without a semicolon, producing unparsable QASM可能已有人在做 @Jah-yee 于 15 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 25/100
维护者通常 1 天内回复
-
Parse failures raise ValidationError with an empty message; the ANTLR diagnostic is lost可能已有人在做 @tonycoder-hub 于 9 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 22/100
维护者通常 1 天内回复
相似的 Issue
-
Uninstall guide omits the CloudWatch log groups AWS CodeBuild creates for useCodeBuild pipelines未关闭bug documentation
难度 1/5 1-3 小时 新手友好度 88/100
awslabs/visual-asset-management-system#552 ·
维护者通常 1 天内回复
-
netbox status: needs triage type: documentation
难度 1/5 1 小时以内 新手友好度 76/100
netbox-community/netbox#23460 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
awslabs/threat-composer#362 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
ansys/pyansys-common-mcp#213 ·
维护者通常 3 天内回复