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

Add Circuit.add_command() method #1006

Open
CalMacCQ opened this issue Sep 5, 2023 · 1 comment
Open

Add Circuit.add_command() method #1006

CalMacCQ opened this issue Sep 5, 2023 · 1 comment
Labels
enhancement New feature or request stale

Comments

@CalMacCQ
Copy link
Contributor

CalMacCQ commented Sep 5, 2023

When using CustomPass users frequently need often need to iterate through a list of circuit commands and do some case handling for different OpTypes using Command.op.type.

replacement_circ = Circuit(input_circ.n_qubits)
for cmd in circ.get_commands():
    if cmd.op.type == OpType.X:
        ...
    else:
        ...

See the manual example.

After this checking is done we often add the command to a replacement circuit with something like

 replacement_circ.add_gate(cmd.op.type, cmd.op.params, cmd.qubits)

It'd be nicer to be able do something like this instead

 replacement_circ.add_command(cmd, cmd.args)
@CalMacCQ CalMacCQ added the enhancement New feature or request label Sep 5, 2023
Copy link

github-actions bot commented Jun 9, 2024

This issue has been automatically marked as stale.

@github-actions github-actions bot added the stale label Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

1 participant