<commit_before>/* -*- mode: c++ -*- */
#pragma once

/**
 * GF_2^n based RS (Cauchy or Vandermonde)
 */
template<typename T>
class FECGF2NRS : public FEC<T>
{
 public:
  enum FECGF2NRSType
  {
    VANDERMONDE,
    CAUCHY,
  };

  FECGF2NRSType type;

 private:
  Mat<T> *mat = NULL;
  Mat<T> *decode_mat = NULL;

 public:
  FECGF2NRS(u_int word_size, u_int n_data, u_int n_parities,
    FECGF2NRSType type) :
    FEC<T>(FEC<T>::TYPE_1, word_size, n_data, n_parities)
  {
    assert(type == VANDERMONDE || type == CAUCHY);
    this->type = type;

    if (word_size > 16)
      assert(false);  // not support yet
    u_int gf_n = 8*word_size;
    this->gf = new GF2N<T>(gf_n);

    this->mat = new Mat<T>(this->gf, n_parities, n_data);
    if (type == CAUCHY) {
      mat->cauchy();
    } else if (type == VANDERMONDE) {
      mat->vandermonde_suitable_for_ec();
    }

    // has to be a n_data*n_data invertible square matrix
    decode_mat = new Mat<T>(this->gf, mat->get_n_cols(), mat->get_n_cols());
  }
<commit_msg>FECGF2nRS: fix wrong set type<commit_after>/* -*- mode: c++ -*- */
#pragma once

/**
 * GF_2^n based RS (Cauchy or Vandermonde)
 */
template<typename T>
class FECGF2NRS : public FEC<T>
{
 public:
  enum FECGF2NRSType
  {
    VANDERMONDE,
    CAUCHY,
  };

  FECGF2NRSType type;

 private:
  Mat<T> *mat = NULL;
  Mat<T> *decode_mat = NULL;

 public:
  FECGF2NRS(u_int word_size, u_int n_data, u_int n_parities,
    FECGF2NRSType type) :
    FEC<T>(FEC<T>::TYPE_1, word_size, n_data, n_parities)
  {
    assert(type == VANDERMONDE || type == CAUCHY);

    if (word_size > 16)
      assert(false);  // not support yet
    u_int gf_n = 8*word_size;
    this->gf = new GF2N<T>(gf_n);

    this->mat = new Mat<T>(this->gf, n_parities, n_data);
    if (type == CAUCHY) {
      mat->cauchy();
    } else if (type == VANDERMONDE) {
      mat->vandermonde_suitable_for_ec();
    }

    // has to be a n_data*n_data invertible square matrix
    decode_mat = new Mat<T>(this->gf, mat->get_n_cols(), mat->get_n_cols());
  }

{'fraction_non_alphanumeric': 0.1531265386509109, 'fraction_numerical': 0.011324470704086657, 'mean_word_length': 3.0558882235528944, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4391220', 'n_tokens_mistral': 891, 'n_tokens_neox': 854, 'n_words': 182}