当前位置: 首页>>代码示例>>Python>>正文


Python BitVector.unpermute方法代码示例

本文整理汇总了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:")
开发者ID:gsnedders,项目名称:BitVector,代码行数:34,代码来源:BitVectorDemo.py


注:本文中的BitVector.unpermute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。