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

Having an option to truncate large array printing. #16251

Open
sylee957 opened this issue Mar 14, 2019 · 3 comments · May be fixed by #26284 or #26526
Open

Having an option to truncate large array printing. #16251

sylee957 opened this issue Mar 14, 2019 · 3 comments · May be fixed by #26284 or #26526

Comments

@sylee957
Copy link
Member

For the Jupter workflow, often, such printing causes great slowdown, and even crashes.
However, for the latex representations, there is a natural way to express such large arrays in more compact form, like below.

And I believe that sympy's latex printer can do some work in the middle, to automatically trim some large arrays in printing, unless the user specifies it to print its full form.

For example, Mathematica automatically does some alternative representation for objects, that are expected to be slow to print.

Even though, Mathematica notebook's IO is different from Jupyter.

@mohamedrezk122
Copy link
Contributor

mohamedrezk122 commented Feb 27, 2024

Should the width (number of columns) of the trimmed matrix be hard-coded ?? similarly for the height

@mohamedrezk122
Copy link
Contributor

Should I submit a PR for that ?

compactify rows and cols

image

rows and cols do not cross threshold

image

only rows cross threshold

image

only cols cross threshold

image

and of course the not compact version

image

mohamedrezk122 added a commit to mohamedrezk122/sympy that referenced this issue Feb 27, 2024
…ting

The `_print_matrix_contents` method now includes options for compactifying
and setting maximum visible rows and columns, providing a more readable
representation. This improvement prevents printing slowdowns for large
matrices and improves overall user experience. This modification shall
solve sympy#16251.
@sylee957
Copy link
Member Author

In SymPy, it may be a bit more challenging to implement this because SymPy expressions, itself typically, have many varying sizes, and small matrix with big expressions, can also get to issues of stuck of printing.

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