Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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
Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2015-10-10 18:28 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (257 votes), past polls