Giter Club home page Giter Club logo

linear_feedback_shift_register's Introduction

👋

I'm Nikesh Bajaj, recently joined Queen Mary University of London, as a Lecturer (~ Asst. Prof.).
and working with Imperial College London as an Honorary Research Associate.


  • 🔊 My PhD work: PhyAAt: Physiology of Auditory Attention, Check out here https://PhyAAt.github.io, all the data, code and files are shared. Recieved in 2019, from Queen Mary University of London.
  • 🔊 I have a few libraries, you might find useful: SpKit, PhyAAt, RegML, PyLFSR check all here - PyPI/nikeshbajaj.
  • 🔊 Recently, I was invited as a guest speaker by deeplearning.ai for NLP Learing Community Event, where I shared my journay to AI, my PhD work and current work on Decetion Detection. Take a look - YouTube

             

                    


nikeshbajaj

Python Open-Source Libraries:

Libraries Total downloads Description
spkit Downloads Signal Processing ToolKit - https://SpKit.github.io
phyaat Downloads Physiology of Auditory Attention - https://PhyAAt.github.io (PhD work)
pylfsr Downloads Linear Feedback Shift Register - https://PyLFSR.github.io/
regml Downloads Regularization Techniques for Machine Learning - https://nikeshbajaj.github.io/Regularization_for_Machine_Learning/
mlend Downloads MLEnd Datasets - https://MLEndDatasets.github.io

Projects/ Publications/ Patent:

NIkesh's GitHub stats

linear_feedback_shift_register's People

Contributors

nikeshbajaj avatar spaceone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

linear_feedback_shift_register's Issues

Exception in info method

Looks like self.seq starts off as a numpy.int32 and not a list like info() expects.

Steps to reproduce:

import pylfsr
l = pylfsr.LFSR(fpoly=[8,7,5,3])
l.next()
l.info()

8 bit LFSR with feedback polynomial  x^8 + x^7 + x^5 + x^3 + 1
Expected Period (if polynomial is primitive) =  255
Current :
 State        :  [0 1 1 1 1 1 1 1]
 Count        :  1
 Output bit   :  1
 feedback bit :  0
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-91f548e48c86> in <module>
----> 1 l.info()

c:\python37\lib\site-packages\pylfsr\pylfsr.py in info(self)
    247                 print(' feedback bit : ', self.feedbackbit)
    248                 if self.count > 0 and self.count < 1000:
--> 249                         print(' Output Sequence %s' % (''.join([str(int(x)) for x in self.seq])))
    250
    251         def check(self):

Execution speed is very low for long registers and large N

The speed of the functions can be considerably increased by a few changes.
I have looked especially at LFSRv3.m
In the original version a 20 Bit register with taps at 20 &17 (cycle length: 1048575) took
1.39 s for N=50000, 9.5 s for N=100000 , 46.2 s for N=200000 and 108.5 s for N=300000.
A major speed increase can be achieved by initializing seq to the required size in the function body before first use, e.g. by seq=zeros(N,1); .
This avoids time consuming memory re-allocations for the otherwise increasing size of seq within the for-loop.
Furthermore some index expressions can calculated in advance before loop execution because they are never changed.
Many LFSRs only need two taps. For this case further simplifications are possible.
In the latter case my modified version took
1.28 s for N=200000, 1.89 s for N=300000, 3.15 s for N=500000 and 6.25 s for N=1000000 .
Modified LFSRv3 body :

n=length(s);
m=length(t);
m1=m-1;
m2=m-2;
seq=zeros(N,1);
seq(1) = s(n);
j=1:n-1;
n1=n+1;
n1j=n1-j;
nj=n-j;
for k=2:N;
    b(1)=xor(s(t(1)), s(t(2)));
    if m>2;
        for i=1:m2;
        b(i+1)=xor(s(t(i+2)), b(i));
        end
    end
    s(n1j)=s(nj);
    s(1)=b(m1);
    seq(k)=s(n);
end

Special version of the function body for LFSRs with 2 taps :

n=length(s);
seq=zeros(N,1);
seq(1) = s(n);
j=1:n-1;  % e.g. 1:19 for n=20
n1=n+1;   %      21
n1j=n1-j; %      20:-1:2
nj=n-j;   %      19:-1:1
for k=2:N;
    b=xor(s(t(1)), s(t(2)));
    s(n1j)=s(nj);
    s(1)=b;
    seq(k)=s(n);
end

The first output should be the last cell not -1

I've used this library to answer this question in cryptography.se. During my implementation, I've seen that the first output is -1. This creates inconsistency or extra code to mitigate.

This is very unusual, at least for me. The output should be the last cell of the LFSR, not -1. The easiest solution should be setting the output immediately.

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.