Skip to content

Fix row and column mismatch in correlation_length with unit cells #198

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

Merged
merged 7 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PEPSKit"
uuid = "52969e89-939e-4361-9b68-9bc7cde4bdeb"
authors = ["Paul Brehmer", "Lander Burgelman", "Lukas Devos <[email protected]>"]
version = "0.6.0"
version = "0.6.1"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
18 changes: 7 additions & 11 deletions src/algorithms/toolbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,29 +276,25 @@ MPSKit.correlation_length(state, env::CTMRGEnv; num_vals=2, kwargs...) =
_correlation_length(env; num_vals, kwargs...)

function _correlation_length(env::CTMRGEnv; num_vals=2, kwargs...)
T = scalartype(env)
ξ_h = Vector{real(T)}(undef, size(env, 2))
ξ_v = Vector{real(T)}(undef, size(env, 3))
λ_h = Vector{Vector{T}}(undef, size(env, 2))
λ_v = Vector{Vector{T}}(undef, size(env, 3))
_, n_rows, n_cols = size(env)

# Horizontal
λ_h = map(1:size(env, 2)) do r
λ_h = map(1:n_rows) do r
above = InfiniteMPS(env.edges[NORTH, r, :])
below = InfiniteMPS(_dag.(env.edges[SOUTH, r, :]))
below = InfiniteMPS(_dag.(env.edges[SOUTH, mod1(r + 1, n_rows), :]))
vals = MPSKit.transfer_spectrum(above; below, num_vals, kwargs...)
return vals ./ abs(vals[1]) # normalize largest eigenvalue
end
ξ_h = map(λ_row -> -1 / log(abs(λ_row[2])), λ_h)
ξ_h = map(λ_row -> -n_rows / log(abs(λ_row[2])), λ_h)

# Vertical
λ_v = map(1:size(env, 3)) do c
λ_v = map(1:n_cols) do c
above = InfiniteMPS(env.edges[EAST, :, c])
below = InfiniteMPS(_dag.(env.edges[WEST, :, c]))
below = InfiniteMPS(_dag.(env.edges[WEST, :, mod1(c + 1, n_cols)]))
vals = MPSKit.transfer_spectrum(above; below, num_vals, kwargs...)
return vals ./ abs(vals[1]) # normalize largest eigenvalue
end
ξ_v = map(λ_row -> -1 / log(abs(λ_row[2])), λ_v)
ξ_v = map(λ_col -> -n_cols / log(abs(λ_col[2])), λ_v)

return ξ_h, ξ_v, λ_h, λ_v
end
Expand Down
Loading