public void ShouldFindOriginalInformationWordAmongPossibleVariants(int n, int k, int d, Polynomial generatingPolynomial, Tuple <FieldElement, FieldElement>[] decodedCodeword, int minCorrectValuesCount, Polynomial expectedInformationPolynomial) { // When var possibleVariants = _decoder.Decode(n, k, d, generatingPolynomial, decodedCodeword, minCorrectValuesCount); // Then Assert.Contains(expectedInformationPolynomial, possibleVariants); }
public void ShouldFindOriginalInformationWordAmongPossibleVariants(ListDecoderTestCase testCase) { // When var possibleVariants = _decoder.Decode( testCase.N, testCase.K, testCase.D, testCase.GeneratingPolynomial, testCase.DecodedCodeword, testCase.MinCorrectValuesCount ); // Then Assert.Contains(testCase.Expected, possibleVariants); }
private static void PlaceNoiseIntoSamplesAndDecode(AnalyzingSample sample, int currentErrorNumber, int n, int k, int d, Polynomial generatingPolynomial, GsBasedDecoder decoder) { if (currentErrorNumber == sample.ErrorPositions.Length) { var decodingResults = decoder.Decode(n, k, d, generatingPolynomial, sample.Codeword, sample.CorrectValuesCount); if (decodingResults.Contains(sample.InformationPolynomial) == false) { throw new InvalidOperationException("Failed to decode sample"); } if (++sample.ProcessedNoises % 50 == 0) { var errors = new int[n]; for (var i = 0; i < sample.ErrorPositions.Length; i++) { errors[sample.ErrorPositions[i]] = sample.CurrentNoiseValue[i]; } //_logger.LogInformation($"[{Thread.CurrentThread.ManagedThreadId}]: Current noise value ({string.Join(",", errors)})"); } if (decoder.TelemetryCollector.ProcessedSamplesCount % 100 == 0) { _logger.LogInformation(decoder.TelemetryCollector.ToString()); } return; } var field = sample.InformationPolynomial.Field; var corretValue = sample.Codeword[sample.ErrorPositions[currentErrorNumber]]; for (var i = sample.CurrentNoiseValue[currentErrorNumber]; i < field.Order; i++) { sample.Codeword[sample.ErrorPositions[currentErrorNumber]] = Tuple.Create(corretValue.Item1, corretValue.Item2 + field.CreateElement(i)); sample.CurrentNoiseValue[currentErrorNumber] = i; PlaceNoiseIntoSamplesAndDecode(sample, currentErrorNumber + 1, n, k, d, generatingPolynomial, decoder); } sample.Codeword[sample.ErrorPositions[currentErrorNumber]] = corretValue; sample.CurrentNoiseValue[currentErrorNumber] = 1; }