'Returns a matrix with the same sparsity structure as self,
but with different data.  By default the index arrays
(i.e. .row and .col) are copied.'

def _with_data(self, data, copy=True):

    if copy:
        return coo_matrix((data, (self.row.copy(), self.col.copy())), shape=self.shape, dtype=data.dtype)
    else:
        return coo_matrix((data, (self.row, self.col)), shape=self.shape, dtype=data.dtype)
