#8096: Speed up parent creation for multiplication of square matrices
------------------------------+---------------------------------------------
Reporter: boothby | Owner: boothby
Type: defect | Status: needs_review
Priority: minor | Milestone:
Component: linear algebra | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Changes (by boothby):
* status: new => needs_review
Comment:
I'm not sure that I did this in the right place, but it cuts the time to
multiply two 1x1 matrices down to 1/3 of the previous time -- which is
still dog slow, but significantly better. As a reference,
{{{
sage: A = GF(3).random_element()
sage: B = GF(3).random_element()
sage: timeit("C = A*B")
625 loops, best of 3: 142 ns per loop
}}}
and with this patch, I'm getting:
{{{
sage: d = 1
sage: A = random_matrix(GF(3), d)
sage: B = random_matrix(GF(3), d)
sage: timeit("C = A*B")
625 loops, best of 3: 32.5 µs per loop
sage: import profile
sage: profile.run("for i in range(10000): C = A*B")
250004 function calls in 1.840 CPU seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
40000 0.120 0.000 0.120 0.000 :0(IntegerMod)
10000 0.070 0.000 0.070 0.000 :0(hasattr)
10000 0.060 0.000 0.060 0.000 :0(is_Matrix)
70000 0.190 0.000 0.190 0.000 :0(isinstance)
1 0.000 0.000 0.000 0.000 :0(range)
1 0.000 0.000 0.000 0.000 :0(setprofile)
1 0.400 0.400 1.840 1.840 <string>:1(<module>)
20000 0.060 0.000 0.060 0.000
finite_field_prime_modn.py:121(characteristic)
40000 0.230 0.000 0.350 0.000
integer_mod_ring.py:733(__call__)
10000 0.060 0.000 0.070 0.000
matrix_group_element.py:68(is_MatrixGroupElement)
10000 0.390 0.000 0.720 0.000 matrix_space.py:1035(matrix)
10000 0.030 0.000 0.030 0.000 matrix_space.py:1112(ncols)
10000 0.020 0.000 0.020 0.000 matrix_space.py:1124(nrows)
10000 0.160 0.000 1.100 0.000
matrix_space.py:271(__call__)
10000 0.050 0.000 0.050 0.000 misc.py:514(get_verbose)
1 0.000 0.000 1.840 1.840 profile:0(for i in
range(10000): C = A*B)
0 0.000 0.000 profile:0(profiler)
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8096#comment:2>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.