本文整理汇总了Python中BitVector.runs方法的典型用法代码示例。如果您正苦于以下问题:Python BitVector.runs方法的具体用法?Python BitVector.runs怎么用?Python BitVector.runs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitVector
的用法示例。
在下文中一共展示了BitVector.runs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BitVector
# 需要导入模块: import BitVector [as 别名]
# 或者: from BitVector import runs [as 别名]
# mod = BitVector(bitstring = '100011011')
# n = 8
# bitarrays = [BitVector(intVal=x, size=n) for x in range(1,2**8)]
# mi_list = [x.gf_MI(mod,n) for x in bitarrays]
# mi_str_list = [str(x.gf_MI(mod,n)) for x in bitarrays]
# print("\nMultiplicative Inverses:\n\n" + str(mi_str_list))
# products = [ str(bitarrays[i].gf_multiply_modular(mi_list[i], mod, n)) \
# for i in range(len(bitarrays)) ]
# print("\nShown below is the product of each binary code word " +\
# "in GF(2^3) and its multiplicative inverse:\n\n")
# print(products)
print("\nExperimenting with runs():")
bv = BitVector(bitlist=(1, 0, 0, 1))
print("For bit vector: " + str(bv))
print(" the runs are: " + str(bv.runs()))
bv = BitVector(bitlist=(1, 0))
print("For bit vector: " + str(bv))
print(" the runs are: " + str(bv.runs()))
bv = BitVector(bitlist=(0, 1))
print("For bit vector: " + str(bv))
print(" the runs are: " + str(bv.runs()))
bv = BitVector(bitlist=(0, 0, 0, 1))
print("For bit vector: " + str(bv))
print(" the runs are: " + str(bv.runs()))
bv = BitVector(bitlist=(0, 1, 1, 0))
print("For bit vector: " + str(bv))
print(" the runs are: " + str(bv.runs()))
print("\nExperiments with chained invocations of circular shifts:")
bv = BitVector(bitlist=(1, 1, 1, 0, 0, 1))