本文整理汇总了Python中PauliClass.pad方法的典型用法代码示例。如果您正苦于以下问题:Python PauliClass.pad方法的具体用法?Python PauliClass.pad怎么用?Python PauliClass.pad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PauliClass
的用法示例。
在下文中一共展示了PauliClass.pad方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: transcoding_cliffords
# 需要导入模块: import PauliClass [as 别名]
# 或者: from PauliClass import pad [as 别名]
def transcoding_cliffords(self,other):
r"""
Returns an iterator onto all :class:`qecc.Clifford` objects which
take states specified by ``self``, and
return states specified by ``other``.
:arg other: :class:`qecc.StabilizerCode`
"""
#Preliminaries:
stab_in = self.group_generators
stab_out = other.group_generators
xs_in = self.logical_xs
xs_out = other.logical_xs
zs_in = self.logical_zs
zs_out = other.logical_zs
nq_in=len(stab_in[0])
nq_out=len(stab_out[0])
nq_anc=abs(nq_in-nq_out)
#Decide left side:
if nq_in<nq_out:
stab_left=stab_out
xs_left=xs_out
zs_left=zs_out
stab_right=stab_in
xs_right=xs_in
zs_right=zs_in
else:
stab_right=stab_out
xs_right=xs_out
zs_right=zs_out
stab_left=stab_in
xs_left=xs_in
zs_left=zs_in
cliff_xouts_left=stab_left+xs_left
cliff_zouts_left=[Unspecified]*len(stab_left)+zs_left
cliff_left=c.Clifford(cliff_xouts_left,cliff_zouts_left).constraint_completions().next()
list_left=cliff_left.xout+cliff_left.zout
for mcset in p.mutually_commuting_sets(n_elems=len(stab_left)-len(stab_right),n_bits=nq_anc):
temp_xouts_right = p.pad(stab_right,lower_right=mcset) + map(lambda elem: elem & p.eye_p(nq_anc), xs_right)
temp_zouts_right = [Unspecified]*len(stab_left) + map(lambda elem: elem & p.eye_p(nq_anc), zs_right)
for completion in c.Clifford(temp_xouts_right,temp_zouts_right).constraint_completions():
if nq_in < nq_out:
yield c.gen_cliff(completion.xout+completion.zout,list_left)
else:
yield c.gen_cliff(list_left,completion.xout+completion.zout)