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

creating symbolic matrices is insanely slow #2053

Closed
williamstein opened this issue Feb 5, 2008 · 6 comments
Closed

creating symbolic matrices is insanely slow #2053

williamstein opened this issue Feb 5, 2008 · 6 comments

Comments

@williamstein
Copy link
Contributor

On the fastest modern hardware we have:

sage: time m = matrix(SR, 20, [1..20^2])
CPU times: user 0.34 s, sys: 0.12 s, total: 0.45 s
Wall time: 1.05

which is frickin' slow. And the time isn't just in coercion, since

sage: time v = [SR(a) for a in [1..20^2]]
CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
Wall time: 0.01

Component: calculus

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

@williamstein williamstein added this to the sage-2.10.2 milestone Feb 5, 2008
@williamstein williamstein self-assigned this Feb 5, 2008
@williamstein
Copy link
Contributor Author

comment:1

The attached patch fixes this problem. Now the following works and speeds
up the above benchmark by a huge amount:

sage: time m = matrix(SR, 20, [1..20^2])
CPU times: user 0.02 s, sys: 0.00 s, total: 0.02 s
Wall time: 0.07
sage: time m = matrix(SR, 50, [1..50^2])
CPU times: user 0.07 s, sys: 0.02 s, total: 0.09 s
Wall time: 0.46
sage: time m = matrix(SR, 100, [1..100^2])
CPU times: user 0.26 s, sys: 0.02 s, total: 0.27 s
Wall time: 0.49

Even a 500x500 matrix is possible, which used to be out
of the question.

sage: time m = matrix(SR, 500, [1..500^2])
CPU times: user 6.79 s, sys: 0.39 s, total: 7.17 s
Wall time: 13.32

@williamstein
Copy link
Contributor Author

Attachment: trac-2053-symbolic_matrices_slow.patch.gz

@mwhansen
Copy link
Contributor

mwhansen commented Feb 6, 2008

comment:2

I cannot apply this due to a failed hunk with the docstring in set_from_list.

@mwhansen mwhansen changed the title creating symbolic matrices is insanely slow [negative review] creating symbolic matrices is insanely slow Feb 6, 2008
@williamstein
Copy link
Contributor Author

Attachment: trac-2053-fix_symbolic.patch.gz

apply this INSTEAD!

@mwhansen
Copy link
Contributor

mwhansen commented Feb 7, 2008

comment:3

Looks good to me.

@mwhansen mwhansen changed the title [negative review] creating symbolic matrices is insanely slow creating symbolic matrices is insanely slow Feb 7, 2008
@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Feb 7, 2008

comment:4

Merged the second patch only in Sage 2.10.2.alpha2

@sagetrac-mabshoff sagetrac-mabshoff mannequin closed this as completed Feb 7, 2008
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