Skip to content

Commit

Permalink
added error for breaking change in randomcircuit
Browse files Browse the repository at this point in the history
  • Loading branch information
GTorlai committed Oct 20, 2021
1 parent 168f37a commit fc5ae80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 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.15"
version = "0.0.16"

[deps]
Convex = "f65535da-76fb-5f13-bab9-19810c17039a"
Expand Down
8 changes: 7 additions & 1 deletion src/circuits/circuits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,16 @@ end
Generate a 2D random quantum circuit
"""
function randomcircuit(Lx::Int, Ly::Int; rotated::Bool=false, kwargs...)
function randomcircuit(size::Tuple; rotated::Bool=false, kwargs...)
Lx, Ly = size
return randomcircuit(squarearray(Lx, Ly; rotated=rotated); kwargs...)
end

function randomcircuit(L::Int, depth::Int; rotated::Bool=false, kwargs...)
error("randomcircuit(N::Int, depth::Int; kwargs...) is depracated\n
- for a 1d random circuit: randomcircuit(N::Int; depth = depth, kwargs...)\n
- for a 2d random circuit: randomcircuit((Lx, Ly); depth = depth, kwargs...)")
end

ITensors.dag(single_gate::Tuple{String,Union{Int,Tuple}}) =
(single_gate[1], single_gate[2], (dag = true,))
Expand Down
4 changes: 2 additions & 2 deletions test/circuits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ end

Lx = 5
Ly = 5
circuit = randomcircuit(Lx,Ly; depth = depth, twoqubitgates="RandomUnitary", onequbitgates=["Rn", "X"])
circuit = randomcircuit((Lx,Ly); depth = depth, twoqubitgates="RandomUnitary", onequbitgates=["Rn", "X"])
@test nqubits(circuit) == Lx*Ly

Lx = 5
Ly = 5
circuit = randomcircuit(Lx,Ly; depth = depth, twoqubitgates="RandomUnitary", onequbitgates=["Rn", "X"], rotated = true)
circuit = randomcircuit((Lx,Ly); depth = depth, twoqubitgates="RandomUnitary", onequbitgates=["Rn", "X"], rotated = true)
@test nqubits(circuit) == Lx*Ly
end

Expand Down

2 comments on commit fc5ae80

@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/47178

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.16 -m "<description of version>" fc5ae805681df2de8d3fe105b600156997140c18
git push origin v0.0.16

Please sign in to comment.