title: What is the value of the ideal value of the generator polynomial index in the Schifra library for Reed-Solomon error correcting code?
body: <p>I am trying to use the the <a href="http://www.schifra.com/example.html" rel="nofollow noreferrer">Schifra Reed-Solomon error correcting code library</a> in a project. I have no background about how Reed-Solomon code and Galois field work. I am having trouble figuring out the ideal value of the generator_polynomial_index for a 16 bit symbol(field descriptor).</p>
  
  <p>My code works for the the index 0 and many others. I have tried all values of index. The code works for a lot of them (0-32724 &amp; 32779-65485 to be precise) but </p>
  
  <h2>Questions</h2>
  
  <ol>
  <li>What is the most ideal value? </li>
  <li>What is changing if I switch to another value of index(which also works but is not ideal)?</li>
  </ol>
  
  <h2>Rest of my discoveries:</h2>
  
  <ul>
  <li><p>field_descriptor = symbol size(bits/symbol)</p></li>
  <li><p>code_length(Total number of symbols(data symbols + error-correction code symbols)) = 2^symbol_size - 1 (Library only supports this value of code length)</p></li>
  <li><p>generator_polynomial_root_count = fec_length(redundancy or number of error-correction symbols)</p></li>
  <li><p>Errors are measured in symbols and not bits i.e. 1 incorrect bit in a particular symbol is counted as 1 error. But even if all 16 bits are incorrect; it would count as 1 error(not 16).</p></li>
  <li><p>The maximum number of errors and erasures which can be rectified should obey the following inequality: 2*num_errors + num_erasures &lt; fec_length </p></li>
  </ul>
  
  <p>Please correct me if I am mistaken anywhere</p>
  
  <pre><code>const std::size_t field_descriptor                =   16;
  const std::size_t generator_polynomial_index      =  index;
  const std::size_t generator_polynomial_root_count = 50;
  
  /* Reed Solomon Code Parameters */
  const std::size_t code_length = 65535;
  const std::size_t fec_length  =  50;
  const std::size_t data_length = code_length - fec_length;
  
  /* Instantiate Finite Field and Generator Polynomials */
  const schifra::galois::field field(field_descriptor,
  schifra::galois::primitive_polynomial_size14, schifra::galois::primitive_polynomial14);
  </code></pre>