Skip to content

Commit 29b45a5

Browse files
committed
[NDTensors] More compact tensor printing
1 parent 0084657 commit 29b45a5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

NDTensors/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NDTensors"
22
uuid = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
33
authors = ["Matthew Fishman <mfishman@flatironinstitute.org>"]
4-
version = "0.4.15"
4+
version = "0.4.16"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"

NDTensors/src/tensor/tensor.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,5 +495,9 @@ end
495495
# Printing
496496
#
497497

498-
print_tensor(io::IO, T::Tensor) = Base.print_array(io, expose(T))
499-
print_tensor(io::IO, T::Tensor{<:Number, 1}) = Base.print_array(io, reshape(T, (dim(T), 1)))
498+
function print_tensor(io::IO, T::Tensor)
499+
return Base.print_array(IOContext(io, :limit => true), expose(T))
500+
end
501+
function print_tensor(io::IO, T::Tensor{<:Number, 1})
502+
return Base.print_array(IOContext(io, :limit => true), reshape(T, (dim(T), 1)))
503+
end

0 commit comments

Comments
 (0)