# Berlekamp–Massey algorithm verification

I'm implementing Berlekamp–Massey algorithm for BCH codes, but I have some troubles with it: I don't realize how to verify this algorithm. Is there any methods to prove, that code works correctly or maybe there is useful examples in some books, that I can test my code on?

I'm not aware of any standard test cases for this algorithm. I would try two things:

1. Generate a valid codeword, and insert errors at random locations. Repeat for $$1,2,\ldots,t$$ errors. Verify that the algorithm corrects all the errors. Repeat for a large number of codewords.

2. Try to find BER curves for the BCH codes you're interested in, either in papers or textbooks. Then, try to replicate them using your algorithm. If your implementation is correct, your results should be very close.

• thaks, I'll try to figure it out. Also about codewords: I found several types of generator/parity-check matrices (systematic/nonsystematic, composed via polynomials, primitive elements of field etc.). Which of forms are better or preferable for generating codewords? – Kirill Jan 22 at 14:11
• From the point of view of a Matlab implementation, they're basically equivalent. – MBaz Jan 22 at 15:13