Skip to content

Instantly share code, notes, and snippets.

@pathaine
Last active September 3, 2019 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pathaine/1dd9e60e06b9c9311ac24de2bd18ae42 to your computer and use it in GitHub Desktop.
Save pathaine/1dd9e60e06b9c9311ac24de2bd18ae42 to your computer and use it in GitHub Desktop.
Plaintext calculate_sine_array(int m, int N, int start, int stop, CryptoContext<DCRTPoly> cc) {
vector<int64_t> *sines = new vector<int64_t>();
for (int k = 0; k != N; k++) {
if (k < start || k >= stop) {
sines->push_back(0);
continue;
}
int sinVal = int(sin(((2 * pi * k * m) / N)) * 100); //FOR MORE ACCURATE RESULTS, INCREASE MULTIPLE OF 10
sines->push_back(sinVal);
}
Plaintext sineArray = cc->MakePackedPlaintext(*sine);
return sineArray;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment