#16269: Cartesian Products of additive groups
-------------------------------------+-------------------------------------
Reporter: ncohen | Owner:
Type: enhancement | Status: positive_review
Priority: major | Milestone: sage-6.2
Component: categories | Resolution:
Keywords: | Merged in:
Authors: Nathann Cohen, | Reviewers: Nathann Cohen,
Nicolas M. Thiéry | Nicolas M. Thiéry
Report Upstream: N/A | Work issues:
Branch: u/nthiery/16269 | Commit:
Dependencies: #16280 | 0a54b68c242cc6541108b709170c35b3a79515b8
| Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nthiery):
Hi,
I fixed `_cartesian_product_of_elements` to bypass `_element_constructor`
and other checks, and documented it. Here is the 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
}}}
If you are fine including this in this ticket, please change the branch to
`u/nthiery/16269-optimized`. Otherwise, I'll move this commit to a follow
up ticket.
For the record: the tests pass on the cartesian_product.py file. Running
all long tests now to be sure.
Cheers,
Nicolas
--
Ticket URL: <http://trac.sagemath.org/ticket/16269#comment:39>
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.