-
Notifications
You must be signed in to change notification settings - Fork 10
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 odd gate folding #14
Conversation
|
||
if fold: | ||
# for _ in range(noise_scaling - 1): | ||
command_circ_dict = c_dict.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small optimisation suggestion
put this outside the loop:
command_circ_dict= {key: val for key, val in c_dict.items() if key != "commands"}
then in the loop
command_circ_dict.update({"commands": [command]})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
|
||
# Append command and inverse the appropriate number of times. | ||
folded_command_list.append(command) | ||
for _ in range(cast(int, noise_scaling) - 1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if noise_scaling is assumed to be an int, it should have an int type signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Co-authored-by: Seyon Sivarajah <[email protected]>
Co-authored-by: Seyon Sivarajah <[email protected]>
Co-authored-by: Seyon Sivarajah <[email protected]>
@@ -190,11 +190,11 @@ def odd_gate(circ: Circuit, noise_scaling: float) -> Circuit: | |||
|
|||
for command in c_dict["commands"]: | |||
|
|||
command_circ_dict= {key: val for key, val in c_dict.items() if key != "commands"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be put outside the loop, those values don't change between iterations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yeah, cheers!
folded_command_list.append( | ||
{ | ||
"args": command["args"], | ||
"op": { | ||
"signature": ["Q" for _ in command["args"]], | ||
"signature": ["Q"]*len(command["args"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repeat this below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, thanks!
This adds a new gate folding technique. In particular odd gates are folded until the noise is appropriately scaled.