Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion NDTensors/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NDTensors"
uuid = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
authors = ["Matthew Fishman <mfishman@flatironinstitute.org>"]
version = "0.4.15"
version = "0.4.16"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
4 changes: 3 additions & 1 deletion NDTensors/src/dense/densetensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -319,5 +319,7 @@ end

function Base.show(io::IO, mime::MIME"text/plain", T::DenseTensor)
summary(io, T)
return print_tensor(io, T)
print_tensor(io, T)
println(io)
return nothing
end
1 change: 1 addition & 0 deletions NDTensors/src/diag/diagtensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,6 @@ end
function Base.show(io::IO, mime::MIME"text/plain", T::DiagTensor)
summary(io, T)
print_tensor(io, T)
println(io)
return nothing
end
8 changes: 6 additions & 2 deletions NDTensors/src/tensor/tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -495,5 +495,9 @@ end
# Printing
#

print_tensor(io::IO, T::Tensor) = Base.print_array(io, expose(T))
print_tensor(io::IO, T::Tensor{<:Number, 1}) = Base.print_array(io, reshape(T, (dim(T), 1)))
function print_tensor(io::IO, T::Tensor)
return Base.print_array(IOContext(io, :limit => true), expose(T))
end
function print_tensor(io::IO, T::Tensor{<:Number, 1})
return Base.print_array(IOContext(io, :limit => true), reshape(T, (dim(T), 1)))
end
12 changes: 10 additions & 2 deletions src/itensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2025,8 +2025,16 @@ end
# TODO: make a specialized printing from Diag
# that emphasizes the missing elements
function show(io::IO, T::ITensor)
println(io, "ITensor ord=$(order(T))")
return show(io, MIME"text/plain"(), tensor(T))
if get(io, :compact, false)
# Just show the indices in compact view, used in some
# cases when printing arrays of ITensors (similar to
# printing of MPS in ITensorMPS.jl).
show(io, inds(T))
else
println(io, "ITensor ord=$(order(T))")
show(io, MIME"text/plain"(), tensor(T))
end
return nothing
end

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