I am encrypting a vector into ciphertext, and I want to exchange some values in the ciphertext for each other. What should I do?

I am encrypting a vector into ciphertext, and I want to exchange some values in the ciphertext for each other. What should I do?

What do you mean? Something like

v1 = [1,2,3, 0, 0, 0, 0]
v2 = [4,5,6, 0, 1, 10, 20]

v2.exchange(v1, [0, 1, 2])

which results in

v1 = [4, 5, 6, 0, 0, 0, 0]
v2 = [1, 2, 3, 0, 1, 10, 20]

? If so then it’s not possible with OpenFHE directly.

Edit: on further thought it should be possible by masking out values and storing them into temporary vectors, but that will incur more multiplications. You’re probably better off formulating it in a different way if possible

I want to rephrase the problem, that is, a vector is encrypted to the server, and then the index value corresponding to this ciphertext is also transmitted, I want to reorder this ciphertext according to this index or regenerate a vector with all 0 and then encrypt the ciphertext and then add the ciphertext with the corresponding value according to this index

I suggest reading Slot-shuffling homomorphically - #4 by ypolyakov