amazon-braket-sdk-python
amazon-braket-sdk-python copied to clipboard
feature: add partial measurement method to circuit class
Description of changes: Added methods to return the measurements and measurement counts of a specified list of qubits.
Example:
bell = Circuit().h(0).cnot(0, 1)
task = device.run(bell, shots=100)
result = task.result()
print(result.partial_measurements([0, 2]))
[[1 1]
[1 0]
[1 1]
[0 1]
[1 0]]
print(result.partial_measurement_counts([0]))
Counter({'1': 5, '0': 5})
Testing done: tox
Merge Checklist
Put an x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.
General
- [ ] I have read the CONTRIBUTING doc
- [ ] I used the commit message format described in CONTRIBUTING
- [ ] I have updated any necessary documentation, including READMEs and API docs (if appropriate)
Tests
- [ ] I have added tests that prove my fix is effective or that my feature works (if appropriate)
- [ ] I have checked that my tests are not configured for a specific region or account (if appropriate)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.