Vector dot product in Microsoft SEAL using the CKKS scheme I'm trying to use the Microsoft SEAL library in order to do Matrix multiplication. That's why I'm trying to find a way to compute the Dot Product of 2 vectors. 

My issue is that the CKKS encoder in SEAL encodes entire vectors. So if I had a 2D vector of floats I get a 1D vector of Plaintext (and then a 1D vector of Ciphertext after encryption). 

The operations that I am able to do are: addition, component-wise multiplication, exponential, and rotation. In order to do a dot product of vectors I need to multiply the components of the first vector by the components of the second vector and sum them up. If I want to multiply 2 matrices, I can transpose the second matrix and multiply the rows together but I am unable to compute the sum of the elements inside the Ciphertext. Is it possible to get the sum of those elements in the Ciphertext? Should I change my approach?
As suggested by Hilder Vitor Lima Pereira in the comments and KyoohyungHan on Github in the issue https://github.com/microsoft/SEAL/issues/138, it is possible to sum the elements with rotations:


  For example,
  {1, 2, 3, 4} is encrypted in a ciphertext.
  You can get encrypted {3, 4, 1, 2} using homomorphic rotation by index 2.
  With homomorphic addition, you have encrypted {4, 6, 4, 6}.
  After that, you can get encrypted {6, 4, 6, 4} using homomorphic rotation by index 1.
  Finally, you have encrypted {10, 10, 10, 10} with homomorphic addition which is the sum of the element in a ciphertext.