Skip to content

Commit

Permalink
Improve TensorMap show
Browse files Browse the repository at this point in the history
The show method for TensorMap will now call show of HomSpace.
This ensures that `TensorMap{S,N,1}` and `TensorMap{S,1,N}` will no longer print things like:
`TensorMap(ProductSpace(...) <- ProductSpace(...))`
and instead omit the ProductSpace.
  • Loading branch information
lkdvos committed Aug 20, 2023
1 parent be4ed19 commit c4f13b2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tensors/tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -503,14 +503,14 @@ end
# Show
#------
function Base.summary(t::TensorMap)
return print("TensorMap(", codomain(t), "", domain(t), ")")
return print("TensorMap(", space(t), ")")
end
function Base.show(io::IO, t::TensorMap{S}) where {S<:IndexSpace}
if get(io, :compact, false)
print(io, "TensorMap(", codomain(t), "", domain(t), ")")
print(io, "TensorMap(", space(t), ")")
return
end
println(io, "TensorMap(", codomain(t), "", domain(t), "):")
println(io, "TensorMap(", space(t), "):")
if sectortype(S) == Trivial
Base.print_array(io, t[])
println(io)
Expand Down

0 comments on commit c4f13b2

Please sign in to comment.