Can I use imaginary part of plaintext in CKKS?

Hello.
I’m trying to encoding the complex message into CKKS plaintext.
But, After packing the message, The imaginary part disappeared and only the real part remained. In other words, in the code below, the entire complex number is shown in the output of vec1, but only the real part is shown in the output of res_vec1.
Can I use tuple message (real, imaginary) in a slot by leveraging the property of complex plaintext domain?

The above code includes following delcation.
typedef std::complex dcomplex;

At this time, complex numbers are not supported in OpenFHE as we use the imaginary component to estimate the approximation error (which used for security in the scenario when decryptions results are shared). So only real numbers are supported in CKKS, which is what we see in most applications.

We are thinking about adding support for complex numbers in v1.2. What use case with complex numbers are you thinking about/working on?

1 Like

I want to add that you can emulate complex computations by storing the real and imaginary parts of your data in separate ciphertexts.

1 Like

I just wondered if I can leverage the algebraic properties of complex numbers when performing homomorphic operations on ciphertexts(not specific use cases…). Thank you for replying! :blush:

Hi,
Can OpenFHE currently perform operations on complex numbers and retrieve the imaginary part upon decryption? If so, I am currently losing the imaginary part upon decryption. Is there an update or method available to prevent this loss?

Currently the CKKS implementation in OpenFHE only works with real inputs, because it was modified to use the imaginary part for error estimation. If you need to work with imaginary numbers, you can try to manually modify the CKKS encoding as in here.