-
Notifications
You must be signed in to change notification settings - Fork 19
Rotation Gates #95
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
Open
sagnikpal2004
wants to merge
18
commits into
QuantumSavory:main
Choose a base branch
from
sagnikpal2004:rgate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rotation Gates #95
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d29d930
add RGate
sagnikpal2004 62c2ff2
export
sagnikpal2004 45d8269
update docstring
sagnikpal2004 acfcc5a
terminterface defs
sagnikpal2004 b438974
rotation rules
sagnikpal2004 1319631
updated rules
sagnikpal2004 44b7378
rotation tests
sagnikpal2004 4b1f531
gate renaming
sagnikpal2004 419eeca
express qoptics
sagnikpal2004 17f1784
Merge remote-tracking branch 'upstream/main' into rgate
sagnikpal2004 57cf767
updated rules
sagnikpal2004 1ec4871
updated tests
sagnikpal2004 c71b5c9
fixed rotation SymbolicUtils APIs
sagnikpal2004 7856f9e
fixed rotation TermInterface APIs
sagnikpal2004 68fc280
Merge branch 'main' into rgate
sagnikpal2004 a0eea88
Merge branch 'rgate' of https://github.com/sagnikpal2004/QuantumSymbo…
sagnikpal2004 a8b4922
const functions
sagnikpal2004 18ece5f
remove unnecessary constructors, fix tests
sagnikpal2004 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
@testitem "Test Ration" begin | ||
@testset "Identity tests" begin | ||
@test isequal(qsimplify(Rx(0), rewriter=qsimplify_rot), I) | ||
@test isequal(qsimplify(Ry(0), rewriter=qsimplify_rot), I) | ||
@test isequal(qsimplify(Rz(0), rewriter=qsimplify_rot), I) | ||
end | ||
|
||
@testset "Pauli tests" begin | ||
@test isequal(qsimplify(Rx(π), rewriter=qsimplify_rot), -im*X) | ||
@test isequal(qsimplify(Ry(π), rewriter=qsimplify_rot), -im*Y) | ||
@test isequal(qsimplify(Rz(π), rewriter=qsimplify_rot), -im*Z) | ||
|
||
@test isequal(qsimplify(Rx(1π), rewriter=qsimplify_rot), -im*X) | ||
@test isequal(qsimplify(Ry(1π), rewriter=qsimplify_rot), -im*Y) | ||
@test isequal(qsimplify(Rz(1π), rewriter=qsimplify_rot), -im*Z) | ||
end | ||
|
||
@testset "Fusion tests" begin | ||
@test isequal(qsimplify(Rx(π/3) * Rx(π/3), rewriter=qsimplify_rot), Rx(2π/3)) | ||
@test isequal(qsimplify(Ry(π/3) * Ry(π/3), rewriter=qsimplify_rot), Ry(2π/3)) | ||
@test isequal(qsimplify(Rz(π/3) * Rz(π/3), rewriter=qsimplify_rot), Rz(2π/3)) | ||
|
||
@test isequal(qsimplify(Rx(π/2) * Rx(-π/2), rewriter=qsimplify_rot), I) | ||
@test isequal(qsimplify(Ry(π/2) * Ry(-π/2), rewriter=qsimplify_rot), I) | ||
@test isequal(qsimplify(Rz(π/2) * Rz(-π/2), rewriter=qsimplify_rot), I) | ||
|
||
@test isequal(qsimplify(2 * Rx(π/2) * Rx(π/2), rewriter=qsimplify_rot), -2im*X) | ||
@test isequal(qsimplify(2 * Ry(π/2) * Ry(π/2), rewriter=qsimplify_rot), -2im*Y) | ||
@test isequal(qsimplify(2 * Rz(π/2) * Rz(π/2), rewriter=qsimplify_rot), -2im*Z) | ||
end | ||
|
||
@testset "Modulo tests" begin | ||
@test isequal(qsimplify(Rx(2π), rewriter=qsimplify_rot), -I) | ||
@test isequal(qsimplify(Ry(2π), rewriter=qsimplify_rot), -I) | ||
@test isequal(qsimplify(Rz(2π), rewriter=qsimplify_rot), -I) | ||
|
||
@test isequal(qsimplify(Rx(3π), rewriter=qsimplify_rot), im*X) | ||
@test isequal(qsimplify(Ry(3π), rewriter=qsimplify_rot), im*Y) | ||
@test isequal(qsimplify(Rz(3π), rewriter=qsimplify_rot), im*Z) | ||
|
||
@test isequal(qsimplify(Rx(4π), rewriter=qsimplify_rot), I) | ||
@test isequal(qsimplify(Ry(4π), rewriter=qsimplify_rot), I) | ||
@test isequal(qsimplify(Rz(4π), rewriter=qsimplify_rot), I) | ||
|
||
@test isequal(qsimplify(Rx(5π), rewriter=qsimplify_rot), -im*X) | ||
@test isequal(qsimplify(Ry(5π), rewriter=qsimplify_rot), -im*Y) | ||
@test isequal(qsimplify(Rz(5π), rewriter=qsimplify_rot), -im*Z) | ||
|
||
@test isequal(qsimplify(Rx(π) * Rx(π), rewriter=qsimplify_rot), -I) | ||
@test isequal(qsimplify(Ry(π) * Ry(π), rewriter=qsimplify_rot), -I) | ||
@test isequal(qsimplify(Rz(π) * Rz(π), rewriter=qsimplify_rot), -I) | ||
|
||
@test isequal(qsimplify(2 * Rx(3π/2) * Rx(2π/2), rewriter=qsimplify_rot), -2Rx(π/2)) | ||
@test isequal(qsimplify(2 * Ry(3π/2) * Ry(2π/2), rewriter=qsimplify_rot), -2Ry(π/2)) | ||
@test isequal(qsimplify(2 * Rz(3π/2) * Rz(2π/2), rewriter=qsimplify_rot), -2Rz(π/2)) | ||
end | ||
|
||
@testset "Exponential tests" begin | ||
@test isequal(qsimplify(exp(-im * π/2 * X), rewriter=qsimplify_rot), -im*X) | ||
@test isequal(qsimplify(exp(-im * π/2 * Y), rewriter=qsimplify_rot), -im*Y) | ||
@test isequal(qsimplify(exp(-im * π/2 * Z), rewriter=qsimplify_rot), -im*Z) | ||
|
||
@test isequal(qsimplify(2 * exp(-im * 2π/2 * X) * exp(-im * 5π/2 * X), rewriter=qsimplify_rot), 2im*X) | ||
@test isequal(qsimplify(2 * exp(-im * 2π/2 * Y) * exp(-im * 5π/2 * Y), rewriter=qsimplify_rot), 2im*Y) | ||
@test isequal(qsimplify(2 * exp(-im * 2π/2 * Z) * exp(-im * 5π/2 * Z), rewriter=qsimplify_rot), 2im*Z) | ||
end | ||
end |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.