Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlevy committed Dec 6, 2023
1 parent 2cd8ac2 commit a073933
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 38 deletions.
38 changes: 19 additions & 19 deletions examples/vumps/vumps_hubbard_extended.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ include(
),
)

function entropy_finite(ψ_,b)
function entropy_finite(ψ_, b)
ψ = orthogonalize(ψ_, b)
U,S,V = svd(ψ[b], (linkind(ψ, b-1), siteind(ψ,b)))
U, S, V = svd(ψ[b], (linkind(ψ, b - 1), siteind(ψ, b)))
SvN = 0.0
for n=1:dim(S, 1)
p = S[n,n]^2
for n in 1:dim(S, 1)
p = S[n, n]^2
SvN -= p * log(p)
end
return SvN
end

function entropy_infinite(ψ_,b)

#calculate entropy
C = ψ_.C[b]
Ũ,S,= svd(C,inds(C)[1])
SvN, tot = 0.0, 0.0
for n=1:dim(S, 1)
p = S[n,n]^2
SvN -= p * log(p)
tot += p
end
@assert tot 1.
return SvN
function entropy_infinite(ψ_, b)

#calculate entropy
C = ψ_.C[b]
Ũ, S, = svd(C, inds(C)[1])
SvN, tot = 0.0, 0.0
for n in 1:dim(S, 1)
p = S[n, n]^2
SvN -= p * log(p)
tot += p
end
@assert tot 1.0
return SvN
end
##############################################################################
# VUMPS parameters
Expand Down Expand Up @@ -150,8 +150,8 @@ corr_finite = correlation_matrix(
ψfinite, "Cdagup", "Cup"; sites=Int(Nfinite / 2):Int(Nfinite / 2 + 9)
)

S_finite = [entropy_finite(ψfinite,b) for b=Nfinite÷2:Nfinite÷2+N-1]
S_infinite =[entropy_infinite(ψ,b) for b=1:N]
S_finite = [entropy_finite(ψfinite, b) for b in (Nfinite ÷ 2):(Nfinite ÷ 2 + N - 1)]
S_infinite = [entropy_infinite(ψ, b) for b in 1:N]

println("\nResults from VUMPS")
@show energy_infinite
Expand Down
40 changes: 21 additions & 19 deletions examples/vumps/vumps_ising.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ include(
),
)

function entropy_finite(ψ_,b)
function entropy_finite(ψ_, b)
ψ = orthogonalize(ψ_, b)
U,S,V = svd(ψ[b], (linkind(ψ, b-1), siteind(ψ,b)))
U, S, V = svd(ψ[b], (linkind(ψ, b - 1), siteind(ψ, b)))
SvN = 0.0
for n=1:dim(S, 1)
p = S[n,n]^2
for n in 1:dim(S, 1)
p = S[n, n]^2
SvN -= p * log(p)
end
return SvN
end

function entropy_infinite(ψ_,b)

#calculate entropy
C = ψ_.C[b]
Ũ,S,= svd(C,inds(C)[1])
SvN, tot = 0.0, 0.0
for n=1:dim(S, 1)
p = S[n,n]^2
SvN -= p * log(p)
tot += p
end
@assert tot 1.
return SvN
function entropy_infinite(ψ_, b)

#calculate entropy
C = ψ_.C[b]
Ũ, S, = svd(C, inds(C)[1])
SvN, tot = 0.0, 0.0
for n in 1:dim(S, 1)
p = S[n, n]^2
SvN -= p * log(p)
tot += p
end
@assert tot 1.0
return SvN
end

##############################################################################
Expand Down Expand Up @@ -129,8 +129,10 @@ Sz2_infinite = expect(ψ.AL[2] * ψ.C[2], "Sz")
@show Sz1_finite, Sz2_finite
@show Sz1_infinite, Sz2_infinite

S_finite = [entropy_finite(ψ_finite,b) for b=nsite_finite÷2:nsite_finite÷2+nsite-1]
S_infinite =[entropy_infinite(ψ,b) for b=1:nsite]
S_finite = [
entropy_finite(ψ_finite, b) for b in (nsite_finite ÷ 2):(nsite_finite ÷ 2 + nsite - 1)
]
S_infinite = [entropy_infinite(ψ, b) for b in 1:nsite]
@show S_finite
@show S_infinite

Expand Down

0 comments on commit a073933

Please sign in to comment.