0

These algorithms were mentioned in a paper by Prof E J Weldon Jr (University of Hawaii) around 1987 for DAT tape drives that used RS(32,26) code. I created a document based on this in Jan 1988. I have the book Error Correcting Codes by Peterson and Weldon, second edition (1972, first edition 1961), but it doesn't include these algorithms. I'm looking for a currently available reference.

Note these methods only work for $GF(2^n)$, as they rely on cancellation of equal terms when summed.

Quadratic, $x^2 + ax + b$, with roots $R, S$ to be determined. Define $z$: $x = az$, this results in $z^2 + z + b/a^2$. For software, a $(2^n)$ entry table, or for hardware, a linear mapping using a $n$ row by $n$ bit matrix, except that only the non-zero bits are used for mapping in hardware, and invalid input is handled by separate circuitry. Either method produces one of the roots $R$, the other root is $S = R+a$.

Cubic $x^3 + ax^2 + bx + c$, with roots $R, S, T$ to be determined. The comments in the example code below include exception handling.

$x = t+a$ | leads to:
$t^3 + (aa+b)t + (ab+c)$.
$d = aa+b$, $e = ab+c$
$t^3 + dt + e$
$t = u + d/u$ | leads to:
$u^3 + e + d^3/u^3$ | multiply by $u^3$
$u^6 + eu^3 + d^3$
$u^3 = v$ | leads to:
$v^2 + ev + d^3$
$v = ew$
$w =$ root of $w^2 + w + d^3/e^2$ | table or map
$u = \sqrt[3]{ew}$ | table
$t = u + d/u$
$R = t + a$ | first root
$R^3 + aR^2 + bR + c = 0$ | divide by R
$R^2 + aR + b = c/R$
$(x^3 + ax^2 + bx + c) / (x + R)$
$x^2 + (R+a)x + (R^2+aR+b)$ | remainder $(R^3+aR^2+bR+c) = 0$
$x^2 + (R+a)x + c/R$
$t = (R+a)$, $g = c/R$
$x^2 + tx + g$
$x = ty$ | leads to:
$y^2 + y + g/t^2$
$y, y+1$ are roots of $y^2 + y + g/t^2$ | table or map
$S = ty$ | second root
$T = S+t$ | third root

The example working code below is from Jan 1988.

/*----------------------------------------------------------------------*/
/*      Quad - solve x^2 + ax + b                                       */
/*      x = az: z^2 + z + (b/a^2)                                       */
/*----------------------------------------------------------------------*/
static int Quad()
{
    if(!b){                             /* if zero root */
        R = 0;
        S = a;
        return(1);}
    if(!a){                             /* if double root */
        S = R = iz2[b];
        if(!R)
            return(0);
        return(1);}
    d = z2z[GFDiv(b,z2[a])];            /* d=root of z^2+z+(b/a^2) */
    if(!d)
        return(0);
    R = GFMpy(a,d);
    S = R^a;
    return(1);
}

/----------------------------------------------------------------------/ /* Cube - solve x^3 + ax^2 + bx + c / /----------------------------------------------------------------------/ static int Cube() { if(!c){ / if(c==0) use Quad() / if(!Quad()) return(0); T = S; S = R; R = 0; return(1); } / x = t + a / / t^3 + aa+b t + ab+c / / t^3 + d t + e / e = GFMpy(a,b)^c; / e = (ab)+c / if(!e){ / if double root / R = a; / R = a / T = S = iz2[b]; / S = T = sqrt(b) / if(!S) / fail if no roots / return(0); return(1);} d = z2[a]^b; / d = (aa)+b / if(!d){ / if(d==0), t=e^(1/3) / t = iz3[e]; if(!t) / fail if no roots / return(0); goto c0;} / t = u + d/u / / u^3 + e + d^3/u^3 / / u^6 + e u^3 + d^3 / / u^3 = v / / v^2 + e v + d^3 / / v = ew / / e^2 w^2 + e^2 w + d^3 / / w^2 + w + d^3/e^2 / w = z2z[GFDiv(z3[d],z2[e])]; / w = root of w^2+w+(d^3/e^2) / if(!w) / fail if no roots / return(0); u = iz3[GFMpy(e,w)]; / u = cube root of (ew) / if(!u) / fail if no roots / return(0); t = u^GFDiv(d,u); / t = u + d/u = R + a / c0: R = t^a; / R = 1st root / / (x^3 + ax^2 + bx + c) / (x + R) / / x^2 + (R+a)x + (R^2+aR+b) = 0 / / (R^3 + aR^2 + bR + c)/R = 0 / / (R^2 + aR + b) = c/R / / x^2 + (R+a)x + c/R = 0 / / x^2 + f x + g = 0 / / x^2 + t x + g = 0 / / x = ty / / y^2 + y + g/t^2 = 0 / g = GFDiv(c,R); / g = c/R / y = z2z[GFDiv(g,z2[t])]; / y, y+1 = root of z^2+z+(g/t^2) / S = GFMpy(y,t); / S = 2nd root / T = S^t; / T = 3rd root */ return(1); }

rcgldr
  • 764

1 Answers1

1

One way to solve quadratic equations $$ x^2+ax+b=0 \tag1$$ over $\Bbb F_{2^n}$ goes like this:

Chose an irreducible polynomial $p$ of degree $n$ over $\Bbb F_2$ and use the representation $$\Bbb F_2(\varrho) \simeq \Bbb F_{2^n} \quad\text{with}\quad p(\varrho)=0$$ Then $x$ has the representation $$x=\sum_0^{n-1} x_i\varrho^i \quad\text{with}\quad x_i \in\Bbb F_2 \tag2$$ and for $x^2$: $$x^2=\sum_0^{n-1} x_i\varrho^{2i} \tag3$$

Now when you plug (2) and (3) into (1) then you see that in order to solve (1) you have so solve a linear system in the $n$ variables $x_i$.

  • The original point of the methods in the question was for hardware implementation, to avoid Chien search and to minimize the number of tables of constants. DAT drives used $GF(2^8):x^8+x^4+x^3+x^2+1$, where root of $z^2 + z + c$ could be implemented via linear mapping using XOR gates. Using indexing to represent bits, root $R$ = map($c$): if $c[5] == 1$, no roots, $R[0] = 0$, $R[1] = c[0]+c[2]+c[4]$, $R[2] = c[0]+c[3]+c[4]+c[6]$, ... $R[7] = c[0]+c[1]+c[2]+c[4]$ – rcgldr Oct 30 '24 at 20:03
  • The hardware included a processor, prom, and ram, but would use circuits for linear mapping instead of lookup tables when possible. Trivia, to reduce code size, there was no encoder, instead the 6 parity bytes were marked as erasures and decoding was done to implement encode. – rcgldr Oct 30 '24 at 20:22