本文整理汇总了Python中BitVector.unpermute方法的典型用法代码示例。如果您正苦于以下问题:Python BitVector.unpermute方法的具体用法?Python BitVector.unpermute怎么用?Python BitVector.unpermute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitVector
的用法示例。
在下文中一共展示了BitVector.unpermute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: import BitVector [as 别名]
# 或者: from BitVector import unpermute [as 别名]
print(
"\nExperiment in 64-bit permutation and unpermutation of the previous 64-bit bitvector:")
print(
"The permutation array was generated separately by the Fisher-Yates shuffle algorithm:")
bv2 = bv1.permute([22, 47, 33, 36, 18, 6, 32, 29, 54, 62, 4,
9, 42, 39, 45, 59, 8, 50, 35, 20, 25, 49,
15, 61, 55, 60, 0, 14, 38, 40, 23, 17, 41,
10, 57, 12, 30, 3, 52, 11, 26, 43, 21, 13,
58, 37, 48, 28, 1, 63, 2, 31, 53, 56, 44, 24,
51, 19, 7, 5, 34, 27, 16, 46])
print("Permuted bit vector:")
print(bv2)
bv3 = bv2.unpermute([22, 47, 33, 36, 18, 6, 32, 29, 54, 62, 4,
9, 42, 39, 45, 59, 8, 50, 35, 20, 25, 49,
15, 61, 55, 60, 0, 14, 38, 40, 23, 17, 41,
10, 57, 12, 30, 3, 52, 11, 26, 43, 21, 13,
58, 37, 48, 28, 1, 63, 2, 31, 53, 56, 44, 24,
51, 19, 7, 5, 34, 27, 16, 46])
print("Unpurmute the bit vector:")
print(bv3)
print(
"\nTry circular shifts to the left and to the right for the following bit vector:")
# 0100000100100000011010000111010101101110011001110111001001111001
print(bv3)
print("\nCircular shift to the left by 7 positions:")
bv3 << 7
# 1001000000110100001110101011011100110011101110010011110010100000
print(bv3)
print("\nCircular shift to the right by 7 positions:")