'Compress rows, cols, vals / summing duplicates. Sort for csr format.'

def compress_csr(self):

    (_, unique, indices) = np.unique(((self.m * self.rows) + self.cols), return_index=True, return_inverse=True)
    self.rows = self.rows[unique]
    self.cols = self.cols[unique]
    self.vals = np.bincount(indices, weights=self.vals)
