Skip to content

Commit d0ed558

Browse files
committed
Compact printing when ITensors are printed from within arrays
1 parent 1724f80 commit d0ed558

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/itensor.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,8 +2025,16 @@ end
20252025
# TODO: make a specialized printing from Diag
20262026
# that emphasizes the missing elements
20272027
function show(io::IO, T::ITensor)
2028-
println(io, "ITensor ord=$(order(T))")
2029-
return show(io, MIME"text/plain"(), tensor(T))
2028+
if get(io, :compact, false)
2029+
# Just show the indices in compact view, used in some
2030+
# cases when printing arrays of ITensors (similar to
2031+
# printing of MPS in ITensorMPS.jl).
2032+
show(io, inds(T))
2033+
else
2034+
println(io, "ITensor ord=$(order(T))")
2035+
show(io, MIME"text/plain"(), tensor(T))
2036+
end
2037+
return nothing
20302038
end
20312039

20322040
function show(io::IO, mime::MIME"text/plain", T::ITensor)

0 commit comments

Comments
 (0)