Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Efficient Unique Nested Combinations

by Moron (Curate)
on Jun 26, 2007 at 11:15 UTC ( #623361=note: print w/ replies, xml ) Need Help??


in reply to Efficient Unique Nested Combinations

Algorithm::NestedLoops is a more general effort, whereas Math::Combinatorics is focused specifically on generating combinations and permutations - I would expect it to derive some performance from that specialisation, especially in the case of combinations which are a bit more difficult to iterate with their need to treat e.g. aab and aba as duplicate.

__________________________________________________________________________________

^M Free your mind!


Comment on Re: Efficient Unique Nested Combinations
Re^2: Efficient Unique Nested Combinations
by Roy Johnson (Monsignor) on Jun 26, 2007 at 15:06 UTC
    True, except that M::C doesn't support the operation being described: combinations generated by taking one member from each of N (possibly) distinct sets.

    Caution: Contents may have been coded under pressure.
      Au contraire, M::C supports nCk and the described operation can be expressed as a two-deep explicit nested loop of nCk next-combination calls, the lower layer being nC1.

      Update: because selecting a single member from a set is the semi-degenerate nC1 case of an nCr.

      __________________________________________________________________________________

      ^M Free your mind!

        If I understand you — and I very well may not — you'd be generating the whole set and then letting M::C filter it down. Can you illustrate what you're talking about, in Perl?

        Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://623361]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2014-08-28 00:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (254 votes), past polls