ReedSolomon constructor

ReedSolomon({
  1. required int symbolSizeInBits,
  2. required int numberOfCorrectableSymbols,
  3. required int primitivePolynomial,
  4. required int initialRoot,
})

Implementation

ReedSolomon({
  required int symbolSizeInBits,
  required int numberOfCorrectableSymbols,
  required int primitivePolynomial,
  required int initialRoot,
})  : this._galoisField =
          GaloisField(primitivePolynomial, 1 << symbolSizeInBits),
      this._eccCount = 2 * numberOfCorrectableSymbols,
      this._power = initialRoot {
  this._polynomialGenerator = GFPolynomial(this._galoisField, <int>[1]);

  for (int i = 0; i < this._eccCount; i++) {
    this._polynomialGenerator = this._polynomialGenerator.multiply(
          GFPolynomial(
            this._galoisField,
            <int>[1, this._galoisField.pow(2, i + this._power)],
          ),
        );
  }
}