#13204: Element construction for CrystalOfTableaux should be robust versus  
int's
----------------------------------+-----------------------------------------
       Reporter:  nthiery         |         Owner:  sage-combinat    
           Type:  defect          |        Status:  needs_info       
       Priority:  major           |     Milestone:  sage-5.7         
      Component:  combinatorics   |    Resolution:                   
       Keywords:                  |   Work issues:                   
Report Upstream:  N/A             |     Reviewers:  Nicolas M. ThiƩry
        Authors:  Anne Schilling  |     Merged in:                   
   Dependencies:                  |      Stopgaps:                   
----------------------------------+-----------------------------------------

Comment (by tscrim):

 Here's a few other things I've tried:

 With first checking an `isinstance()`:
 {{{
 letters_type = type(parent.letters) # It was slightly slower to put this
 in the lambda function
 letters_check = lambda x: x if isinstance(x, letters_type) else
 parent.letters(x)
 TensorProductOfCrystalsElement.__init__(self, parent, map(letters_check,
 list))

 sage: %timeit L = [x for x in B]
 5 loops, best of 3: 661 ms per loop
 }}}

 By using the `in` check:
 {{{
 letters_check = lambda x: x if x in parent.letters else parent.letters(x)
 TensorProductOfCrystalsElement.__init__(self, parent, map(letters_check,
 list))

 sage: %timeit L = [x for x in B]
 5 loops, best of 3: 852 ms per loop
 }}}

 Here's my baseline timing with the current patch:
 {{{
 sage: %timeit L = [x for x in B]
 5 loops, best of 3: 610 ms per loop
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13204#comment:3>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to