Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supporting assignment of measurement value to variable in autoqasm #108

Open
rjain37 opened this issue Jun 4, 2024 · 0 comments
Open

supporting assignment of measurement value to variable in autoqasm #108

rjain37 opened this issue Jun 4, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request qasm3 Related to OpenQASM 3 conversions

Comments

@rjain37
Copy link
Collaborator

rjain37 commented Jun 4, 2024

Feature Description

These two autoqasm programs operate the same, but have different ir values:

First:

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

print(my_program.build().to_ir())
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:

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

print(my_program.build().to_ir())
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__;

The first one doesn't have an issue when being converted to QIR, but the second one does.

@rjain37 rjain37 added enhancement New feature or request qasm3 Related to OpenQASM 3 conversions labels Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request qasm3 Related to OpenQASM 3 conversions
Projects
None yet
Development

No branches or pull requests

2 participants