#16288: Optimize
sage.sets.cartesian_product.CartesianProduct._cartesian_product_of_elements
-----------------------------+-------------------------------------
   Reporter:  nthiery        |            Owner:
       Type:  enhancement    |           Status:  new
   Priority:  major          |        Milestone:  sage-6.2
  Component:  combinatorics  |         Keywords:
  Merged in:                 |          Authors:  Nicolas M. Thiéry
  Reviewers:  Nathann Cohen  |  Report Upstream:  N/A
Work issues:                 |           Branch:
     Commit:                 |     Dependencies:  #16269
   Stopgaps:                 |
-----------------------------+-------------------------------------
 This fixed `_cartesian_product_of_elements` to bypass
 `_element_constructor` and other checks, and documented it; this is
 particularly relevant after #16269 which introduces more checks and
 coercion in `_element_constructor`. Timing difference:
 {{{
 sage: S1 = Sets().example()
 sage: S2 = InfiniteEnumeratedSets().example()
 sage: C = cartesian_product([S2, S1, S2])
 sage: l = tuple([S2.an_element(), S1.an_element(), S2.an_element()])
 }}}
 Without the optimization:
 {{{
 sage: %timeit C._cartesian_product_of_elements(l)
 10000 loops, best of 3: 22 µs per loop
 }}}
 With the optimization:
 {{{
 sage: %timeit C._cartesian_product_of_elements(lt)
 1000000 loops, best of 3: 922 ns per loop
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/16288>
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to