forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to skip deepcopy on circuit_to_dag (Qiskit#9848)
Just as was done for Qiskit#9825 for dag_to_circuit(), this commit adds a new option, copy_operations, which allows to disable the deepcopy on circuit_to_dag(). Previously, the circuit to dag converter would always deep copy every operation, however we don't need this extra overhead in every case; where the input QuantumCircuit is discarded after conversion. This new flag lets us avoid the copy overhead in these situations, however in general the converter still needs to default to copying.
- Loading branch information
1 parent
3bae47d
commit bb18744
Showing
3 changed files
with
25 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
releasenotes/notes/deepcopy-option-circuit_to_dag-1d494b7f9824ec93.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
features: | ||
- | | ||
Added a new option, ``copy_operations``, to :func:`~.circuit_to_dag` to | ||
enable optionally disabling deep copying the operations from the input | ||
:class`~.QuantumCircuit` to the output :class:`~.QuantumCircuit`. In cases | ||
where the input :class`~.QuantumCircuit` is not used anymore after | ||
conversion this deep copying is unnecessary overhead as any shared | ||
references wouldn't have any potential unwanted side effects if the input | ||
:class`~.QuantumCircuit` is discarded. |