QuantumClifford.jl
QuantumClifford.jl copied to clipboard
Do not print out gigantic tableaux
Modify show
so that too large tableaux do not pollute the CLI
same for PauliOps and CliffordOps
this could be a useful inspiration (the code used for printing arrays in julia): https://github.com/JuliaLang/julia/blob/9028130434c5fb55e00c65e73aaf13cf0afde380/base/arrayshow.jl
how do we define "too large"? Will there be a config that the user can set? (like the way "pandas" module in python skips middle row/column there are too many of them).
Reusing some of the tools in LinearAlgebra
for printing out arrays is probably the best ways to do it. If the tools are private to the module and not guaranteed to remain stable, then some inspiration from them could still be useful.
- The
show
method for arrays detects how large the terminal is and prints dots if necessary to skip rows (e.g., see the result ofrand(100,100)
) - The
show
method checks for the "compact" hint and prints even shorter representation of arrays in such case (e.g., see the result of[rand(100)]
) - The
show
method for sparse matrices is even fancier: if the matrix is large, it prints a "unicode" plot of where the non-zero elements are
The tableaux printing can be improved along the same lines.