Giter VIP home page Giter VIP logo

bm-algorithm's Introduction

BM-Algorithm

Berlekamp-Massey 算法的 Python 3 实现。

使用

$ python main.py -h
usage: main.py [-h] [-d {1,2,3}] [-l {ch,en}] [-v VERSION] flow

普通模式

$ python main.py 10011011000111010100
输入序列为:10011011000111010100
可以生成此序列的最优为 11 级线性反馈移位寄存器
该寄存器的连接多项式为:f(x) = 1 + x^3 + x^9 + x^11

调试等级 1

$ python main.py -d 1 10011011000111010100
f1(x) = 1 + x
f2(x) = 1
f4(x) = 1 + x^3
f5(x) = 1 + x + x^3
f6(x) = 1 + x + x^2 + x^3
f7(x) = 1 + x + x^2
f10(x) = 1 + x + x^2 + x^3 + x^4 + x^5 + x^6
f11(x) = 1 + x^4 + x^5 + x^6
f12(x) = 1 + x^2 + x^3 + x^5 + x^6
f13(x) = 1 + x^2 + x^4 + x^6
f14(x) = 1 + x + x^2 + x^3 + x^7
f16(x) = 1 + x + x^2 + x^5 + x^6 + x^7 + x^8 + x^9
f17(x) = 1 + x^3 + x^4 + x^5 + x^6 + x^7 + x^9
f20(x) = 1 + x^3 + x^9 + x^11
输入序列为:10011011000111010100
可以生成此序列的最优为 11 级线性反馈移位寄存器
该寄存器的连接多项式为:f(x) = 1 + x^3 + x^9 + x^11

调试等级 2

$ python -u main.py -d 2 10011011000111010100
l(1)=1    f1(x) = 1 + x
l(1)=1    f2(x) = 1
l(2)=1    f3(x) = 1
l(3)=3    f4(x) = 1 + x^3
l(4)=3    f5(x) = 1 + x + x^3
l(5)=3    f6(x) = 1 + x + x^2 + x^3
l(6)=4    f7(x) = 1 + x + x^2
l(7)=4    f8(x) = 1 + x + x^2
l(8)=4    f9(x) = 1 + x + x^2
l(9)=6    f10(x) = 1 + x + x^2 + x^3 + x^4 + x^5 + x^6
l(10)=6    f11(x) = 1 + x^4 + x^5 + x^6
l(11)=6    f12(x) = 1 + x^2 + x^3 + x^5 + x^6
l(12)=7    f13(x) = 1 + x^2 + x^4 + x^6
l(13)=7    f14(x) = 1 + x + x^2 + x^3 + x^7
l(14)=7    f15(x) = 1 + x + x^2 + x^3 + x^7
l(15)=9    f16(x) = 1 + x + x^2 + x^5 + x^6 + x^7 + x^8 + x^9
l(16)=9    f17(x) = 1 + x^3 + x^4 + x^5 + x^6 + x^7 + x^9
l(17)=9    f18(x) = 1 + x^3 + x^4 + x^5 + x^6 + x^7 + x^9
l(18)=9    f19(x) = 1 + x^3 + x^4 + x^5 + x^6 + x^7 + x^9
l(19)=11    f20(x) = 1 + x^3 + x^9 + x^11

调试等级 3

本格式用于本人提交作业的。

$ python main.py -d 3 10011011000111010100
n(0) = 0
f0(x) = 1
l0 = 0
n = 1
l(1)=1    f1(x) = 1 + x

n = 1   d(1) = 1  m = 0
l(1)=1    f2(x) = 1

n = 2   d(2) = 0  m = 0
l(2)=1    f3(x) = 1

n = 3   d(3) = 1  m = 3
l(3)=3    f4(x) = 1 + x^3

n = 4   d(4) = 1  m = 3
l(4)=3    f5(x) = 1 + x + x^3

n = 5   d(5) = 1  m = 3
l(5)=3    f6(x) = 1 + x + x^2 + x^3

n = 6   d(6) = 1  m = 6
l(6)=4    f7(x) = 1 + x + x^2

n = 7   d(7) = 0  m = 6
l(7)=4    f8(x) = 1 + x + x^2

n = 8   d(8) = 0  m = 6
l(8)=4    f9(x) = 1 + x + x^2

n = 9   d(9) = 1  m = 9
l(9)=6    f10(x) = 1 + x + x^2 + x^3 + x^4 + x^5 + x^6

n = 10   d(10) = 1  m = 9
l(10)=6    f11(x) = 1 + x^4 + x^5 + x^6

n = 11   d(11) = 1  m = 9
l(11)=6    f12(x) = 1 + x^2 + x^3 + x^5 + x^6

n = 12   d(12) = 1  m = 12
l(12)=7    f13(x) = 1 + x^2 + x^4 + x^6

n = 13   d(13) = 1  m = 12
l(13)=7    f14(x) = 1 + x + x^2 + x^3 + x^7

n = 14   d(14) = 0  m = 12
l(14)=7    f15(x) = 1 + x + x^2 + x^3 + x^7

n = 15   d(15) = 1  m = 15
l(15)=9    f16(x) = 1 + x + x^2 + x^5 + x^6 + x^7 + x^8 + x^9

n = 16   d(16) = 1  m = 15
l(16)=9    f17(x) = 1 + x^3 + x^4 + x^5 + x^6 + x^7 + x^9

n = 17   d(17) = 0  m = 15
l(17)=9    f18(x) = 1 + x^3 + x^4 + x^5 + x^6 + x^7 + x^9

n = 18   d(18) = 0  m = 15
l(18)=9    f19(x) = 1 + x^3 + x^4 + x^5 + x^6 + x^7 + x^9

n = 19   d(19) = 1  m = 19
l(19)=11    f20(x) = 1 + x^3 + x^9 + x^11

输入序列为:10011011000111010100
可以生成此序列的最优为 11 级线性反馈移位寄存器
该寄存器的连接多项式为:f(x) = 1 + x^3 + x^9 + x^11

TODO

  • 英文模式

问题反馈

[email protected]

bm-algorithm's People

Contributors

hhhguany avatar 117503445 avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

ryiliu 117503445

bm-algorithm's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.