# Matrix rotations in CKKS

Hello. I have some questions about rotation in CKKS.

In CKKS, can I pack a matrix into a ciphertext and rotate it while maintaining its matrix structure? More precisely, I want to rotate a CKKS ciphertext like the example provided in this link: https://openfhe.discourse.group/t/rotation-in-bfv/416, especially regarding row-wise rotation. Is row-wise rotation possible in CKKS without consuming ciphertext’s levels?

I would also like to understand the details of the EvalSumRow and EvalSumColumn operations. Do these operations consume additional levels of ciphertexts? If not, how is this possible?

My last question is related to the Hypercube structure rotation technique introduced in the paper Algorithms in HElib. Is it not applicable in CKKS? If so, is it due to the properties of the CKKS plaintext domain, which is a cyclotomic ring of characteristic zero?

In CKKS, we deal with a single-dimension “hypercube”, i.e., with cyclic, one-dimensional rotations. So the more complex plaintext algebra in HElib does not apply here. in BGV/BFV (as implemented in OpenFHE), we work only with the plaintext algebra that supports a 2-dimensional hypercube (there are 2 rows, each of them is half the ring dimension). This is why there was a discussion about swapping these rows and the like.

`EvalSumRows` is implemented using Algorithm 2 in Efficient Logistic Regression on Large Encrypted Data. `EvalSumCols` is implemented using Algorithm 3 in the same paper.

1 Like

Hello!

I’d like to know the implementation details of EvalSum.

The naive method I can think of is to repeatedly perform EvalRotate up to the batch size and then take EvalAdd. Is the implementation similar to this approach (using rotation and addition)?

Additionally, I want to know what the EvalSumKeys are. Are they a kind of automorphism keys?

Thank you!