def _density(self): proditer = product(*[space._density.iteritems() for space in self.spaces]) d = {} for items in proditer: elems, probs = zip(*items) elem = sumsets(elems) prob = Mul(*probs) d[elem] = d.get(elem, 0) + prob return Dict(d)
def _density(self): proditer = product( *[space._density.iteritems() for space in self.spaces]) d = {} for items in proditer: elems, probs = zip(*items) elem = sumsets(elems) prob = Mul(*probs) d[elem] = d.get(elem, 0) + prob return Dict(d)
def __iter__(self): proditer = product(*self.domains) return (sumsets(items) for items in proditer)