#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, Simon | Reviewers:
King | Work issues: regression in
Report Upstream: N/A | right_kernel_matrix
Branch: | Commit:
u/SimonKing/ticket/15104 | 0f008f9266e3ed6fbd67e7f3d357474825bdb160
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nbruin):
Replying to [comment:18 SimonKing]:
> 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`.
True, but `new_matrix` does too much. Instantiating a new matrix via
`self.__class__.__new__(...)` has the big advantage that it avoids the
`__init__`, which has expensive argument processing and has to do a lot of
work to see how the entries need to be initialized. But a lot of these
inner routines don't care about initialization, because they'll fill the
matrix themselves any way (with a memcpy possibly!). Your timings show
that getting a quicker hold of the parent improves timings (and hence may
be worth doing generically), but to get the factor >2 speed-up I was
seeing, we probably need to avoid calling `__init__`. That's of course
tricky on a generic level, but completely doable in specific classes (as
already happens in `modn_dense_template`). Possibly improve infrastructure
to write such optimizations?
> ----
> 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:35>
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.