Skip to content

Commit

Permalink
add new MPO that admits a state
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekGardas committed Jan 15, 2021
1 parent 658ca2c commit 7db20f4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
13 changes: 13 additions & 0 deletions src/PEPS.jl
Expand Up @@ -86,6 +86,19 @@ end
generate_tensor(pn::PepsNetwork, m::NTuple{2,Int}) = generate_tensor(pn.network_graph, pn.map[m])
generate_tensor(pn::PepsNetwork, m::NTuple{2,Int}, n::NTuple{2,Int}) = generate_tensor(pn.network_graph, pn.map[m], pn.map[n])

function MPO(::Type{T}, Ψ::PEPSRow, σ::Vector{State}) where {T <: Number}
n = length(Ψ)
ϕ = MPO(T, n)
for i=1:n
k = σ[n]
A = Ψ[i]
@cast B[l, u, r, d] |= A[l, u, r, d, $k]
ϕ[i] = B
end
ϕ
end
MPO::PEPSRow, σ::Vector{State}) = MPO(Float64, ψ, σ)

function MPO(::Type{T}, Ψ::PEPSRow) where {T <: Number}
n = length(Ψ)
ϕ = MPO(T, n)
Expand Down
18 changes: 0 additions & 18 deletions test/PEPS.jl
Expand Up @@ -6,9 +6,6 @@ origin_l = [:NW, :NE, :SE, :SW]
origin_r = [:WN, :EN, :ES, :WS]

for (ol, or) zip(origin_l, origin_r)

println("origin ", ol, " ", or)

ind_l, i_max_l, j_max_l = LinearIndices(m, n, ol)
ind_r, i_max_r, j_max_r = LinearIndices(m, n, or)

Expand Down Expand Up @@ -50,7 +47,6 @@ x, y = m, n
for origin (:NW, :SW, :WN, :NE, :EN, :SE, :ES, :SW, :WS)

@info "testing peps" origin
println(origin)

peps = PepsNetwork(x, y, fg, β, origin)
@test typeof(peps) == PepsNetwork
Expand All @@ -62,16 +58,10 @@ for origin ∈ (:NW, :SW, :WN, :NE, :EN, :SE, :ES, :SW, :WS)
for A ψ @test size(A, 2) == 1 end

for i 2:peps.i_max
println(i)

R = PEPSRow(peps, i)
W = MPO(R)
M = MPO(peps, i-1, i)

println(ψ)
println(M)
println(W)

ψ =* M) * W

for A ψ @test size(A, 2) == 1 end
Expand All @@ -84,20 +74,12 @@ for origin ∈ (:NW, :SW, :WN, :NE, :EN, :SE, :ES, :SW, :WS)
ψ = MPO(PEPSRow(peps, peps.i_max))

for A ψ @test size(A, 4) == 1 end

println("imax -> ", peps.i_max)

for i peps.i_max-1:-1:1
println(i)

R = PEPSRow(peps, i)
W = MPO(R)
M = MPO(peps, i, i+1)

println(W)
println(M)
println(ψ)

ψ = W * (M * ψ)

for A ψ @test size(A, 4) == 1 end
Expand Down
4 changes: 0 additions & 4 deletions test/graph.jl
Expand Up @@ -3,7 +3,6 @@ using LightGraphs
using GraphPlot
using CSV

#=
@testset "Rank reveal correctly decomposes energy row-wise" begin
energy = [[1 2 3]; [0 -1 0]; [1 2 3]]
P, E = rank_reveal(energy, :PE)
Expand All @@ -19,9 +18,7 @@ end
@test size(E) == (3, 2)
@test E * P energy
end
=#

#=
@testset "Lattice graph" begin
m = 4
n = 4
Expand Down Expand Up @@ -64,7 +61,6 @@ end
@test isempty(intersect(clv...))
@test isempty(intersect(cle...))
end
=#

@testset "Factor graph builds on pathological instance" begin
m = 3
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Expand Up @@ -36,8 +36,8 @@ push!(my_tests,
#"compressions.jl",
#"ising.jl",
#"spectrum.jl",
"graph.jl",
#"PEPS.jl",
#"graph.jl",
"PEPS.jl",
#"notation_tests.jl",
#"peps_tests.jl",
#"mps_tests.jl",
Expand Down

0 comments on commit 7db20f4

Please sign in to comment.