-
sdr.m_sequence(degree: int, poly: PolyLike | None =
None
, index: int =1
, output: 'decimal' ='decimal'
) ndarray[Any, dtype[int64]] -
sdr.m_sequence(degree: int, poly: PolyLike | None =
None
, index: int =1
, output: 'field' ='decimal'
) FieldArray -
sdr.m_sequence(degree: int, poly: PolyLike | None =
None
, index: int =1
, output: 'bipolar' ='decimal'
) ndarray[Any, dtype[float64]] Generates a maximal-length sequence (m-sequence) from a Fibonacci linear feedback shift register (LFSR).
- Parameters:¶
- degree: int¶
The degree \(n\) of the LFSR.
- poly: PolyLike | None =
None
¶ The characteristic polynomial of the LFSR over \(\mathrm{GF}(q)\). The default is
None
, which uses the primitive polynomial of degree \(n\) over \(\mathrm{GF}(2)\),galois.primitive_poly(2, degree)
.- index: int =
1
¶ The index \(i\) in \([1, q^{n})\) of the m-sequence. The index represents the initial state of the LFSR. The index dictates the phase of the m-sequence. The integer index is interpreted as a polynomial over \(\mathrm{GF}(q)\), whose coefficients are the shift register values. The default is 1, which corresponds to the \([0, \dots, 0, 1]\) state.
- output: 'decimal' =
'decimal'
¶ - output: 'field' =
'decimal'
- output: 'bipolar' =
'decimal'
The output format of the m-sequence.
"decimal"
(default): The m-sequence with decimal values in \([0, q^n)\)."field"
: The m-sequence as a Galois field array over \(\mathrm{GF}(q^n)\)."bipolar"
: The m-sequence with bipolar values of 1 and -1. Only valid for \(q = 2\).
- Returns:¶
The length-\(q^n - 1\) m-sequence.
References¶
Examples¶
Generate a maximal-length sequence of degree-4 over \(\mathrm{GF}(2)\).
In [1]: sdr.m_sequence(4) Out[1]: array([1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1]) In [2]: sdr.m_sequence(4, output="bipolar") Out[2]: array([-1., 1., 1., 1., -1., 1., 1., -1., -1., 1., -1., 1., -1., -1., -1.]) In [3]: sdr.m_sequence(4, output="field") Out[3]: GF([1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1], order=2)
Compare the sequence with index 1 to the sequence with index 2. They are just phase shifts of each other.
In [4]: sdr.m_sequence(4, index=2) Out[4]: array([0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0])
Generate a maximal-length sequence of degree-4 over \(\mathrm{GF}(3^2)\).
In [5]: c = galois.primitive_poly(3**2, 4); c Out[5]: Poly(x^4 + x + 5, GF(3^2)) In [6]: x = sdr.m_sequence(4, poly=c); x Out[6]: array([1, 0, 0, ..., 5, 4, 6]) In [7]: x.size Out[7]: 6560