Last active
September 3, 2019 20:05
-
-
Save pathaine/286c4adee2b1f78e1d2cda81a9365018 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plaintext calculate_cosine_array(int n, int N, int start, int stop, CryptoContext<DCRTPoly> cc) { | |
vector<int64_t> *cosines = new vector<int64_t>(); | |
for (int k = 0; k != N; k++) { | |
if (k < start || k >= stop) { | |
cosines->push_back(0); | |
continue; | |
} | |
int cosVal = int(cos(((2 * pi * k * n) / N)) * 100); //FOR MORE ACCURATE RESULTS, INCREASE MULTIPLE OF 10 | |
cosines->push_back(cosVal); | |
} | |
Plaintext cosineArray = cc->MakePackedPlaintext(*cosines); | |
return cosineArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment