46 for (
i = 0;
i <= degree - 1;
i += 2) {
61 it_assert( (
b >= 0) && (
b <
n),
"Reed_Solomon::Reed_Solomon: narrow-sense parameter restricted to 0 <= b <= n.");
62 GFX x(
q, (
char *)
"-1 0");
64 g.
set(
q, (
char *)
"0");
65 for (
int i = 1;
i <= 2 *
t;
i++) {
66 alphapow(0) =
b +
i - 1;
67 g *= (x -
GFX(
q, alphapow));
84 for (
i = 0;
i <
n -
k;
i++)
87 for (
i = 0;
i < iterations;
i++) {
89 for (
j = 0;
j <
k;
j++) {
100 for (
j =
k;
j <
n;
j++) {
107 for (
j = 0;
j <
n;
j++) {
108 cbit =
cx[
j].get_vectorspace();
129 GFX rx(
q,
n - 1),
cx(
q,
n - 1),
mx(
q,
k - 1),
ex(
q,
n - 1),
S(
q, 2 *
t),
Xi(
q, 2 *
t),
Gamma(
q), Lambda(
q),
140 for (
i = 0;
i < iterations;
i++) {
143 for (
j = 0;
j <
n;
j++) {
150 ivec alphapow = -
ones_i(2);
159 for (
j = 1;
j <= 2 *
t;
j++) {
165 if (
Xi.get_true_degree() >= 1) {
170 T =
GFX(
q, (
char*)
"-1 0");
174 for (l = 1; l <= L; l++) {
186 T =
GFX(
q, (
char*)
"-1 0") * T;
191 for (
j =
q - 2;
j >= 0;
j--) {
192 if (Lambda(
GF(
q,
j)) ==
GF(
q, -1)) {
207 for (
j = 0;
j <= 2 *
t;
j++) {
231 for (
j = 1;
j <= 2 *
t;
j++) {
234 if (
S.get_true_degree() >= 1) {
246 if (
cx.get_true_degree() >= 1) {
248 for (
j = 0;
j <
k;
j++) {
255 for (
j = 0;
j <=
mx.get_true_degree();
j++) {
256 mbit.replace_mid(
j *
m,
mx[
j].get_vectorspace());
308 it_error(
"Reed_Solomon::decode(): Soft-decision decoding not implemented");
313 it_error(
"Reed_Solomon::decode(): Soft-decision decoding not implemented");
Array< T > mid(int pos, int n) const
Get n elements of the array starting from pos.
void set_length(int n, bool copy=false)
Resizing an Array<T>.
void set_size(int n, bool copy=false)
Resizing an Array<T>.
int length() const
Returns the number of data elements in the array object.
Polynomials over GF(q)[x], where q=2^m, m=1,...,16.
int get_true_degree() const
Return true degree of GF(q)[x].
void set(int qvalue, const char *invalues)
Set the GF(q)[x] polynomial.
int get_size() const
Return q.
virtual void encode(const bvec &uncoded_bits, bvec &coded_bits)
Encoder function.
virtual bool decode(const bvec &coded_bits, const ivec &erasure_positions, bvec &decoded_message, bvec &cw_isvalid)
Decode the RS code bits. Return false if there has been any decoding failure.
Reed_Solomon(int in_m, int in_t, bool sys=false, int in_b=1)
GFX g
The generator polynomial of the RS code.
const bool systematic
Whether or not the code is systematic.
#define it_error(s)
Abort unconditionally.
#define it_assert(t, s)
Abort if t is not true.
int pow2i(int x)
Calculate two to the power of x (2^x); x is integer.
T max(const Vec< T > &v)
Maximum value of vector.
ITPP_EXPORT ivec ones_i(int size)
A Int vector of ones.
ITPP_EXPORT bvec zeros_b(int size)
A Binary vector of zeros.
Logarithmic and exponenential functions - header file.
const Array< T > concat(const Array< T > &a, const T &e)
Append element e to the end of the Array a.
GFX formal_derivate(const GFX &f)
Local help function.
GFX divgfx(const GFX &c, const GFX &g)
Division of two GFX (local help function)
int floor_i(double x)
The nearest smaller integer.
GFX modgfx(const GFX &a, const GFX &b)
Modulo function of two GFX (local help function)
Definitions of a Reed-Solomon codec class.
Definitions of special vectors and matrices.