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

plotting sparse matrices converts the matrix to a dense matrix #6554

Closed
jasongrout opened this issue Jul 18, 2009 · 10 comments
Closed

plotting sparse matrices converts the matrix to a dense matrix #6554

jasongrout opened this issue Jul 18, 2009 · 10 comments

Comments

@jasongrout
Copy link
Member

Plotting big sparse matrices doesn't even work since it automatically converts the matrix to a dense matrix, instead of calling the spy() function.

CC: @rbeezer @mwhansen @williamstein @sagetrac-wcauchois @robertwb

Component: linear algebra

Author: Jason Grout

Reviewer: David Joyner

Merged: Sage 4.1.1.rc0

Issue created by migration from https://trac.sagemath.org/ticket/6554

@jasongrout
Copy link
Member Author

comment:1

Attachment: trac-6554-sparse-matrix-plot.patch.gz

This took a very long time before, if it was even possible.

        sage: A=random_matrix(ZZ,100000,density=.00001,sparse=True)
        sage: matrix_plot(A,marker=',')

@jasongrout
Copy link
Member Author

comment:2

(To those I'm adding as CC): if you have time, could you review this ticket? This is a simple change that makes plotting sparse matrices possible. Currently, it is very, very slow or is not even really possible to plot large sparse matrices because Sage immediately converts the matrix to a dense matrix.

@jasongrout
Copy link
Member Author

comment:3

It would be really great if this was reviewed in time for the Monday deadline for 4.1.1. This is a simple change that makes plotting sparse matrices possible. Currently, it is very, very slow or is not even really possible to plot large sparse matrices because Sage immediately converts the matrix to a dense matrix.

@wdjoyner
Copy link

comment:4

This installs fine (amd64 ubuntu 9.04, sage 4.1.1.alpha0) and I'm running tests now. However, why is it that

sage: B = random_matrix(ZZ, 10, 20, density=.4, sparse=True, x = 10)
sage: matrix_plot(B, cmap='hsv').show(axes=False)

returns a ble-and white scatterplot, but

sage: C = random_matrix(ZZ, 10, 20, x = 10)
sage: matrix_plot(C, cmap='hsv').show(axes=False)

returns a multi-colored plot? The docstring indicates that the colors plotted
indicate the relative difference in sizes between the matrix entries. This seems
to be incorrect, unless I am missing something, in the sparse case. Should a
comment to this effect be added to the docstring?

@jasongrout
Copy link
Member Author

Attachment: trac-6554-matrix-plot-docs.patch.gz

apply on top of previous patch

@jasongrout
Copy link
Member Author

comment:5

Good point; the docstring should be updated. I've attached a small patch that updates the docstring. Can you review this docstring change?

@wdjoyner
Copy link

comment:6

Yes, looks good and passes sage -testall (intel macbook, OS 10.4.11) except for

        sage -t  "devel/sage/sage/parallel/decorate.py"
        sage -t  "devel/sage/sage/symbolic/expression.pyx"

They seem unrelated. As far as I am concerned, this gets a positive review.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Jul 29, 2009

comment:7

Merged both patches.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Jul 29, 2009

Reviewer: David Joyner

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Jul 29, 2009

Merged: Sage 4.1.1.rc0

@sagetrac-mvngu sagetrac-mvngu mannequin closed this as completed Jul 29, 2009
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

3 participants