// ************************************************* // * Public Class Methods * // ************************************************* public static BinaryGaloisFieldElement[] createGeneratorPolynomial(BinaryGaloisField gf, Int32 maxCorrectibleErrorCnt) { // Generator polynomial, g(x), is of order 2s, so has 2s+1 coefficients BinaryGaloisFieldElement[] g = new BinaryGaloisFieldElement[2 * maxCorrectibleErrorCnt + 1]; // Make g(x) = 1 g[0] = 1; for (int i = 1; i <= (2 * maxCorrectibleErrorCnt); i++) { // Always make coefficient of x^i term equal to 1 g[i] = 1; // Below multiply (g(x) = g[0] + g[1]*x + ... + g[i]*(x^i)) by (x - alpha^i) for (int j = (i - 1); j > 0; j--) { if (g[j] != 0) { g[j] = g[j - 1] - gf.Multiply(gf.AlphaFromIndex(i), g[j]); } else { g[j] = g[j - 1]; } } // Coefficient of x^0 term is alpha^(1+2+...+i) g[0] = gf.AlphaFromIndex(((i * (i + 1)) / 2)); } return(g); }
// ************************************************* // * Private Constructors * // ************************************************* // ************************************************* // * Private Methods * // ************************************************* // ************************************************* // * Public properties and Indexer * // ************************************************* // ************************************************* // * Public constructors * // ************************************************* public ReedSolomonECC(Int32 msgSymbolCnt, Int32 maxCorrectibleErrorCnt, Byte symbolBitWidth) { k = msgSymbolCnt; s = maxCorrectibleErrorCnt; N = k + 2 * s; // Create Binary Galois Field ( that is GF(2^symbolBitWidth) ) galoisField = new BinaryGaloisField(symbolBitWidth); // Create the generator polynomial, g(x) generatorPoly = ReedSolomonECC.createGeneratorPolynomial(galoisField, maxCorrectibleErrorCnt); }
// ************************************************* // * Public Class Methods * // ************************************************* public static BinaryGaloisFieldElement[] createGeneratorPolynomial(BinaryGaloisField gf, Int32 maxCorrectibleErrorCnt) { // Generator polynomial, g(x), is of order 2s, so has 2s+1 coefficients BinaryGaloisFieldElement[] g = new BinaryGaloisFieldElement[2*maxCorrectibleErrorCnt + 1]; // Make g(x) = 1 g[0] = 1; for (int i = 1; i<=(2*maxCorrectibleErrorCnt); i++) { // Always make coefficient of x^i term equal to 1 g[i] = 1; // Below multiply (g(x) = g[0] + g[1]*x + ... + g[i]*(x^i)) by (x - alpha^i) for (int j=(i-1); j > 0; j--) { if (g[j] != 0) g[j] = g[j - 1] - gf.Multiply(gf.AlphaFromIndex(i),g[j]); else g[j] = g[j - 1]; } // Coefficient of x^0 term is alpha^(1+2+...+i) g[0] = gf.AlphaFromIndex( ((i*(i+1))/2) ); } return g; }
// ************************************************* // * Private Constructors * // ************************************************* // ************************************************* // * Private Methods * // ************************************************* // ************************************************* // * Public properties and Indexer * // ************************************************* // ************************************************* // * Public constructors * // ************************************************* public ReedSolomonECC(Int32 msgSymbolCnt, Int32 maxCorrectibleErrorCnt, Byte symbolBitWidth) { k = msgSymbolCnt; s = maxCorrectibleErrorCnt; N = k + 2*s; // Create Binary Galois Field ( that is GF(2^symbolBitWidth) ) galoisField = new BinaryGaloisField(symbolBitWidth); // Create the generator polynomial, g(x) generatorPoly = ReedSolomonECC.createGeneratorPolynomial(galoisField, maxCorrectibleErrorCnt); }