Skip to content
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

change default site value for FiniteMPS in entanglement_spectrum #245

Merged
merged 2 commits into from
Feb 5, 2025
Merged
Changes from all 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
12 changes: 10 additions & 2 deletions src/algorithms/toolbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,21 @@
end

"""
entanglement_spectrum(ψ, [site::Int=0]) -> SectorDict{sectortype(ψ),Vector{<:Real}}
entanglement_spectrum(ψ, site::Int) -> SectorDict{sectortype(ψ),Vector{<:Real}}

Compute the entanglement spectrum at a given site, i.e. the singular values of the gauge
matrix to the right of a given site. This is a dictionary mapping the charge to the singular
values.

For `InfiniteMPS` and `WindowMPS` the default value for `site` is 0.

For `FiniteMPS` no default value for `site` is given, it is up to the user to specify.
"""
function entanglement_spectrum(st::Union{InfiniteMPS,FiniteMPS,WindowMPS}, site::Int=0)
function entanglement_spectrum(st::Union{InfiniteMPS,WindowMPS}, site::Int=0)
checkbounds(st, site)
return LinearAlgebra.svdvals(st.C[site])
end
function entanglement_spectrum(st::FiniteMPS, site::Int)

Check warning on line 103 in src/algorithms/toolbox.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/toolbox.jl#L103

Added line #L103 was not covered by tests
checkbounds(st, site)
return LinearAlgebra.svdvals(st.C[site])
end
Expand Down