#18987: Parallel computation for TilingSolver.number_of_solutions
-------------------------+-------------------------------------------------
Reporter: | Owner:
slabbe | Status: needs_review
Type: | Milestone: sage-6.9
enhancement | Resolution:
Priority: major | Merged in:
Component: | Reviewers: Vincent Delecroix
combinatorics | Work issues:
Keywords: | Commit:
Authors: | 0d68ecec28cb92d9e78a92d6e733d42b3e8941c1
Sébastien Labbé | Stopgaps:
Report Upstream: N/A |
Branch: |
public/18987 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by slabbe):
> > Replying to [comment:42 vdelecroix]:
> > > Are you sure `ncube_isometry_group` is worth a `@cached_function`?
In fact, you make me realize that there is already caching involved in
!WeylGroup. Therefore caching that function is not so necessary. Without
caching, I get:
{{{
sage: from sage.combinat.tiling import ncube_isometry_group
sage: time L = ncube_isometry_group(4)
CPU times: user 1.14 s, sys: 19.7 ms, total: 1.16 s
Wall time: 1.3 s
sage: time L = ncube_isometry_group(4)
CPU times: user 358 ms, sys: 4.01 ms, total: 362 ms
Wall time: 448 ms
}}}
> {{{
> sage: from itertools import product
> sage: %timeit M = [diagonal_matrix(p) for p in product([1,-1],
repeat=4)]
> 1 loops, best of 3: 2.9 ms per loop
> sage: M = [diagonal_matrix(p) for p in product([1,-1], repeat=4)]
> sage: %timeit S = [m*s.matrix() for m in M for s in SymmetricGroup(4)]
> 100 loops, best of 3: 18.3 ms per loop
> }}}
> So it is likely to be `~20ms`.
Note that you can't use timeit above since there is caching involved in
!SymmetricGroup.
For comparison, your solution on my machine gives the following timings:
{{{
#!python
sage: from itertools import product
sage: # first call
sage: time M = [diagonal_matrix(p) for p in product([1,-1], repeat=4)]
CPU times: user 11.4 ms, sys: 92 µs, total: 11.5 ms
Wall time: 11.9 ms
sage: time S = [m*s.matrix() for m in M for s in SymmetricGroup(4)]
CPU times: user 191 ms, sys: 25.2 ms, total: 216 ms
Wall time: 667 ms
sage: # second call
sage: time M = [diagonal_matrix(p) for p in product([1,-1], repeat=4)]
CPU times: user 11.7 ms, sys: 1.34 ms, total: 13 ms
Wall time: 16.6 ms
sage: time S = [m*s.matrix() for m in M for s in SymmetricGroup(4)]
CPU times: user 108 ms, sys: 1.92 ms, total: 110 ms
Wall time: 114 ms
}}}
So it seems using `WeylGroup(['B',4])` is about 4 times slower than your
solution. But I don't know if I will change it. I mean that improvement
could be done directly in `WeylGroup` code...
--
Ticket URL: <http://trac.sagemath.org/ticket/18987#comment:48>
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.