'Returns a matrix with the same sparsity structure as self,
but with different data.  By default the structure arrays are copied.'

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

    if copy:
        return dia_matrix((data, self.offsets.copy()), shape=self.shape)
    else:
        return dia_matrix((data, self.offsets), shape=self.shape)
