lightbulb128 / troy

GPU implementation of BFV, CKKS and BGV homomorphic encryption schemes.
MIT License
33 stars 3 forks source link

sum and matmul operation #8

Closed whitesleep333 closed 4 months ago

whitesleep333 commented 4 months ago

I previously used the tenseal library in Python for CKKS operations. The library has two useful ciphertext operators: sum and matmul. I would like to know if the troy library directly supports these two operators and, if so, how I can use them. Thank you.

lightbulb128 commented 4 months ago
  1. Sum. We don't support summing (along the slots) directly. You can implement it with log(N) rotations and additions.
  2. Matmul. We implement matrix multiplication with polynomial encoding, proposed by Cheetah. There are related unit tests in tests/app/linear.cu for BFV.
lightbulb128 commented 4 months ago

For matrix multiplication, I would recommend using our new library, which is rewritten for better efficiency and more user-friendly interfaces, and it also supports LWE packing for CKKS. The CKKS implementation in this repo does not support LWE packing so one may expect larger communication overhead than BFV matmul.

whitesleep333 commented 4 months ago

Thank you for your explanation. I will try using your new library. Thank you very much for your contribution.

lightbulb128 commented 4 months ago

I have just added a CKKS-matmul example in the new repo, which you can refer to.