#9890: A proper random_element() method for PerfectMatchings
-----------------------------+----------------------------------------------
   Reporter:  ncohen         |       Owner:  sage-combinat
       Type:  defect         |      Status:  new          
   Priority:  major          |   Milestone:  sage-4.6     
  Component:  combinatorics  |    Keywords:               
     Author:                 |    Upstream:  N/A          
   Reviewer:                 |      Merged:               
Work_issues:                 |  
-----------------------------+----------------------------------------------
 At the moment, the method `random_element()` from PerfectMatchings
 computes a random matching by picking a random integer between 0 and the
 number of matchings on n elements, then (I presume) enumerating all the
 matchings according to some ordering until the `k`th has been computed.
 This is impressively useless.

 {{{
 sage: %timeit PerfectMatchings(12).random_element()
 5 loops, best of 3: 1.5 s per loop
 }}}

 By the way, I was not able to write a method to obtain the list of pairs
 describing the matching from an PerfectMatching object.. I don't
 understand how this class is written, and I have no idea why it needs to
 be so complicated (but it would be nice to add it to this ticket during
 the review, if someone gets how it works).

 The method random_element (and also an_element) both raise an exception
 when the set of elements is EMPTY. I also fixed the doctests.

 (I don't even get why you can build a PerfectMatchings class on an odd
 number of elements in the first place)

 I expect this ticket could be heavily modified during review, but there is
 a problem with these classes at the moment.

 Nathann

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9890>
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