amazon-braket / amazon-braket-sdk-python

A Python SDK for interacting with quantum devices on Amazon Braket
https://aws.amazon.com/braket/
Apache License 2.0
294 stars 118 forks source link

fix: measure target qubits are required #940

Closed ashlhans closed 3 months ago

ashlhans commented 3 months ago

Issue #, if available:

Description of changes:

The Circuit measure method target_qubits are not required.

Changes

Testing done: tox and tox -e integ-tests

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

Tests

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (04d8a95) to head (7930cb1).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #940 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 134 134 Lines 8915 8911 -4 Branches 2009 2007 -2 ========================================= - Hits 8915 8911 -4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ashlhans commented 3 months ago

Why remove measure_all functionality? If it's already released, wouldn't that be a breaking change?

@speller26, this shouldn't remove the qiskit measure_all functionality since that function measures each qubit individually behind the scenes (ie. for a 2 qubit circuit measure_all() is actually measure(0, 0) and measure(1, 1))

This would remove the already released measure() in the BDK but there are no examples that would break. There was some confusion with measure() without parameter, specifically whether that would measure all qubits or only currently used qubits. To prevent that confusion, we can make the target_qubit args required.