#15595: Shuffle Product
-----------------------+---------------------------------
Reporter: elixyre | Type: defect
Status: new | Priority: major
Milestone: sage-6.1 | Component: combinatorics
Resolution: | Report Upstream: N/A
-----------------------+---------------------------------
Shuffle product can be define on any iterable object so I propose to
define a new class that implement an efficient shuffle product on
iterables.
Currently one has two shuffle product in Sage, one is defined on words and
one is defined on permutations.
The first one is slow and don't allow to compute shuffle of two list and
the second is fast but only defined for Permutations.
Some benchmarks:
My Shuffle:
Time if *ShuffleProduct* inherits just of *SageObject*
{{{
sage: from sage.combinat.shuffle import ShuffleProduct
sage: a = Word("abcdefghij")
sage: b = Word("klmnopqrst")
sage: %time _ = list(ShuffleProduct(a, b, Word))
CPU times: user 25.88 s, sys: 1.39 s, total: 27.26 s
Wall time: 27.23 s
}}}
Time if *ShuffleProduct* inherits of the evil class *Parent*:
{{{
sage: from sage.combinat.shuffle import ShuffleProduct
sage: a = Word("abcdefghij")
sage: b = Word("klmnopqrst")
sage: %time _ = list(ShuffleProduct(a, b, Word))
CPU times: user 56.23 s, sys: 4.10 s, total: 60.33 s
Wall time: 60.58 s
}}}
Comparaison with *ShuffleProduct_w1w2*:
{{{
sage: from sage.combinat.words.shuffle_product import ShuffleProduct_w1w2
as Shuffle
sage: %time _ = list(Shuffle(a, b))
CPU times: user 59.66 s, sys: 0.29 s, total: 59.94 s
Wall time: 59.90 s
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/15595>
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/groups/opt_out.