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

template<typename T>
class Vec;

/**
 * Generic class for the Ring of integers modulo N
 *
 * @param n cardinal
 */
template<typename T>
class RN
{
private:
  T _card;
  T root;

public:
  RN(T card);
  virtual ~RN();
  virtual T card(void);
  virtual T card_minus_one(void) ;
  virtual bool check(T a) ;
  virtual T neg(T a) ;
  virtual T add(T a, T b) ;
  virtual T sub(T a, T b) ;
  virtual T mul(T a, T b) ;
  virtual T div(T a, T b) ;
  T inv_bezout(T a);
  virtual T inv(T a) ;
  virtual T exp(T a, T b) ;
  virtual T log(T a, T b) ;
  T exp_naive(T base, T exponent);
  T exp_quick(T base, T exponent);
  T log_naive(T base, T exponent);
  void compute_factors_of_order();
  bool is_quadratic_residue(T q);
  void compute_omegas(Vec<T> *W, int n, T w);
  void compute_omegas_cached(Vec<T> *W, int n, T w);
  virtual T weak_rand(void);
  bool is_prime_root(T nb);
  void find_prime_root();
  T get_root();
  T get_prime_root();
  bool check_prime_root(T nb);
  bool check_order_naive(T nb, T order);
  T do_step_get_order(T x, T h, std::vector<T> *primes,
    std::vector<int> *exponent);
  T get_order(T x);
  T get_nth_root(T n);
  T get_code_len(T n);
  T get_code_len_high_compo(T n);
 private:
  bool compute_factors_of_order_done = false;
  std::vector<T>* primes = NULL;<commit_msg>RN: virtualize functions for FECGFF4N<commit_after>/* -*- mode: c++ -*- */
#pragma once

template<typename T>
class Vec;

/**
 * Generic class for the Ring of integers modulo N
 *
 * @param n cardinal
 */
template<typename T>
class RN
{
private:
  T _card;
  T root;

public:
  RN(T card);
  virtual ~RN();
  virtual T card(void);
  virtual T card_minus_one(void) ;
  virtual bool check(T a) ;
  virtual T neg(T a) ;
  virtual T add(T a, T b) ;
  virtual T sub(T a, T b) ;
  virtual T mul(T a, T b) ;
  virtual T div(T a, T b) ;
  T inv_bezout(T a);
  virtual T inv(T a) ;
  virtual T exp(T a, T b) ;
  virtual T log(T a, T b) ;
  T exp_naive(T base, T exponent);
  T exp_quick(T base, T exponent);
  T log_naive(T base, T exponent);
  void compute_factors_of_order();
  bool is_quadratic_residue(T q);
  virtual void compute_omegas(Vec<T> *W, int n, T w);
  void compute_omegas_cached(Vec<T> *W, int n, T w);
  virtual T weak_rand(void);
  bool is_prime_root(T nb);
  void find_prime_root();
  T get_root();
  T get_prime_root();
  bool check_prime_root(T nb);
  bool check_order_naive(T nb, T order);
  T do_step_get_order(T x, T h, std::vector<T> *primes,
    std::vector<int> *exponent);
  T get_order(T x);
  virtual T get_nth_root(T n);
  T get_code_len(T n);
  T get_code_len_high_compo(T n);
 private:
  bool compute_factors_of_order_done = false;
  std::vector<T>* primes = NULL;
{'fraction_non_alphanumeric': 0.13121345029239767, 'fraction_numerical': 0.0003654970760233918, 'mean_word_length': 3.694682675814751, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '3325609', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1110, 'n_words': 353}