def reindex(self, new_idx: Sequence[Sequence[int]], inplace: bool = False): if inplace: self.coeff = [ coeff[:, idx] for idx, coeff in zip(new_idx, self.coeff) ] self.energy = _reindex(self.energy, new_idx) self.idx = _reindex(self.idx, new_idx) self.occ = _reindex(self.occ, new_idx) else: new = self.copy() new.reindex(new_idx, inplace=True) return new
def reindex(self, new_idx: Sequence[Sequence[int]], inplace: bool=False): if inplace: self.coeff = { spin: [coeff[:, idx] for idx, coeff in zip(new_idx, spin_values)] for spin, spin_values in self.coeff.items()} self.energy = _spin_reindex(self.energy, new_idx) self.idx = _reindex(self.idx, new_idx) self.occ = _spin_reindex(self.occ, new_idx) else: new = self.copy() new.reindex(new_idx, inplace=True) return new