The result of rotation example for BFVrns

Hi! I’m not sure if this is the right output… I didn’t modify anything and simply compiled and ran the rotation example. However, the result for BFVrns seems like doing a shift instead of rotation. Could someone please confirm this?

Thank you!

Hi @ballb,

This is expected. When the input with 10 numbers is encoded, additional (approximate in the case of CKKS) 0’s will be added to fill all available slots (ring dimension in BFV or half the ring dimension in CKKS). So you get a vector like (1,2,3,4,5,6,7,8,9,10,0,0,…) The rotations will be performed against this big vector, which is what you observe.

If you want to encode a small vector (size should be a power of 2), you can either specify the number of slots when calling MakeCKKSPackedPlaintext or simply clone the vector manually (pad with 0’s to the next power of 2 and then clone until the maximum number of slots).

1 Like