arnaucube
arnaucube/poulpyPublic Self-hosted repository
poulpy/spqlios/lib/test/testlib/fft64_layouts.h
spqlios/lib/test/testlib/fft64_layouts.hRaw
  1#ifndef SPQLIOS_FFT64_LAYOUTS_H
  2#define SPQLIOS_FFT64_LAYOUTS_H
  3
  4#include "../../spqlios/arithmetic/vec_znx_arithmetic.h"
  5#include "fft64_dft.h"
  6#include "negacyclic_polynomial.h"
  7#include "reim4_elem.h"
  8
  9/** @brief test layout for the VEC_ZNX_DFT */
 10struct fft64_vec_znx_dft_layout {
 11 public:
 12  const uint64_t nn;
 13  const uint64_t size;
 14  VEC_ZNX_DFT* const data;
 15  reim_vector_view view;
 16  /** @brief fill with random double values (unstructured) */
 17  void fill_random(double log2bound);
 18  /** @brief fill with random ffts of small int polynomials */
 19  void fill_dft_random(uint64_t log2bound);
 20  reim4_elem get(uint64_t idx, uint64_t blk) const;
 21  reim4_elem get_zext(uint64_t idx, uint64_t blk) const;
 22  void set(uint64_t idx, uint64_t blk, const reim4_elem& value);
 23  fft64_vec_znx_dft_layout(uint64_t n, uint64_t size);
 24  void fill_random_log2bound(uint64_t bits);
 25  void fill_dft_random_log2bound(uint64_t bits);
 26  double* get_addr(uint64_t idx);
 27  const double* get_addr(uint64_t idx) const;
 28  reim_fft64vec get_copy_zext(uint64_t idx) const;
 29  void set(uint64_t idx, const reim_fft64vec& value);
 30  thash content_hash() const;
 31  ~fft64_vec_znx_dft_layout();
 32};
 33
 34/** @brief test layout for the VEC_ZNX_BIG */
 35class fft64_vec_znx_big_layout {
 36 public:
 37  const uint64_t nn;
 38  const uint64_t size;
 39  VEC_ZNX_BIG* const data;
 40  fft64_vec_znx_big_layout(uint64_t n, uint64_t size);
 41  void fill_random();
 42  znx_i64 get_copy(uint64_t index) const;
 43  znx_i64 get_copy_zext(uint64_t index) const;
 44  void set(uint64_t index, const znx_i64& value);
 45  thash content_hash() const;
 46  ~fft64_vec_znx_big_layout();
 47};
 48
 49/** @brief test layout for the VMP_PMAT */
 50class fft64_vmp_pmat_layout {
 51 public:
 52  const uint64_t nn;
 53  const uint64_t nrows;
 54  const uint64_t ncols;
 55  VMP_PMAT* const data;
 56  fft64_vmp_pmat_layout(uint64_t n, uint64_t nrows, uint64_t ncols);
 57  double* get_addr(uint64_t row, uint64_t col, uint64_t blk) const;
 58  reim4_elem get(uint64_t row, uint64_t col, uint64_t blk) const;
 59  thash content_hash() const;
 60  reim4_elem get_zext(uint64_t row, uint64_t col, uint64_t blk) const;
 61  reim_fft64vec get_zext(uint64_t row, uint64_t col) const;
 62  void set(uint64_t row, uint64_t col, uint64_t blk, const reim4_elem& v) const;
 63  void set(uint64_t row, uint64_t col, const reim_fft64vec& value);
 64  /** @brief fill with random double values (unstructured) */
 65  void fill_random(double log2bound);
 66  /** @brief fill with random ffts of small int polynomials */
 67  void fill_dft_random(uint64_t log2bound);
 68  ~fft64_vmp_pmat_layout();
 69};
 70
 71/** @brief test layout for the SVP_PPOL */
 72class fft64_svp_ppol_layout {
 73 public:
 74  const uint64_t nn;
 75  SVP_PPOL* const data;
 76  fft64_svp_ppol_layout(uint64_t n);
 77  thash content_hash() const;
 78  reim_fft64vec get_copy() const;
 79  void set(const reim_fft64vec&);
 80  /** @brief fill with random double values (unstructured) */
 81  void fill_random(double log2bound);
 82  /** @brief fill with random ffts of small int polynomials */
 83  void fill_dft_random(uint64_t log2bound);
 84  ~fft64_svp_ppol_layout();
 85};
 86
 87/** @brief test layout for the CNV_PVEC_L */
 88class fft64_cnv_left_layout {
 89  const uint64_t nn;
 90  const uint64_t size;
 91  CNV_PVEC_L* const data;
 92  fft64_cnv_left_layout(uint64_t n, uint64_t size);
 93  reim4_elem get(uint64_t idx, uint64_t blk);
 94  thash content_hash() const;
 95  ~fft64_cnv_left_layout();
 96};
 97
 98/** @brief test layout for the CNV_PVEC_R */
 99class fft64_cnv_right_layout {
100  const uint64_t nn;
101  const uint64_t size;
102  CNV_PVEC_R* const data;
103  fft64_cnv_right_layout(uint64_t n, uint64_t size);
104  reim4_elem get(uint64_t idx, uint64_t blk);
105  thash content_hash() const;
106  ~fft64_cnv_right_layout();
107};
108
109#endif  // SPQLIOS_FFT64_LAYOUTS_H