2014-11-16 5:42 UTC−07:00, Fredrik  Johansson <fredrik.johans...@gmail.com>:
>
>
> On Sunday, November 16, 2014 5:45:01 AM UTC+1, vdelecroix wrote:
>>
>> 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
>>
>
> Is this with or without http://trac.sagemath.org/ticket/16803 ?
>
> In C, m**1001 takes 6 µs and m*m takes < 200 ns for me with flint.

Hello Frederik,

I did the benchmark on sage-6.4 in which #16803 is already merged.
What do you mean by "in C"?

Vincent

-- 
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