-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(py): Allow using
Tk2Op
s in the builder (#436)
Some module cleanups I come into while writing a notebook with examples. Most of the diff is just moving code around. There are two different ways to refer to operations; the commands in `tket2.circuit.build` and the operations in the `tket2.ops.Tk2Op` enum. For the `Dfg` building examples we defined duplicated versions of `Measure`, `QAlloc`, `QFree`, `Not`, even though they are already defined as members of `Tk2Op`. The solution to this was moving `CustomOp` from the circuit module into `tket2.op` and adding a `ToCustomOp` protocol, so Tk2Ops can be used in the builders. As part of this I also had to move the type structs (to a `tket2.types` module) to avoid circular dependencies. There are still annoying things here; I'd like to move the `Command` definitions to their own place at some point, and have some way to convert from operations to commands. But this should be enough for now. --------- Co-authored-by: Douglas Wilson <141026920+doug-q@users.noreply.github.com>
- Loading branch information
Showing
17 changed files
with
362 additions
and
229 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
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
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
Oops, something went wrong.