errorLocator method
Builds an error-locator polynomial from received-word syndromes.
The locator is constructed with Berlekamp--Massey using the requested number of correctable errors. Its coefficients are ordered from constant term upward.
Implementation
BchErrorLocator errorLocator(
BigInt received, {
int? correctionCapacity,
}) {
final capacity = correctionCapacity ?? (designedDistance - 1) ~/ 2;
if (capacity < 1) {
throw ArgumentError.value(correctionCapacity, 'correctionCapacity');
}
final sequence = [
for (var index = 0; index < capacity * 2; index++)
_evaluateAt(received, (firstRoot + index) % fullLength),
];
final locator = _berlekampMassey(sequence);
final degree = locator.length - 1;
return BchErrorLocator(
coefficients: locator,
degree: degree,
valid: degree > 0 && degree <= capacity,
);
}