M - series

In this notebook, the characteristic polynomial is chosen to be p(x) := x^4+x+1. Serial and parallel generation are shown.

1
. Serial Generation

GF2=FiniteField[2,1](*GF(2)*)
(Local) Out[]=
FiniteField
Characteristic: 2
Extension degree: 1
Field irreducible:
1+x.
Representation: Polynomial

(Local) In[]:=
M_t={{GF2[0],GF2[0],GF2[0],GF2[1]},{GF2[1],GF2[0],GF2[0],GF2[1]},{GF2[0],GF2[1],GF2[0],GF2[0]},{GF2[0],GF2[0],GF2[1],GF2[0]}};(*statetransisionmatrixcorrespondingtop*)
M_t//MatrixForm
(Local) Out[]//MatrixForm=

2
0

2
0

2
0

2
1

2
1

2
0

2
0

2
1

2
0

2
1

2
0

2
0

2
0

2
0

2
1

2
0
We can see that the period is 2^4 - 1 = 15.
Table[MatrixPower[M_t,i]==M_t,{i,2,16}]
(Local) Out[]=
{False,False,False,False,False,False,False,False,False,False,False,False,False,False,True}
_0={GF2[1],GF2[0],GF2[0],GF2[0]}(*initialstate*)
(Local) Out[]=


2
1
,

2
0
,

2
0
,

2
0

ser_per=Flatten[RecurrenceTable[{[n+1]==M_t.[n],[1]==_0},,{n,1,15}][[;;,4]]](*firstperiod*)
(Local) Out[]=


2
0
,

2
0
,

2
0
,

2
1
,

2
0
,

2
0
,

2
1
,

2
1
,

2
0
,

2
1
,

2
0
,

2
1
,

2
1
,

2
1
,

2
1


2
. Parallel Generation

(Local) In[]:=
N_P=4;(*parallelism*)
(Local) In[]:=
_p_0=Transpose[Table[MatrixPower[M_t,i]._0,{i,0,N_P-1}]];(*initialstate,extendedfrom_0usedinserialgeneration*)
_p_0//MatrixForm
(Local) Out[]//MatrixForm=

2
1

2
0

2
0

2
0

2
0

2
1

2
0

2
0

2
0

2
0

2
1

2
0

2
0

2
0

2
0

2
1
M_p_t=MatrixPower[M_t,4];(*statetransisionmatrix,4-thpowerofM_t*)
LCM[2^4-1,N_P]
(Local) Out[]=
60
Generate first 60 (=LCM[2^4 - 1, N_P]) samples in parallel.
ser_15per=Flatten[RecurrenceTable[{_p[n+1]==M_p_t._p[n],_p[1]==_p_0},_p,{n,1,15}][[;;,4,;;]]]
(Local) Out[]=


2
0
,

2
0
,

2
0
,

2
1
,

2
0
,

2
0
,

2
1
,

2
1
,

2
0
,

2
1
,

2
0
,

2
1
,

2
1
,

2
1
,

2
1
,

2
0
,

2
0
,

2
0
,

2
1
,

2
0
,

2
0
,

2
1
,

2
1
,

2
0
,

2
1
,

2
0
,

2
1
,

2
1
,

2
1
,

2
1
,

2
0
,

2
0
,

2
0
,

2
1
,

2
0
,

2
0
,

2
1
,

2
1
,

2
0
,

2
1
,

2
0
,

2
1
,

2
1
,

2
1
,

2
1
,

2
0
,

2
0
,

2
0
,

2
1
,

2
0
,

2
0
,

2
1
,

2
1
,

2
0
,

2
1
,

2
0
,

2
1
,

2
1
,

2
1
,

2
1

Full expression not available
(
original memory size:
2.5 kB)
ser_15per==Flatten[Table[ser_per,4]]
(Local) Out[]=
True