Closed andreasnoack closed 4 years ago
I'm trying to figure out the proper way to avoid the compact printing of matrices in factorizations. I've realized the difference between
julia> show(STDOUT, Matrix(I, 3, 3))
Bool[true false false; false true false; false false true]
and
julia> show(STDOUT, MIME"text/plain"(), Matrix(I, 3, 3))
3×3 Array{Bool,2}:
true false false
false true false
false false true
but isn't text/plain
supposed to be the plainest way to show text? The documentation for show
states that
The default MIME type is MIME"text/plain". There is a fallback definition for text/plain output that calls show with 2 arguments. Therefore, this case should be handled by defining a 2-argument show(stream::IO, x::MyType) method.
which suggests that we shouldn't define a show(::IO, ""MIME"text/plain", ::Array)
method. Has this already been settled somewhere or should I open a separate issue for this?
cc @vtjnash – this distinction was your idea IIRC. What was the thinking here again? Perhaps it should be documented or changed?
The relevant issue is https://github.com/JuliaLang/julia/issues/18004
I was going to ask why the display of svd(A) was so much less readable than lu(A). Good to see you guys are working on it.
Just to show what I meant by less readable with the example I was working with
julia> A = [1 4; 3 5]
2×2 Array{Int64,2}:
1 4
3 5
julia> lu(A)
LU{Float64,Array{Float64,2}}
L factor:
2×2 Array{Float64,2}:
1.0 0.0
3.0 1.0
U factor:
2×2 Array{Float64,2}:
1.0 4.0
0.0 -7.0
julia> svd(A)
SVD{Float64,Float64,Array{Float64,2}}([-0.5715548351332405 -0.8205638734649572; -0.8205638734649574 0.5715548351332405], [7.072510139298385, 0.9897476090001649], [-0.42887834669531066 -0.903362254987387; 0.903362254987387 -0.42887834669531066])
I think we have pretty much done everything here.
Many of the factorizations fall back on the default printing method for structs which is not that useful for the factorizations. I think the best
show
method is BunchKaufman, e.g.because the factors are not printed compactly as in the LU:
Below is a list of what we remains to be done
Dense
LU
Cholesky
CholeskyPivoted
BunchKaufman
QRCompactWY
QRPivoted
QR
LDLt
Eigen
GeneralizedEigen
Schur
GeneralizedSchur
Hessenberg
SVD
GeneralizedSVD
Sparse
UmfpackLU
Ptr{Void}
CHOLMOD.Factor
This supersedes https://github.com/JuliaLang/julia/issues/10586