-
Notifications
You must be signed in to change notification settings - Fork 11
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
Rotation Gates #95
base: main
Are you sure you want to change the base?
Rotation Gates #95
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #95 +/- ##
==========================================
- Coverage 75.46% 74.26% -1.21%
==========================================
Files 19 19
Lines 803 816 +13
==========================================
Hits 606 606
- Misses 197 210 +13 ☔ View full report in Codecov by Sentry. |
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 is a great start, thank you for engaging with this.
I am leaving a few comments on suggested structure below.
We should probably also add some simplification rules to the database of rules: https://github.com/QuantumSavory/QuantumSymbolics.jl/blob/main/src/QSymbolicsBase/rules.jl
It can be a new _ROT
list of rules, containing things like Rot(a)*Rot(b) = Rot(a+b)
and commutation relationships between them and commutation relationships with Paulis, and conversion of exponentials of Paulis into rot gates.
For testing we can add something that checks an equality of a bunch of expressions of the type express(expr) == express(expr(simplify(expr)))
-- that way we check consistency between the numerical representation and the symbolic simplification rules.
@withmetadata struct RGate <: AbstractSingleQubitGate | ||
dir::Symbol | ||
θ::Float64 | ||
end |
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.
A few points:
- this object does not seem to be a "leaf" of a symbolic expression, and as such it needs to implement additional APIs that permit symbolic tree traversal
- theta would not necessarily be a float64. It might also be a symbolic scalar, a float32, etc. There are a lot of sophisticated approaches to what this can be set to, but for the moment it would probably work best if it is unconstrained
- the dir symbol should probably just be removed (and then have three different types RotX RotY RotZ) -- otherwise it will be very difficult to write simplification rules for these objects
See the "scaled" object as an example of the additional API that is needed for non-leaf symbolic objects https://github.com/QuantumSavory/QuantumSymbolics.jl/blob/main/src/QSymbolicsBase/basic_ops_homogeneous.jl#L22
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 you want to, you can always create a AbstractRotGate
if you want to avoid some minor code repetition
QuantumSymbolics.jl is currently missing rotation gates.
I decided to implement these gates as RGate, which are structs which take in a direction and angle.
express
functionality for QuantumOpticsRepr is also implementedCHANGELOG:
express
in QuantumOpticsReprCHECKLIST: