#13196: GL(n, GF(q)).random_element() is way too slow for what it does
--------------------------------------------------------------+-------------
       Reporter:  Bouillaguet                                 |         Owner:  
joyner      
           Type:  enhancement                                 |        Status:  
needs_review
       Priority:  major                                       |     Milestone:  
sage-5.2    
      Component:  performance                                 |    Resolution:  
            
       Keywords:  matrix group, finite field, random element  |   Work issues:  
            
Report Upstream:  N/A                                         |     Reviewers:  
            
        Authors:  Charles Bouillaguet                         |     Merged in:  
            
   Dependencies:                                              |      Stopgaps:  
            
--------------------------------------------------------------+-------------
Description changed by jlopez:

Old description:

> GL(32, GF(2)).random_element() takes more than 10s, which is ridiculous.
>
> Proposed solution : use simple rejection sampling (i.e. generate a random
> matrix, check if it invertible, if not try again). The result is
> uniformly distributed amongst invertible matrices.
>
> Before patch:
> {{{
> sage: %time GL(64, GF(2)).random_element()
> 5 loops, best of 3: 15.5 s per loop
> }}}
>
> After patch :
> {{{
> sage: %timeit GL(64, GF(2)).random_element()
> 625 loops, best of 3: 2ms per loop
> }}}

New description:

 GL(32, GF(2)).random_element() takes more than 10s, which is ridiculous.

 Proposed solution : use simple rejection sampling (i.e. generate a random
 matrix, check if it invertible, if not try again). The result is uniformly
 distributed amongst invertible matrices.

 Before patch:
 {{{
 sage: %time GL(64, GF(2)).random_element()
 5 loops, best of 3: 15.5 s per loop
 }}}

 After patch :
 {{{
 sage: %timeit GL(64, GF(2)).random_element()
 625 loops, best of 3: 2ms per loop
 }}}

 Apply [attachment: gln_gfq_random.patch] and [attachment:
 trac_13196.improvement.patch]

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13196#comment:18>
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.

Reply via email to