CKKS’s batch encoding scheme (Summary D-3.1 in §D-3.1) implicitly supports homomorphic rotation of input slot vectors like that of BFV’s homomorphic rotation (Summary D-2.9.3 in §D-2.9.3). This is because CKKS uses the same encoding and decoding matrices ( and ) designed for the BFV encoding and decoding scheme that supports homomorphic rotation of input vector slots. Although the roots of the -th cyclotomic polynomial are different for the BFV and CKKS schemes (as one is designed over and the other is over ), CKKS still can use the same (and ) matrices as BFV, because the -th cyclotomic polynomial over exhibits the same essential properties as the -th cyclotomic polynomial over (as explained in §A-9). Especially, the roots of both cyclotomic polynomials are the primitive -th roots of unity having the order , and those distinct roots are defined as , where can be any root. Therefore, substituting CKKS’s -th roots of unity into the terms in BFV’s encoding matrix (and decoding matrix ) preserves the same computational correctness for the encoding and decoding schemes, as well as for input vector slot rotation.
Importantly, the and matrices in both the BFV and CKKS schemes satisfy the exact requirement for supporting input vector slot rotation. That is, given the following relations:
, updating the polynomial to results in the effect of rotating the first half of the -dimensional input vector slots ( in the case of BFV, and the forward-ordered Hermitian vector in the case of CKKS) by positions to the left (in a wrapping manner among them) and the second half of the slots also by positions to the right (in a wrapping manner among them).
BFV uses CKKS’s same rotation scheme described in Summary D-2.9.3 (in §D-2.9.3) as follows:
Summary D-3.9 CKKS’s Homomorphic Rotation of Input Vector Slots
Suppose we have an RLWE ciphertext and a key-switching key as follows:
,
Then, the procedure of rotating all elements of the ciphertext’s original input vector by positions to the left is as follows:
Rotation within Half Slots: Like BFV, CKKS rotates the first half of the forward-ordered Hermitian input vector slots and the second half of its slots separately in a partitioned manner. This is because the first half rows of comprise the terms for (i.e., evaluates at ), whereas the second half rows of comprise the terms (i.e., evaluates at ), and the computed values of and repeat (i.e., rotate) within their own rotation group across . Because of this structure of and , BFV and CKKS cannot design a wrapping rotation scheme across all slots of the input vector homogeneously, but can instead design a wrapping rotation scheme across each group of the first-half and the second-half slots of the input vector in a partitioned manner. That being said, CKKS can meaningfully only use the first slots for homomorphic computations anyway, because the latter slots are conjugates of the first slots which cannot be chosen by the user but are deterministically configured based on the first . On the other hand, in BFV, the user can choose the entire according to his/her needs, so BFV’s utility of slots is full . Therefore, the user can use BFV’s first-half slots and second-half slots together to perform parallel computations.
In this subsection, we will show the following 2 examples:
We will use the same example of the input vector used in §D-3.1.1: .
Remember that the encoded plaintext polynomial of is as follows:
Suppose we want to rotate the input vector by 1 position to the left as follows:
Therefore, we update to as follows:
The rotated forward-ordered Hermitian input vector is computed as follows:
Extract the first elements in the above Hermitian vector to recover the input vector:
# The original input vector rotated by 1 position to the left
In practice, we do not directly update to , because we would not have access to the plaintext polynomial unless we have the secret key . Therefore, we instead update to , which is equivalent to homomorphically rotating the encrypted input vector slots. Then, decrypting and decoding it would output .
Source Code: Examples of CKKS’s homomorphic input vector slot rotation can be executed by running this Python script.