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

Allow for circuit measure methods to return a new circuit with inplace kwarg #3755

Merged
merged 9 commits into from
Jan 30, 2020
Merged

Allow for circuit measure methods to return a new circuit with inplace kwarg #3755

merged 9 commits into from
Jan 30, 2020

Conversation

nonhermitian
Copy link
Contributor

@nonhermitian nonhermitian commented Jan 27, 2020

Summary

Often one wants to add or remove measurements to a circuit without modifying the current one in place. As such, I modified QuantumCircuit.measure_all(), .measure_active() and .remove_final_measurements() to take the bool kwarg inplace that leaves the original circuit untouched, and returns a modified one when inplace=False (default is True).

Details and comments

@nonhermitian nonhermitian added the type: enhancement It's working, but needs polishing label Jan 27, 2020
@ajavadia
Copy link
Member

can you do something similar for measure_active and remove_final_measurements.

@nonhermitian nonhermitian changed the title Allow for measure_all to return a new circuit with inplace kwarg Allow for circuit measure methods to return a new circuit with inplace kwarg Jan 29, 2020
@kdk kdk added automerge Changelog: API Change Include in the "Changed" section of the changelog labels Jan 30, 2020
@mergify mergify bot merged commit e4b3bd5 into Qiskit:master Jan 30, 2020
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
…e kwarg (Qiskit#3755)

* all inplace kwarg to measure_all

* fix style

* fix lint

* Update quantumcircuit.py

* add inplace to other measure methods

* add release note

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: API Change Include in the "Changed" section of the changelog type: enhancement It's working, but needs polishing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants