forked from microsoft/SEAL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
croots.h
37 lines (28 loc) · 926 Bytes
/
croots.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#pragma once
#include "seal/memorymanager.h"
#include "seal/util/defines.h"
#include "seal/util/uintcore.h"
#include <complex>
#include <cstddef>
#include <stdexcept>
namespace seal
{
namespace util
{
class ComplexRoots
{
public:
ComplexRoots() = delete;
ComplexRoots(std::size_t degree_of_roots, MemoryPoolHandle pool);
SEAL_NODISCARD std::complex<double> get_root(std::size_t index) const;
private:
static constexpr double PI_ = 3.1415926535897932384626433832795028842;
// Contains 0~(n/8-1)-th powers of the n-th primitive root.
util::Pointer<std::complex<double>> roots_;
std::size_t degree_of_roots_;
MemoryPoolHandle pool_;
};
} // namespace util
} // namespace seal