Skip to content

Commit a3d6ccc

Browse files
committed
Also fix environments
1 parent b4b916d commit a3d6ccc

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/environments/finite_envs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
struct FiniteEnvironments <: AbstractMPSEnvironments
33
4-
Environment manager for `FiniteMPS` and `WindowMPS`. This structure is responsable for automatically checking
4+
Environment manager for `FiniteMPS` and `WindowMPS`. This structure is responsible for automatically checking
55
if the queried environment is still correctly cached and if not recalculates.
66
"""
77
struct FiniteEnvironments{A, B, C, D} <: AbstractMPSEnvironments

src/utility/show.jl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,40 @@ function Base.show(io::IO, ::MIME"text/plain", mpo::AbstractMPO)
169169
return nothing
170170
end
171171

172+
function Base.showarg(io::IO, envs::FiniteEnvironments, toplevel::Bool)
173+
print(io, "environments(state, ")
174+
Base.showarg(io, envs.operator, false)
175+
if isnothing(envs.above)
176+
print(io, ")")
177+
else
178+
print(io, ", ")
179+
Base.showarg(io, envs.above, false)
180+
print(io, ")")
181+
end
182+
return nothing
183+
end
184+
185+
function Base.summary(io::IO, envs::Union{FiniteEnvironments, InfiniteEnvironments})
186+
print(io, length(envs.GLs), "-site ")
187+
Base.showarg(io, envs, true)
188+
return nothing
189+
end
190+
191+
function Base.show(io::IO, ::MIME"text/plain", envs::Union{InfiniteEnvironments, FiniteEnvironments})
192+
Base.summary(io, envs)
193+
get(io, :compact, false)::Bool && return nothing
194+
println(io, ":")
195+
196+
for (i, gl) in enumerate(envs.GLs)
197+
println(io, "GL[$i]: ", space(gl))
198+
end
199+
for (i, gr) in enumerate(envs.GRs)
200+
println(io, "GR[$i]: ", space(gr))
201+
end
202+
203+
return nothing
204+
end
205+
172206
# braille
173207
# -------
174208
"""

0 commit comments

Comments
 (0)