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

Improve pretty printing #85

Open
3 tasks
lostella opened this issue Oct 6, 2019 · 3 comments
Open
3 tasks

Improve pretty printing #85

lostella opened this issue Oct 6, 2019 · 3 comments

Comments

@lostella
Copy link
Member

lostella commented Oct 6, 2019

The following section of the documentation explains how to have separate behaviors for pretty printing objects and collections of objects. This is an issue in ProximalOperators, since pretty printing is very verbose and a tuple of proximable functions is displayed in a rather unreadable way: this makes me personally prefer not having any custom pretty printing at all, so I believe it could use some improvement.

https://docs.julialang.org/en/v1/manual/types/#man-custom-pretty-printing-1

  • simplify show implementation (currently too verbose, with too many unmanageable details, like the domain)
  • make sure a “compact” version is displayed when collections are displayed
  • implement pretty printing for the types which are missing it
@lostella
Copy link
Member Author

lostella commented Oct 6, 2019

cc @nantonel @mfalt

@lostella lostella changed the title Replace show with summary Improve pretty printing Oct 6, 2019
@nantonel
Copy link
Collaborator

nantonel commented Oct 7, 2019

Definitively agree we should simplify this:

julia> using ProximalOperators

julia> NormL1()
description : weighted L1 norm
domain      : AbstractArray{Real}, AbstractArray{Complex}
expression  : x  λ||x||_1
parameters  : λ = 1.0

We could have only the expression, something like:

julia> NormL1()
x  1.0 ||x||_1

or maybe even shorter:

julia> NormL1()
1.0 ||x||_1

@nantonel
Copy link
Collaborator

nantonel commented Oct 7, 2019

If we decide to completey avoid pretty printing, it works fine for some sfuff:

julia> NormL1()
NormL1{Float64}(1.0)

but it's quite horrible in other cases:

julia> IndAffine(randn(3,3),randn(3))
ProximalOperators.IndAffineDirect{Float64,Float64,Array{Float64,2},Array{Float64,1},LinearAlgebra.QRCompactWY{Float64,Array{Float64,2}}}([0.7540902122955551 -0.5127888696402579 -0.41036024039021046; 0.3041711542264574 -0.8821531613533968 0.3595632195466501; -0.6471214161239671 0.7621617642057313 0.018528841747891156], [-0.38375757488811657, -1.3589036717591345, 0.7437271582522681], LinearAlgebra.QRCompactWY{Float64,Array{Float64,2}}([-1.0 -0.5341803635161604 0.8864194955698212; -0.2923389378982839 0.8453705336914357 -0.46016377902426897; -0.23394477519669718 -0.3748487888220175 -0.05009764812690726], [1.754090212295555 0.6294821130997797 0.0; 5.0e-324 1.753598976639561 0.0; 2.297204718e-314 2.2972047183e-314 0.0]), [2.1888445724e-314, 2.1885385205e-314, 2.1885430936e-314])

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

No branches or pull requests

2 participants