You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add method to add instructions to a DAGCircuit from an iterator of PackedInstruction (#13032)
* Initial: Add add_from_iter method to DAGCircuit
- Introduce a method that adds a chain of `PackedInstruction` continuously avoiding the re-linking of each bit's output-node until the very end of the iterator.
- TODO: Add handling of vars
- Add header for a `from_iter` function that will create a `DAGCircuit` based on a chain of `PackedInstruction`.
* Fix: leverage new methods in layers
- Fix incorrect re-insertion of last_node.
* Fix: Keep track of Vars for add_from_iter
- Remove `from_iter`
* Fix: Incorrect modification of last nodes in `add_from_iter`.
- Use `entry` api to either modify or insert a value if missing.
* Fix: Cycling edges in when adding vars.
- A bug that adds duplicate edges to vars has been temporarily fixed. However, the root of this problem hasn't been found yet. A proper fix is pending. For now skip those instances.
* Fix: Remove set collecting all nodes to be connected.
- A set collecting all the new nodes to connect with a new node was preventing additional wires to connect to subsequent nodes.
* Fix: Adapt to #13033
* Refactor: `add_from_iter` is now called `extend` to stick with `Rust` nomenclature.
* Fix docstring
- Caught by @ElePT
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
* Fix: Remove duplicate vars check
* Fix: Corrections from code review.
- Use Entry API to modify last nodes in the var.
- Build new_nodes with an allocated vec.
- Add comment explaining the removal of the edge between the output node and its predecessor.
* Fix: Improper use of `Entry API`.
- Use `or_insert_with` instead of `or_insert` to perform actions before inserting a value.
---------
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
0 commit comments