#15104: Special case modn_dense matrix operations to improve performance
-------------------------------------+-------------------------------------
Reporter: nbruin | Owner:
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-6.2
Component: linear algebra | Resolution:
Keywords: | Merged in:
Authors: Nils Bruin | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/SimonKing/ticket/15104 | 0f008f9266e3ed6fbd67e7f3d357474825bdb160
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by SimonKing):
* commit: a908e28159a544ca33f03dcbf0e8def3cfe9a60e =>
0f008f9266e3ed6fbd67e7f3d357474825bdb160
Comment:
With your branch, I got
{{{
sage: k=GF(17)
sage: A=matrix(k,100,101,[k.random_element() for i in range(100*101)])
sage: B=matrix(k,100,100,[k.random_element() for i in range(100*100)])
sage: %timeit At=A.transpose()
10000 loops, best of 3: 68.5 us per loop
sage: %timeit Bt=B.transpose()
10000 loops, best of 3: 48.7 us per loop
}}}
With the additional commits that I have just pushed, I get
{{{
sage: k=GF(17)
sage: A=matrix(k,100,101,[k.random_element() for i in range(100*101)])
sage: B=matrix(k,100,100,[k.random_element() for i in range(100*100)])
sage: %timeit At=A.transpose()
10000 loops, best of 3: 49.9 us per loop
sage: %timeit Bt=B.transpose()
10000 loops, best of 3: 49.3 us per loop
}}}
So, looks like progress.
My changes are: I added a lazy attribute to matrix spaces, returning the
transposed matrix space, and I am using it in `.new_matrix()`. This has
the advantage that it is a generic method used by different custom
implementations of `.transpose()`. Hence, there should be a speed-up for
all types of matrices, not only for `Matrix_modn_dense_float`.
----
New commits:
||[http://git.sagemath.org/sage.git/commit/?id=5487c67cc851fe4febec8e61c04a526986d074f0
5487c67]||{{{Trac 15104: Faster creation of transposed matrix' parent}}}||
||[http://git.sagemath.org/sage.git/commit/?id=0f008f9266e3ed6fbd67e7f3d357474825bdb160
0f008f9]||{{{Trac 15104: Add a test for the new lazy attribute}}}||
--
Ticket URL: <http://trac.sagemath.org/ticket/15104#comment:18>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.