(self, multiplicities)
Allocates and initializes the partition stack.

        This is called from the enumeration/counting routines, so
        there is no need to call it separately.
Allocates and initializes the partition stack.
Allocates and initializes the partition stack .
def _initialize_enumeration(self, multiplicities):
        """Allocates and initializes the partition stack.

        This is called from the enumeration/counting routines, so
        there is no need to call it separately."""

        num_components = len(multiplicities)
        # cardinality is the total number of elements, whether or not distinct
        cardinality = sum(multiplicities)

        # pstack is the partition stack, which is segmented by
        # f into parts.
        self.pstack = [PartComponent() for i in
                       xrange(num_components * cardinality + 1)]
        self.f = [0] * (cardinality + 1)

        # Initial state - entire multiset in one part.
        for j in xrange(num_components):
            ps = self.pstack[j]
            ps.c = j
            ps.u = multiplicities[j]
            ps.v = multiplicities[j]

        self.f[0] = 0
        self.f[1] = num_components
        self.lpart = 0
def _initialize_enumeration ( self , multiplicities ) : num_components = len ( multiplicities ) # cardinality is the total number of elements, whether or not distinct cardinality = sum ( multiplicities ) # pstack is the partition stack, which is segmented by # f into parts. self . pstack = [ PartComponent ( ) for i in xrange ( num_components * cardinality + 1 ) ] self . f = [ 0 ] * ( cardinality + 1 ) # Initial state - entire multiset in one part. for j in xrange ( num_components ) : ps = self . pstack [ j ] ps . c = j ps . u = multiplicities [ j ] ps . v = multiplicities [ j ] self . f [ 0 ] = 0 self . f [ 1 ] = num_components self . lpart = 0