StaticArrays.jl icon indicating copy to clipboard operation
StaticArrays.jl copied to clipboard

Define Base.show for SArray and MArray.

Open tpapp opened this issue 3 years ago • 2 comments

This allows SArray and MArray to be printed (show, repr, etc) and read back into an object of the same type.

Fixes #692.

tpapp avatar Apr 24 '22 13:04 tpapp

I'm not sure that it's preferable to print the content as a tuple though; e.g.,

A = @SMatrix [1 2; 3 4]

would now repr as SMatrix{2,2,Int}(1, 2, 3, 4). That seems OK for repr maybe, but it's not great for printing vectors of A. E.g., the default showing of [A, A, A] now becomes:

julia> [A, A, A]
3-element Vector{SMatrix{2, 2, Int64, 4}}:
 SMatrix{2,2,Int64}(1, 3, 2, 4)
 SMatrix{2,2,Int64}(1, 3, 2, 4)
 SMatrix{2,2,Int64}(1, 3, 2, 4)

How about instead printing this as SA{T}[...]?

thchr avatar Apr 27 '22 14:04 thchr

Xref #906 which has some discussion of what to print.

mcabbott avatar May 07 '22 04:05 mcabbott