Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pretty printing of numerical arrays #7689

Closed
lindahua opened this issue Jul 21, 2014 · 2 comments
Closed

pretty printing of numerical arrays #7689

lindahua opened this issue Jul 21, 2014 · 2 comments

Comments

@lindahua
Copy link
Contributor

See below

julia> x = qr(randn(3,3))[1];

julia> c = x'x;

julia> c
3x3 Array{Float64,2}:
 1.0          5.55112e-17  5.55112e-17
 5.55112e-17  1.0          2.22045e-16
 5.55112e-17  2.22045e-16  1.0        

julia> println(c)
[1.0 5.551115123125783e-17 5.551115123125783e-17
 5.551115123125783e-17 0.9999999999999996 2.220446049250313e-16
 5.551115123125783e-17 2.220446049250313e-16 0.9999999999999998]

julia> show(c)
[1.0 5.551115123125783e-17 5.551115123125783e-17
 5.551115123125783e-17 0.9999999999999996 2.220446049250313e-16
 5.551115123125783e-17 2.220446049250313e-16 0.9999999999999998]

The REPL printing is quite decent, while the version produced by println is almost unreadable.

I am wondering why println or show does not do the pretty version.

One consequence of the current behavior is that it makes debugging difficult, since println(a) always outputs something that I have hard time comprehending, and it also affects @test_approx_eq.

Also, in application scripts, when I do want to print an array, I always ended up writing for-loops using @printf.

@jiahao
Copy link
Member

jiahao commented Jul 21, 2014

cc: @alanedelman, who usually defines custom rounding for printing out arrays.

@JeffBezanson
Copy link
Member

Many issues about this: #25, #29, #5709 etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants