'Eliminate duplicate matrix entries by adding them together
The is an *in place* operation'

def sum_duplicates(self):

    if self.has_canonical_format:
        return
    self.sort_indices()
    (M, N) = self._swap(self.shape)
    _sparsetools.csr_sum_duplicates(M, N, self.indptr, self.indices, self.data)
    self.prune()
    self.has_canonical_format = True
