public class GaliosFieldTableOps
extends java.lang.Object
Code and code comments based on the tutorial at [1].
[1] Reed-Solomon Codes for Coders Viewed on September 28, 2017
| Constructor and Description |
|---|
GaliosFieldTableOps(int numBits,
int primitive)
Specifies the GF polynomial
|
| Modifier and Type | Method and Description |
|---|---|
int |
divide(int x,
int y)
Computes the following the value of output such that:
|
int |
inverse(int x)
Computes the following 2**(max-x) mod primitive
|
int |
multiply(int x,
int y)
Computes the following (x*y) mod primitive.
|
void |
polyAdd_S(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
org.ddogleg.struct.GrowQueue_I8 output)
Adds two polynomials together.
|
void |
polyAdd(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
org.ddogleg.struct.GrowQueue_I8 output)
Adds two polynomials together.
|
void |
polyAddScaleB(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
int scaleB,
org.ddogleg.struct.GrowQueue_I8 output)
Adds two polynomials together while scaling the second.
|
void |
polyDivide_S(org.ddogleg.struct.GrowQueue_I8 dividend,
org.ddogleg.struct.GrowQueue_I8 divisor,
org.ddogleg.struct.GrowQueue_I8 quotient,
org.ddogleg.struct.GrowQueue_I8 remainder)
Performs polynomial division using a synthetic division algorithm.
|
void |
polyDivide(org.ddogleg.struct.GrowQueue_I8 dividend,
org.ddogleg.struct.GrowQueue_I8 divisor,
org.ddogleg.struct.GrowQueue_I8 quotient,
org.ddogleg.struct.GrowQueue_I8 remainder)
Performs polynomial division using a synthetic division algorithm.
|
int |
polyEval_S(org.ddogleg.struct.GrowQueue_I8 input,
int x)
Evaluate the polynomial using Horner's method.
|
int |
polyEval(org.ddogleg.struct.GrowQueue_I8 input,
int x)
Evaluate the polynomial using Horner's method.
|
int |
polyEvalContinue(int previousOutput,
org.ddogleg.struct.GrowQueue_I8 part,
int x)
Continue evaluating a polynomial which has been broken up into multiple arrays.
|
void |
polyMult_flipA(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
org.ddogleg.struct.GrowQueue_I8 output) |
void |
polyMult_S(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
org.ddogleg.struct.GrowQueue_I8 output)
Identical to
polyMult(GrowQueue_I8, GrowQueue_I8, GrowQueue_I8) |
void |
polyMult(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
org.ddogleg.struct.GrowQueue_I8 output)
Coefficients for largest powers are first, e.g.
|
void |
polyScale(org.ddogleg.struct.GrowQueue_I8 input,
int scale,
org.ddogleg.struct.GrowQueue_I8 output)
Scales the polynomial.
|
int |
power_n(int x,
int power) |
int |
power(int x,
int power)
Computes the following x**power mod primitive
|
public GaliosFieldTableOps(int numBits,
int primitive)
numBits - Number of bits needed to describe the polynomial. GF(2**8) = 8 bitsprimitive - The primitive polynomialpublic int multiply(int x,
int y)
public int divide(int x,
int y)
divide(multiply(x,y),y)==x for any x and any nonzero y.
public int power(int x,
int power)
public int power_n(int x,
int power)
public int inverse(int x)
public void polyScale(org.ddogleg.struct.GrowQueue_I8 input,
int scale,
org.ddogleg.struct.GrowQueue_I8 output)
Coefficients for largest powers are first, e.g. 2*x**3 + 8*x**2+1 = [2,8,0,1]
input - Input polynomial.scale - scaleoutput - Output polynomial.public void polyAdd(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
org.ddogleg.struct.GrowQueue_I8 output)
Coefficients for largest powers are first, e.g. 2*x**3 + 8*x**2+1 = [2,8,0,1]
polyA - (Input) First polynomialpolyB - (Input) Second polynomialoutput - (Output) Results of additionpublic void polyAdd_S(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
org.ddogleg.struct.GrowQueue_I8 output)
Coefficients for smallest powers are first, e.g. 2*x**3 + 8*x**2+1 = [1,0,2,8]
polyA - (Input) First polynomialpolyB - (Input) Second polynomialoutput - (Output) Results of additionpublic void polyAddScaleB(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
int scaleB,
org.ddogleg.struct.GrowQueue_I8 output)
Coefficients for largest powers are first, e.g. 2*x**3 + 8*x**2+1 = [2,8,0,1]
polyA - (Input) First polynomialpolyB - (Input) Second polynomialscaleB - (Input) Scale factor applied to polyBoutput - (Output) Results of additionpublic void polyMult(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
org.ddogleg.struct.GrowQueue_I8 output)
Coefficients for largest powers are first, e.g. 2*x**3 + 8*x**2+1 = [2,8,0,1]
polyA - polyB - output - public void polyMult_flipA(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
org.ddogleg.struct.GrowQueue_I8 output)
public void polyMult_S(org.ddogleg.struct.GrowQueue_I8 polyA,
org.ddogleg.struct.GrowQueue_I8 polyB,
org.ddogleg.struct.GrowQueue_I8 output)
polyMult(GrowQueue_I8, GrowQueue_I8, GrowQueue_I8)
Coefficients for smallest powers are first, e.g. 2*x**3 + 8*x**2+1 = [1,0,2,8]
polyA - polyB - output - public int polyEval(org.ddogleg.struct.GrowQueue_I8 input,
int x)
01x**4 + 0fx**3 + 36x**2 + 78x + 40 = (((01 x + 0f) x + 36) x + 78) x + 40
Coefficients for largest powers are first, e.g. 2*x**3 + 8*x**2+1 = [2,8,0,1]
input - Polynomial being evaluatedx - Value of xpublic int polyEval_S(org.ddogleg.struct.GrowQueue_I8 input,
int x)
01x**4 + 0fx**3 + 36x**2 + 78x + 40 = (((01 x + 0f) x + 36) x + 78) x + 40
Coefficients for smallest powers are first, e.g. 2*x**3 + 8*x**2+1 = [1,0,2,8]
input - Polynomial being evaluatedx - Value of xpublic int polyEvalContinue(int previousOutput,
org.ddogleg.struct.GrowQueue_I8 part,
int x)
previousOutput - Output from the evaluation of the prior part of the polynomialpart - Additional segment of the polynomialx - Point it's being evaluated atpublic void polyDivide(org.ddogleg.struct.GrowQueue_I8 dividend,
org.ddogleg.struct.GrowQueue_I8 divisor,
org.ddogleg.struct.GrowQueue_I8 quotient,
org.ddogleg.struct.GrowQueue_I8 remainder)
Coefficients for largest powers are first, e.g. 2*x**3 + 8*x**2+1 = [2,8,0,1]
dividend - (Input) Polynomial dividenddivisor - (Input) Polynomial divisorquotient - (Output) Division's quotientremainder - (Output) Divisions's remainderpublic void polyDivide_S(org.ddogleg.struct.GrowQueue_I8 dividend,
org.ddogleg.struct.GrowQueue_I8 divisor,
org.ddogleg.struct.GrowQueue_I8 quotient,
org.ddogleg.struct.GrowQueue_I8 remainder)
Coefficients for smallest powers are first, e.g. 2*x**3 + 8*x**2+1 = [1,0,2,8]
dividend - (Input) Polynomial dividenddivisor - (Input) Polynomial divisorquotient - (Output) Division's quotientremainder - (Output) Divisions's remainder