Closed LebedevRI closed 3 weeks ago
This is even worse for text-only output, looks like only pretty-printing does it right.
text/latex
has a special check for Symmetric
. We don't have the check in text/plain
. But that's also because we defer the printing to Base.show
, so I'm not sure this is easy to fix.
https://github.com/jump-dev/JuMP.jl/blob/56b186fc18d854be33a7f558bc2ba1918dd7c86d/src/print.jl#L884-L919
In the REPL, Julia prints the full symmetric matrix:
julia> using LinearAlgebra
julia> Symmetric([1 2; 2 3])
2×2 Symmetric{Int64, Matrix{Int64}}:
1 2
2 3
In the REPL, Julia prints the full symmetric matrix:
Right, i just saw that too. I thought it didn't, but apparently it does.
Arguably someone might interpret out current text/latex
printing as the upper triangular, with zeros in the lower.
Here's what UpperTriangular
prints.
julia> UpperTriangular([1 2; 2 3])
2×2 UpperTriangular{Int64, Matrix{Int64}}:
1 2
⋅ 3
I don't even know if the current text/latex
approach is a good idea.
IMHO, the text/latex
approach is generally the right way to do it. Perhaps a different symbol should be used?
Thoughts @blegat? I would err on the side of sticking to Base
.
@odow thank you!