-
Notifications
You must be signed in to change notification settings - Fork 2
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
Improve typing in phirgen, fix measure args bug, pretty print PHIR #13
Conversation
"metadata": metadata, | ||
"angles": angles, | ||
"qop": gate, | ||
"args": [], | ||
} | ||
for qbit in cmd.args: | ||
qop["args"].append([qbit.reg_name, qbit.index[0]]) | ||
if gate == "Measure": | ||
break |
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.
Previously, both the qbit and cbit were part of the args for Measure.
@@ -47,12 +42,12 @@ def genphir(inp: list[tuple[list[int], list[Shard], float]]) -> str: | |||
Args: | |||
inp: list of shards | |||
""" | |||
phir = { | |||
phir: dict[str, Any] = { |
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.
No better types we can give than Any
?
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.
With the current approach, i.e., constructing Python dict's instead of a PHIRModel
object, the best we can do is Any
. Someday, we can consider directly constructing PHIRModel
but I found it difficult to go that route in my first attempt.
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.
Looks good. My only comment was about whether we could replace Any
with a different annotation, but we can make changes like that gradually.
Sample outputs: