def subcube_basis_from_sector(sector): root_basis = dict() refs = sector_refs[perm_key(sector, pxp)] for n in range(0, np.size(refs, axis=0)): root_basis[n] = np.zeros(pxp.dim) Hm = Hm_from_ref(refs[n]) Hm = np.conj(np.transpose(Hm)) current_state = ref_state(refs[n], pxp).prod_basis() while (np.abs(current_state) < 1e-5).all() == False: root_basis[n] = np.vstack((root_basis[n], current_state)) current_state = np.dot(Hm, current_state) root_basis[n] = np.transpose(np.delete(root_basis[n], 0, axis=0)) #form superposition from all roots basis = root_basis[0] for n in range(1, len(root_basis)): basis = basis + root_basis[n] #normalize for n in range(0, np.size(basis, axis=1)): basis[:, n] = basis[:, n] / np.power(np.vdot(basis[:, n], basis[:, n]), 0.5) return basis
sector_refs = dict() from_sector = dict() for n in range(0, np.size(pxp.basis_refs, axis=0)): bits = pxp.basis[n] #find perm sector c1 = 0 c2 = 0 for m in range(0, np.size(bits, axis=0)): if bits[m] == 1: if m % 2 == 0: c1 = c1 + 1 else: c2 = c2 + 1 sector = np.array([c1, c2]) from_sector[pxp.basis_refs[n]] = sector key = perm_key(sector, pxp) if key in sector_refs.keys(): sector_refs[key] = np.append(sector_refs[key], pxp.basis_refs[n]) else: sector_refs[key] = [pxp.basis_refs[n]] consec_flips = dict() flippable_zeros = dict() for n in range(0, np.size(pxp.basis_refs, axis=0)): bits = pxp.basis[n] n_flip = [] m_flip = [] for k in range(0, np.size(bits, axis=0)): if k == int(np.size(bits) - 1): kp1 = 0 else: