In the src/pke/lib/encoding/ckkspackedencoding. CPP code, the CKKSPackedEncoding::Encode() function, along with its helper FitToNativeVector function, is used to encode sparse slots into a specific format. The “a0b0c0d0” format.
How to convert the “a0b0c0dd” into “abcd abcd”? or which function?
Make sure you do not confuse the slots representation with the coefficient representation.
To gain efficiency when your vector length is smaller than ring_dim / 2, in the slot representation, you clone your vector as abcdabcd. Encoding changes the representation from slots to coefficients through a Fourier Transform. There, you need to map the subring defined by your smaller number of slots, R[Y]/(Y^{2*slots}+1)
to the full ring R[X]/(X^ring_dim + 1)
. The homomorphism doing this is Y -> X^{ring_dim / 2*slots}
, which is why you see that x0y0z0t0 format in the coefficient representation.
Wow! U make me understand this concept