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

Bug: Measurement on subset of qubits #49

Closed
YunJ1e opened this issue Aug 11, 2023 · 5 comments · Fixed by #51 or #53
Closed

Bug: Measurement on subset of qubits #49

YunJ1e opened this issue Aug 11, 2023 · 5 comments · Fixed by #51 or #53
Assignees

Comments

@YunJ1e
Copy link

YunJ1e commented Aug 11, 2023

Bug Description:
Measuring only a subset of the quantum circuit will return errors.

Code to Reproduce the Bug:
The code is from the documentation website.

import numpy as np
from quafu import QuantumCircuit, Task
q = QuantumCircuit(3)
q.x(2)
q.delay(2, t, unit="us")
q.measure([2])
task = Task()
task.config(backend="ScQ-P18", shots=2000, compile=False)
res = task.send(q)

Code Output:

IndexError: string index out of range

My Debugging Trials:
And if you change the one line of code q.measure([2]) to q.measure([0, 1, 2]) will simply solve the problem. But it would be better if your team could come up with proper solutions that could either prevent users from measuring subsets of qubits or support this feature.

@Zhaoyilunnn Zhaoyilunnn self-assigned this Aug 11, 2023
@Zhaoyilunnn
Copy link
Collaborator

Thanks, looked into this issue

@Zhaoyilunnn Zhaoyilunnn linked a pull request Aug 11, 2023 that will close this issue
@Zhaoyilunnn
Copy link
Collaborator

Zhaoyilunnn commented Aug 11, 2023

We do support this

Bug Description: Measuring only a subset of the quantum circuit will return errors.

Code to Reproduce the Bug: The code is from the documentation website.

import numpy as np
from quafu import QuantumCircuit, Task
q = QuantumCircuit(3)
q.x(2)
q.delay(2, t, unit="us")
q.measure([2])
task = Task()
task.config(backend="ScQ-P18", shots=2000, compile=False)
res = task.send(q)

Code Output:

IndexError: string index out of range

My Debugging Trials: And if you change the one line of code q.measure([2]) to q.measure([0, 1, 2]) will simply solve the problem. But it would be better if your team could come up with proper solutions that could either prevent users from measuring subsets of qubits or support this feature.

Partial measurement a supported feature, we are fixing this issue and will release assp, see the pr

@Zhaoyilunnn Zhaoyilunnn linked a pull request Aug 11, 2023 that will close this issue
@Zhaoyilunnn
Copy link
Collaborator

Now you can build from stable/0.3

git checkout -b stable/0.3 origin/stable/0.3
python setup.py install

We will release new version to pypi later, closed

@YunJ1e
Copy link
Author

YunJ1e commented Aug 11, 2023

Nice, thank you for your quick reaction. :^)

@Zhaoyilunnn
Copy link
Collaborator

Nice, thank you for your quick reaction. :^)

NP, thanks for your contributions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants