-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add public, py-less, substitute_node_with_dag
to DAGCircuit
#14766
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
base: main
Are you sure you want to change the base?
Conversation
This commits adds `substitute_node_with_dag` to DAGCircuit as a public function, which does not require a py token to call.
Pull Request Test Coverage Report for Build 16446311540Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
FWIW, this solves #14512 . Linking it as issue to be closed by this PR. |
One or more of the following people are relevant to this code:
|
Thanks Ray, but this PR still misses one piece to be able to close #14512: if no qubits or clbits mapping are passed to |
This commit adds the
substitute_node_with_dag
function toDAGCircuit
as a public function, which does not require a py token to call.This PR supports #14452
Details
The current implementation of
substitute_node_with_dag
supports qubits, clbits and variable mapping (throughsustitute_node_with_subgraph
). If no qubits or clbits mapping is provided by the caller (i.e. by sendingNone
), a trivial mapping - i.e. mapping the qubits/clbits of the replacement DAG by order to the qargs/cargs of the node to be replaced - is generated. However, inferring trivial mapping for a node with variables is currently not implemented in this PR. So, in case of replacing a node with variables, the caller would need to define the mapping upfront and pass it to the function.