Skip to content

Commit

Permalink
Merge pull request #256 from GTorlai/choifix
Browse files Browse the repository at this point in the history
various fixes
  • Loading branch information
GTorlai authored Jan 27, 2022
2 parents 7848bf5 + 40ed1d9 commit 560406f
Show file tree
Hide file tree
Showing 11 changed files with 241 additions and 324 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PastaQ"
uuid = "30b07047-aa8b-4c78-a4e8-24d720215c19"
authors = ["Giacomo Torlai <[email protected]>", "Matthew Fishman <[email protected]>"]
version = "0.0.17"
version = "0.0.18"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
1 change: 1 addition & 0 deletions src/PastaQ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ include("autodiff.jl")
include("optimizers.jl")
include("productstates.jl")
include("randomstates.jl")
include("measurements.jl")
include("tomography/tensornetwork-statetomography.jl")
include("tomography/tensornetwork-processtomography.jl")
include("tomography/fulltomography.jl")
Expand Down
28 changes: 19 additions & 9 deletions src/circuits/gates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,15 @@ gate(::GateName"H") = [
]

# Rϕ with ϕ = π/2
gate(::GateName"Phase") = [
gate(::GateName"Phase"; ϕ::Number = π/2) = [
1 0
0 im
0 exp(im*ϕ)
]

gate(::GateName"P") = gate("Phase")
gate(::GateName"P"; kwargs...) = gate("Phase"; kwargs...)
gate(::GateName"PHASE"; kwargs...) = gate("Phase"; kwargs...)

gate(::GateName"S") = gate("Phase")
gate(::GateName"S") = gate("Phase"; ϕ = π/2)

# Rϕ with ϕ = π/4
gate(::GateName"π/8") = [
Expand Down Expand Up @@ -110,8 +111,8 @@ gate(::GateName"RY"; kwargs...) =

# Rotation around Z-axis
gate(::GateName"Rz"; ϕ::Number) = [
exp(im * ϕ / 2) 0
0 exp(-im * ϕ / 2)
exp(-im * ϕ / 2) 0
0 exp(im * ϕ / 2)
]

gate(::GateName"RZ"; kwargs...) =
Expand Down Expand Up @@ -173,16 +174,25 @@ gate(::GateName"CRy"; θ::Number) = [
gate(::GateName"CRY"; kwargs...) =
gate("CRy"; kwargs...)

# Same as CRn with (θ = 0, λ = 0)
gate(::GateName"CRz"; ϕ::Real) = [
1 0 0 0
0 1 0 0
0 0 exp(-im * ϕ / 2) 0
0 0 0 exp(im * ϕ / 2)
]

gate(::GateName"CRZ"; kwargs...) =
gate("CRz"; kwargs...)

gate(::GateName"CPHASE"; ϕ::Real) = [
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 exp(im * ϕ)
]

gate(::GateName"CRZ"; kwargs...) =
gate("CRz"; kwargs...)
gate(::GateName"Cphase"; kwargs...) = gate("CPHASE"; kwargs...)
gate(::GateName"CP"; kwargs...) = gate("CPHASE"; kwargs...)

function gate(::GateName"CRn"; θ::Real, ϕ::Real, λ::Real)
return [
Expand Down
Loading

2 comments on commit 560406f

@GTorlai
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/53305

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.0.18 -m "<description of version>" 560406f060cf5be9eb0c552ff28887d9942f9341
git push origin v0.0.18

Please sign in to comment.