def clifford_bottoms(c_top): r""" This function yields the next set of nq paulis that mutually commute, and anti-commute with selected elements from c_top. The intent behind this function is to begin with a list of mutually commuting Paulis, and ifnd an associated set that share the same commutation relations as :math:`\left[ X_1,\ldots,X_n \range]` and :math:`\left[ Z_1,\ldots,Z_n \range]`. This allows the input and output of this function can be thought of as the :math:`X` and :math:`Z` outputs of a Clifford operator. :param c_top: list of :class:`qecc.Pauli` objects, which mutually commute. """ nq = len(c_top) possible_zs = [] for jj in range(nq): applicable_centralizer_gens = PauliList( *(c_top[:jj] + c_top[jj + 1:])).centralizer_gens() possible_zs.append( filter(lambda a: com(a, c_top[jj]) == 1, from_generators(applicable_centralizer_gens))) for possible_set in product(*possible_zs): if all( imap( lambda twolist: pred.commutes_with(twolist[0])(twolist[1]), combinations(possible_set, 2))): yield possible_set
def ns_mod_s(*stab_gens): r""" Given the generators of a stabilizer group :math:`S`, returns an iterator that yields all elements of the set :math:`\text{N}(S)\\S`. :param qecc.Pauli stab_gens: Generators of :math:`S`. :returns: An iterator such that ``list(ns_mod_s(*stab_gens))`` contains each element of :math:`\text{N}(S)\\S`. """ nq = len(stab_gens[0]) return ifilter( pred.commutes_with(*stab_gens) & ~pred.in_group_generated_by(*stab_gens), pauli_group(nq))
def ns_mod_s(*stab_gens): r""" Given the generators of a stabilizer group :math:`S`, returns an iterator that yields all elements of the set :math:`\text{N}(S)\\S`. :param qecc.Pauli stab_gens: Generators of :math:`S`. :returns: An iterator such that ``list(ns_mod_s(*stab_gens))`` contains each element of :math:`\text{N}(S)\\S`. """ nq = len(stab_gens[0]) return ifilter( pred.commutes_with(*stab_gens) & ~pred.in_group_generated_by(*stab_gens), pauli_group(nq) )
def clifford_bottoms(c_top): r""" This function yields the next set of nq paulis that mutually commute, and anti-commute with selected elements from c_top. The intent behind this function is to begin with a list of mutually commuting Paulis, and ifnd an associated set that share the same commutation relations as :math:`\left[ X_1,\ldots,X_n \range]` and :math:`\left[ Z_1,\ldots,Z_n \range]`. This allows the input and output of this function can be thought of as the :math:`X` and :math:`Z` outputs of a Clifford operator. :param c_top: list of :class:`qecc.Pauli` objects, which mutually commute. """ nq=len(c_top) possible_zs=[] for jj in range(nq): applicable_centralizer_gens=PauliList(*(c_top[:jj]+c_top[jj+1:])).centralizer_gens() possible_zs.append(filter(lambda a:com(a,c_top[jj])==1,from_generators(applicable_centralizer_gens))) for possible_set in product(*possible_zs): if all(imap(lambda twolist: pred.commutes_with(twolist[0])(twolist[1]),combinations(possible_set,2))): yield possible_set