code: def _computeOverlaps(data, selfOverlaps=False, dtype="int16"):
      
      nVectors = data.shape[0]
      nDims = data.shape[1]
      nPairs = (nVectors+1)*nVectors/2 if selfOverlaps else (
        nVectors*(nVectors-1)/2)
      overlaps = numpy.ndarray(nPairs, dtype=dtype)
      pos = 0
  
      for i in xrange(nVectors):
        start = i if selfOverlaps else i+1
        a = data[i]
        b = data[start:]
        newOverlaps = a.multiply(b).getnnz(1)
        run = newOverlaps.shape[0]
        overlaps[pos:pos+run] = newOverlaps
        pos += run
      return overlaps
docs: Calculates all pairwise overlaps between the rows of the input. Returns an
      array of all n(n-1)/2 values in the upper triangular portion of the
      pairwise overlap matrix. Values are returned in row-major order.
  
      @param data (scipy.sparse.csr_matrix) A CSR sparse matrix with one vector
          per row. Any non-zero value is considered an active bit.
  
      @param selfOverlaps (boolean) If true, include diagonal (density) values
          from the pairwise similarity matrix. Then the returned vector has
          n(n+1)/2 elements. Optional, defaults to False.
      
      @param dtype (string) Data type of returned array in numpy dtype format.
          Optional, defaults to 'int16'.
      
      @returns (numpy.ndarray) A vector of pairwise overlaps as described above.