Encrypted vector processing in CKKS scheme

Hello, a question about the encrypted vector of the CKKS scheme.
From the theory I understood that in principle it is possible to process members of encrypted vector separately.
For example, I need to split the encrypted vector into two parts. In examples and documentation I did not find information on how to do it.
Could you please tell me where I can find information on how to split an encrypted vector into two vectors, if it is possible at all.

If I got you question, you can “split” an encrypted vector by masking as follows:

v = [1, 2, 3, 4]
v_1 = [1, 2, 3, 4] * [1, 1, 0, 0] = [1, 2, 0, 0]
v_1 = [1, 2, 3, 4] * [0, 0, 1, 1] = [0, 0, 3, 4]

Didn’t even think to use the method there, thanks!

But still wondering if I can process each element separately. For example

v = [1, 2, 3, 4, 5, 6]
v_1 = [1, 3, 5]
v_2 = [2, 4, 6]

This is necessary to add up the vectors. The way you’re doing it, it goes like this:

v = [1, 2, 3, 4, 5, 6]
v_1 = [1, 0, 3, 0, 5, 0]
v_2 = [0, 2, 0, 4, 0, 6]
v_3 = [1, 0, 3, 0, 5, 0] + [0, 2, 0, 4, 0, 6] = [1, 2, 3, 4, 5, 6]

Maybe I can do that with a rotation? But from the example I didn’t quite understand how it works.

Uhm, I don’t understand your goal. If you want to add pair of values you can do it with a rotation:

v     = [1, 2, 3, 4]
v_r   = rot(v, 1)   #[2, 3, 4, 1]

v_res = v + v_r = [1, 2, 3, 4] + [2, 3, 4, 1]

But perhaps I am missing your point.

you cannot process an individual element in an encrypted vector. you must process all elements with the same instruction (that is why it is called SIMD – single instruction multiple data.
one thing about rotation, you are rotating the ENTIRE vector which for CKKS is ringsize/2 . if you do not fully load the vector, then you will get zeros (+small noise) rotating in from the end.
see openfhe-development/src/pke/examples/rotation.cpp at main · openfheorg/openfhe-development · GitHub
for examples.

for example when we do a dot product of two vectors, we to the hadamard multiplication of the two then we take the result, and add it to a copy rotated by 1, repeat rotated by 2, 4, 8 etc. until we basically have a vector of all the same values, which is the summation. (note there is an input variable that lets you specify the sublength (power of 2) of the vector you actually care about (assuming the remaining elements are zero) – that limits where we stop.