Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Adds elementary gate decomposition for single-qubit
QubitUnitary
#1427Adds elementary gate decomposition for single-qubit
QubitUnitary
#1427Changes from 3 commits
acb3357
62863e1
5dbe2c0
2772e52
bb6f7f0
c90439a
f3c5bd0
3fef91d
4d66997
5f723fb
b8a524b
60a0b1e
f8d41ce
dccdba7
f457347
284e65f
85eb1ab
c6ad65b
9cc9ffe
6986829
5fddce4
e4591c9
0fe201e
b09e6d8
91ae536
ef09356
b9480be
b621546
a40f05b
3b6c694
97ee4db
7232294
262fbaf
1489d81
4e2925e
0cd62fa
379ea3f
0dd4ce0
8c41a0d
513a4d6
40fdf67
8a20067
26575ea
03bd4dd
070bc97
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
You may need to be careful here:
phi
is complex2 * angle(...)
will be real (I thinkfloat64
)and TensorFlow (maybe also PyTorch?) will not automatically cast the latter to a complex number before doing the subtraction.
I think the following should work:
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.
(Note:
qml.math.cast(..., "complex128")
would also work above, butcast_like
is safer, in that it will support bothcomplex64
andcomplex128
depending on whateverphi
is)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.
Oh thanks, yes this looks safer! I originally had the conversion to
real
in the line ofphi
rather than in the return value, do you think it'd be better to convertphi
first so that the subtraction ends up real? Or is it better to just do the casting anyways?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.
I think you'd need the casting regardless, potentially you could have float64 subtract float32, which would also cause an error
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.