#include "../src/HEAAN.h"
#include "../src/SchemeAlgo.h"
int main(int argc, char **argv)
{
long logq = 1200;
long logp = 50;
long logSlots = 2;
long logT = 2;
long logI = 4;
long logQ = 1200;
long boot_logq = 62;
srand(time(NULL));
SetNumThreads(8);
TimeUtils timeutils;
Ring ring;
SecretKey secretKey(ring);
Scheme scheme(secretKey, ring);
timeutils.start("Key generating");
scheme.addBootKey(secretKey, logSlots, boot_logq + logI);
timeutils.stop("Key generated");
long slots = (1 << logSlots);
vector<double> mval = {1.0, 2.0, 3.0, 4.0};
Ciphertext cipher;
Ciphertext cipherArray[slots];
scheme.encrypt(cipher, &mval.front(), slots, logp, logq);
for (long i=0 ; i < slots ; i++)
scheme.encrypt(cipherArray[i], &mval[i], 1, logp, logq);
scheme.bootstrapAndEqual(cipherArray[0], boot_logq, logQ, logT, logI);
// scheme.bootstrapAndEqual(cipher, boot_logq, logQ, logT, logI);
return 0;
}
This code crashes. But if you comment the boostrapping of cipherArray[0] and uncomment that of cipher, it works fine.
Does boostrapping have to be done on ciphers with slots of powers of two that are greater than 0? (logSlots >=1 ?)
Oh I figured it out. I need to create a bootkey for that particular size of slots of ciphertext. E.g create a boot key for logSlots of size 0 if I want to bootstrap 1-slotted ciphers
This code crashes. But if you comment the boostrapping of
cipherArray[0]
and uncomment that ofcipher
, it works fine. Does boostrapping have to be done on ciphers with slots of powers of two that are greater than 0? (logSlots >=1 ?)