SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
leansdr::gf2x_p< Te, Tp, P, N, ALPHA > Struct Template Reference

#include <rs.h>

Public Member Functions

 gf2x_p ()
 
Te add (Te x, Te y)
 
Te sub (Te x, Te y)
 
Te mul (Te x, Te y)
 
Te div (Te x, Te y)
 
Te inv (Te x)
 
Te exp (Te x)
 
Te log (Te x)
 

Static Public Attributes

static const Te alpha = ALPHA
 

Private Attributes

Te lut_exp [(1<< N) *2]
 
Te lut_log [1<< N]
 

Detailed Description

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
struct leansdr::gf2x_p< Te, Tp, P, N, ALPHA >

Definition at line 48 of file rs.h.

Constructor & Destructor Documentation

◆ gf2x_p()

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::gf2x_p ( )
inline

Definition at line 50 of file rs.h.

51  {
52  if (ALPHA != 2)
53  fail("alpha!=2 not implemented");
54  // Precompute log and exp tables.
55  Tp alpha_i = 1;
56  for (Tp i = 0; i < (1 << N); ++i)
57  {
58  lut_exp[i] = alpha_i;
59  lut_exp[((1 << N) - 1) + i] = alpha_i;
60  lut_log[alpha_i] = i;
61  alpha_i <<= 1; // Multiply by alpha=[X] i.e. increase degrees
62  if (alpha_i & (1 << N))
63  alpha_i ^= P; // Modulo P iteratively
64  }
65  }
Te lut_exp[(1<< N) *2]
Definition: rs.h:91
void fail(const char *s)
Definition: framework.cpp:11
int32_t i
Definition: decimators.h:244
Te lut_log[1<< N]
Definition: rs.h:92

Member Function Documentation

◆ add()

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
Te leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::add ( Te  x,
Te  y 
)
inline

Definition at line 67 of file rs.h.

Referenced by leansdr::rs_engine::eval_poly(), and leansdr::rs_engine::eval_poly_rev().

67 { return x ^ y; } // Addition modulo 2
+ Here is the caller graph for this function:

◆ div()

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
Te leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::div ( Te  x,
Te  y 
)
inline

Definition at line 75 of file rs.h.

Referenced by leansdr::rs_engine::correct(), and leansdr::rs_engine::encode().

76  {
77  //if ( ! y ) fail("div"); // TODO
78  if (!x)
79  return 0;
80  return lut_exp[lut_log[x] + ((1 << N) - 1) - lut_log[y]];
81  }
Te lut_exp[(1<< N) *2]
Definition: rs.h:91
Te lut_log[1<< N]
Definition: rs.h:92
+ Here is the caller graph for this function:

◆ exp()

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
Te leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::exp ( Te  x)
inline

Definition at line 87 of file rs.h.

Referenced by leansdr::rs_engine::correct(), leansdr::rs_engine::rs_engine(), and leansdr::rs_engine::syndromes().

87 { return lut_exp[x]; }
Te lut_exp[(1<< N) *2]
Definition: rs.h:91
+ Here is the caller graph for this function:

◆ inv()

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
Te leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::inv ( Te  x)
inline

Definition at line 82 of file rs.h.

Referenced by leansdr::rs_engine::correct().

83  {
84  // if ( ! x ) fail("inv");
85  return lut_exp[((1 << N) - 1) - lut_log[x]];
86  }
Te lut_exp[(1<< N) *2]
Definition: rs.h:91
Te lut_log[1<< N]
Definition: rs.h:92
+ Here is the caller graph for this function:

◆ log()

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
Te leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::log ( Te  x)
inline

Definition at line 88 of file rs.h.

88 { return lut_log[x]; }
Te lut_log[1<< N]
Definition: rs.h:92

◆ mul()

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
Te leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::mul ( Te  x,
Te  y 
)
inline

Definition at line 69 of file rs.h.

Referenced by leansdr::rs_engine::correct(), leansdr::rs_engine::encode(), leansdr::rs_engine::eval_poly(), leansdr::rs_engine::eval_poly_rev(), and leansdr::rs_engine::rs_engine().

70  {
71  if (!x || !y)
72  return 0;
73  return lut_exp[lut_log[x] + lut_log[y]];
74  }
Te lut_exp[(1<< N) *2]
Definition: rs.h:91
Te lut_log[1<< N]
Definition: rs.h:92
+ Here is the caller graph for this function:

◆ sub()

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
Te leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::sub ( Te  x,
Te  y 
)
inline

Definition at line 68 of file rs.h.

Referenced by leansdr::rs_engine::encode(), and leansdr::rs_engine::rs_engine().

68 { return x ^ y; } // Subtraction modulo 2
+ Here is the caller graph for this function:

Member Data Documentation

◆ alpha

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
const Te leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::alpha = ALPHA
static

Definition at line 66 of file rs.h.

◆ lut_exp

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
Te leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::lut_exp[(1<< N) *2]
private

◆ lut_log

template<typename Te, typename Tp, Tp P, int N, Te ALPHA>
Te leansdr::gf2x_p< Te, Tp, P, N, ALPHA >::lut_log[1<< N]
private

The documentation for this struct was generated from the following file: