Skip to content

Commit 75787eb

Browse files
committed
another show attempt
1 parent 2e2b15c commit 75787eb

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

src/states/finitemps.jl

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -441,23 +441,43 @@ max_Ds(ψ::FiniteMPS) = dim.(max_virtualspaces(ψ))
441441

442442
function Base.summary(io::IO, ψ::FiniteMPS)
443443
D = maximum(dim, left_virtualspace(ψ))
444-
return print(io, "$(length(ψ))-site FiniteMPS ($(scalartype(ψ)), $(spacetype(ψ))) with maximal dimension $D")
444+
return print(io, "$(length(ψ))-site FiniteMPS ($(scalartype(ψ)), $(TensorKit.type_repr(spacetype(ψ))))")
445445
end
446446
function Base.show(io::IO, mime::MIME"text/plain", ψ::FiniteMPS)
447447
summary(io, ψ)
448+
print(io, " with center $(ψ.center)")
448449
get(io, :compact, false)::Bool && return nothing
449450
println(io, ":")
450-
io = IOContext(io, :typeinfo => eltype(ψ), :compact => true)
451+
io = IOContext(io, :typeinfo => spacetype(ψ), :compact => true)
451452
charset = (; start = "", mid = "", stop = "", ver = "", dash = "──")
452453
limit = get(io, :limit, true)::Bool
453-
half_screen_rows = limit ? div(displaysize(io)[1] - 8, 2) : typemax(Int)
454-
if !haskey(io, :compact)
455-
io = IOContext(io, :compact => true)
456-
end
454+
half_screen_rows = limit ? div(displaysize(io)[1] - 8, 4) : typemax(Int)
457455

458456
L = length(ψ)
459-
c = ψ.center
457+
for i in reverse(1:L)
458+
if i < half_screen_rows || i > L - half_screen_rows
459+
Vr = right_virtualspace(ψ, i)
460+
if i == L && Vr == oneunit(Vr)
461+
println(io, "┌─[$i]─ ", physicalspace(ψ, i))
462+
elseif i == 1
463+
println(io, "", Vr)
464+
Vl = left_virtualspace(ψ, 1)
465+
if Vl == oneunit(Vr)
466+
println(io, "└─[$i]─ ", physicalspace(ψ, i))
467+
else
468+
println(io, "├─[$i]─ ", physicalspace(ψ, i))
469+
println(io, "", Vl)
470+
end
471+
else
472+
println(io, "", Vr)
473+
println(io, "├─[$i]─ ", physicalspace(ψ, i))
474+
end
475+
elseif i == half_screen_rows
476+
println(io, "│ ⋮")
477+
end
478+
end
460479

480+
return nothing
461481
for site in HalfInt.(reverse((1 / 2):(1 / 2):(L + 1 / 2)))
462482
if site < half_screen_rows || site > L - half_screen_rows
463483
char = if isinteger(site)

0 commit comments

Comments
 (0)