Hello,

We currently have two much implementation of 2x2 matrices. I found at
least three that leads to distinct element classes

sage: M1 = SL2Z
sage: M2 = MatrixSpace(ZZ,2)
sage: from sage.matrix.matrix_integer_2x2 import MatrixSpace_ZZ_2x2
sage: M3 = MatrixSpace_ZZ_2x2()

sage: m1 = M1([2,1,1,1])
sage: m2 = M2([2,1,1,1])
sage: m3 = M3([2,1,1,1])

SL2Z is mostly used in code related to modular forms. And I found only
one place where MatrixSpace_ZZ_2x2 is used. I would like to:
 - try to remove the special class we have for SL2Z (or at least
inherit from the generic 2x2 integer which is faster and interacts
nicely with the rest of matrix code)
 - make the MatrixSpace_ZZ_2x2 be the default when we call "MatrixSpace(ZZ,2)".

I wanted to ask about opinions before starting.

Vincent

PS: benchmark

sage: %timeit m1**1001
1000 loops, best of 3: 237 µs per loop
sage: %timeit m1*m1
100000 loops, best of 3: 14.8 µs per loop

sage: %timeit m2**1001
10000 loops, best of 3: 74.4 µs per loop
sage: %timeit m2*m2
100000 loops, best of 3: 4.4 µs per loop

sage: %timeit m3**1001
10000 loops, best of 3: 19.3 µs per loop
sage: %timeit m3*m3
1000000 loops, best of 3: 847 ns per loop

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to