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

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

    if copy:
        return self.__class__((data, self.indices.copy(), self.indptr.copy()), shape=self.shape, dtype=data.dtype)
    else:
        return self.__class__((data, self.indices, self.indptr), shape=self.shape, dtype=data.dtype)
