poulpy/spqlios/lib/test/testlib/polynomial_vector.h
spqlios/lib/test/testlib/polynomial_vector.hRaw
1#ifndef SPQLIOS_POLYNOMIAL_VECTOR_H
2#define SPQLIOS_POLYNOMIAL_VECTOR_H
3
4#include "negacyclic_polynomial.h"
5#include "test_commons.h"
6
7/** @brief a test memory layout for znx i64 polynomials vectors */
8class znx_vec_i64_layout {
9 uint64_t n;
10 uint64_t size;
11 uint64_t slice;
12 int64_t* data_start;
13 uint8_t* region;
14
15 public:
16 // NO-COPY structure
17 znx_vec_i64_layout(const znx_vec_i64_layout&) = delete;
18 void operator=(const znx_vec_i64_layout&) = delete;
19 znx_vec_i64_layout(znx_vec_i64_layout&&) = delete;
20 void operator=(znx_vec_i64_layout&&) = delete;
21 /** @brief initialises a memory layout */
22 znx_vec_i64_layout(uint64_t n, uint64_t size, uint64_t slice);
23 /** @brief destructor */
24 ~znx_vec_i64_layout();
25
26 /** @brief get a copy of item index index (extended with zeros) */
27 znx_i64 get_copy_zext(uint64_t index) const;
28 /** @brief get a copy of item index index (extended with zeros) */
29 znx_i64 get_copy(uint64_t index) const;
30 /** @brief get a copy of item index index (index<size) */
31 void set(uint64_t index, const znx_i64& elem);
32 /** @brief fill with random values */
33 void fill_random(uint64_t bits = 63);
34 /** @brief raw pointer access */
35 int64_t* data();
36 /** @brief raw pointer access (const version) */
37 const int64_t* data() const;
38 /** @brief content hashcode */
39 __uint128_t content_hash() const;
40};
41
42#endif // SPQLIOS_POLYNOMIAL_VECTOR_H