def _accumulateFrequencyCounts(values, freqCounts=None):
 values = numpy.array(values)
 numEntries = (values.max() + 1)
 if (freqCounts is not None):
  numEntries = max(numEntries, freqCounts.size)
 if (freqCounts is not None):
  if (freqCounts.size != numEntries):
   newCounts = numpy.zeros(numEntries, dtype='int32')
   newCounts[0:freqCounts.size] = freqCounts
  else:
   newCounts = freqCounts
 else:
  newCounts = numpy.zeros(numEntries, dtype='int32')
 for v in values:
  newCounts[v] += 1
 return newCounts

def _accumulateFrequencyCounts ( values , freqCounts = None ) : values = numpy . array ( values ) numEntries = ( values . max ( ) + 1 ) if ( freqCounts is not None ) : numEntries = max ( numEntries , freqCounts . size ) if ( freqCounts is not None ) : if ( freqCounts . size != numEntries ) : newCounts = numpy . zeros ( numEntries , dtype = 'int32' ) newCounts [ 0 : freqCounts . size ] = freqCounts else : newCounts = freqCounts else : newCounts = numpy . zeros ( numEntries , dtype = 'int32' ) for v in values : newCounts [ v ] += 1 return newCounts
accumulate a list of values values into the frequency counts freqcounts .