#5345: [with patch, needs review] Optimize transpose for dense matrices
----------------------------+-----------------------------------------------
Reporter: rbeezer | Owner: rbeezer
Type: enhancement | Status: new
Priority: major | Milestone: sage-3.4.1
Component: linear algebra | Keywords: transpose
----------------------------+-----------------------------------------------
Changes (by mabshoff):
* priority: trivial => major
Old description:
> This patch has two changes to the transpose method in matrix_dense.pyx to
> provide about a 15% speedup. If this is accepted, I'll look into the
> other non-sparse routines for transpose and antitranspose.
>
> 1. A double loop indexes into the list of matrix entries using
> multiplication to create a reordered list for the transpose. The effect
> of the multiplications is replaced by repeated additions.
>
> 2. Retrieving the list in the original matrix makes a copy with list().
> This has been replaced by the internal _list() to just reference the
> original.
>
> Passes sage -t for matrix2.pyx and matrix_dense.pyx
> {{{
> m = identity_matrix(5000)
> time m.transpose()
> }}}
> Timings (user + system):[[BR]]
> 11.94s : Stock 3.3[[BR]]
> 11.20s : No multiplication[[BR]]
> 10.18s : No multiplication, with _list()[[BR]]
New description:
This patch has two changes to the transpose method in matrix_dense.pyx to
provide about a 15% speedup. If this is accepted, I'll look into the
other non-sparse routines for transpose and antitranspose.
1. A double loop indexes into the list of matrix entries using
multiplication to create a reordered list for the transpose. The effect
of the multiplications is replaced by repeated additions.
2. Retrieving the list in the original matrix makes a copy with list().
This has been replaced by the internal _list() to just reference the
original.
Passes sage -t for matrix2.pyx and matrix_dense.pyx
{{{
m = identity_matrix(5000)
time m.transpose()
}}}
Timings (user + system):
* 11.94s : Stock 3.3
* 11.20s : No multiplication
* 10.18s : No multiplication, with _list()
--
Comment:
A 18% speed improvement is never "trivial" for something like a basic
operation like this :)
Cheers,
Michael
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5345#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---