CKKS encoding implementation questions

Hello!

I’m still in the journey of understanding the implementation of CKKS. I start to dig in the encoding (ckkspackedencoding.cpp) and I have many doubts. At least the papers that I using do not answer this questions.

  1. When creating a PlainText, is there when the modulis qi’s are “created”/Chosen? (The ones for the encryption)

  2. After using FFTSpecialInv (line 272), a vector twice the size of the FFT output is created, and the first half is filled with the real part of the output and the second half with the imaginary. Why?

  3. The last one, has something to do with the way that approximation error is then computed?

  4. When we fill this vector, we do not allow negative values, by adding the max value possible, why?

  5. I see that after this step, this vector is mapped into multiple towers (or limbs). This is a step for optimization purposes? For the encryption. (I recall that the CKKS encoding has no “RNS”).