ReedSolomonCode constructor

ReedSolomonCode({
  1. required BinaryExtensionField field,
  2. required int length,
  3. required int messageSymbols,
  4. int firstRoot = 0,
  5. int shortening = 0,
})

Creates a Reed--Solomon descriptor.

Implementation

ReedSolomonCode({
  required this.field,
  required this.length,
  required this.messageSymbols,
  this.firstRoot = 0,
  this.shortening = 0,
}) {
  if (!field.isPrimitivePolynomial()) {
    throw RohdHclException(
        'Reed-Solomon construction requires a primitive field.');
  }
  if (length < 1 || length > fullLength) {
    throw ArgumentError.value(length, 'length');
  }
  if (messageSymbols < 1 || messageSymbols >= length) {
    throw ArgumentError.value(messageSymbols, 'messageSymbols');
  }
  if (firstRoot < 0 || firstRoot >= fullLength) {
    throw ArgumentError.value(firstRoot, 'firstRoot');
  }
  if (shortening < 0 || shortening > fullLength - length) {
    throw ArgumentError.value(shortening, 'shortening');
  }
  if (shortening > fullLength - length ||
      messageSymbols + shortening > fullLength - paritySymbols) {
    throw ArgumentError.value(shortening, 'shortening');
  }
}