# Inquiries on CKKS Scheme and Real Number Optimization in OpenFHE

**URL:** <https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803>\
**Category:** Library Questions\
**Created:** [December 23, 2024, 9:06am UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803 "2024-12-23T09:06:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![David](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@David](https://openfhe.discourse.group/u/David)\
**Post date:** [December 23, 2024, 9:06am UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803/1 "2024-12-23T09:06:11Z")

</div>

Dear OpenFHE Team,

First of all, I would like to express my appreciation for OpenFHE. It is the best homomorphic encryption library I have come across. I am currently conducting research in this field and have a few questions regarding the CKKS scheme in OpenFHE.

1. Does the current implementation of CKKS in OpenFHE support the techniques mentioned in the paper _“Approximate Homomorphic Encryption over the Conjugate-invariant Ring”_?
2. Similarly, does it support the techniques described in the paper _“Accelerating HE Operations from Key Decomposition Technique”_?
3. If these features are not currently supported, are there any plans to incorporate them into future releases?

Additionally, I noticed that when working with real numbers only, the imaginary part becomes unnecessary. By reducing the use of `EvalMod` for the imaginary part during CKKS bootstrapping, the precision and performance could potentially be improved. Is there any plan to provide an option in OpenFHE to specifically support real numbers while ignoring the imaginary part?

I am relatively new to this field, so I apologize if my questions seem naive. I sincerely appreciate any insights you could provide. Thank you for your time and effort in maintaining and advancing OpenFHE.

Best regards,  
zwp

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [December 23, 2024, 10:41pm UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803/2 "2024-12-23T22:41:20Z")

</div>

Thank you for the questions.

> [@David](#):
>
> Does the current implementation of CKKS in OpenFHE support the techniques mentioned in the paper _“Approximate Homomorphic Encryption over the Conjugate-invariant Ring”_?

We built a prototype of it but did not add it to the official release of OpenFHE because it is not clear how to efficiently do bootstrapping for it, i.e., how to apply a collapsed FFT technique in the linear transforms (the only practical way is to switch to complex CKKS and pay the [double] cost for bootstrapping). The original paper did not provide a bootstrapping procedure for it.

> [@David](#):
>
> Similarly, does it support the techniques described in the paper _“Accelerating HE Operations from Key Decomposition Technique”_?

This technique is less efficient than hybrid key switching for 1, 2, or 3 digits (which are common configurations for bootstrapping or deep computations). The technique outperforms hybrid (or BV) key switching only when the number of digits is 4 or higher. We often try to avoid such scenarios in practice (as keys become large). In other words, the extra complexity of implementing this method is not justified by the efficiency gains we would get from it (only in certain special cases).

> [@David](#):
>
> If these features are not currently supported, are there any plans to incorporate them into future releases?

Currently, we are not planning to add them due to the limitations discussed above.

> [@David](#):
>
> Additionally, I noticed that when working with real numbers only, the imaginary part becomes unnecessary. By reducing the use of `EvalMod` for the imaginary part during CKKS bootstrapping, the precision and performance could potentially be improved. Is there any plan to provide an option in OpenFHE to specifically support real numbers while ignoring the imaginary part?

We are planning to revisit the support of complex numbers and real numbers. We may add the support for complex numbers (for some scenarios). We will revisit the real number arithmetic at the same time.

---

<div class="post-metadata">

**Author:** ![David](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@David](https://openfhe.discourse.group/u/David)\
**Post date:** [December 24, 2024, 6:04am UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803/3 "2024-12-24T06:04:56Z")

</div>

Thank you for your patience in answering my questions. Additionally, I’ve noticed that bootstrapping to a lower level often takes significantly less time compared to bootstrapping to a higher level. For practical applications, if only one level of noise needs to be refreshed, bootstrapping to more levels would be unnecessary and time-consuming. I’d like to know if OpenFHE supports bootstrapping to a specific target level. If not, will it support this feature in the future, specifically for the CKKS scheme? Thanks again!

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [December 24, 2024, 9:29pm UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803/4 "2024-12-24T21:29:08Z")

</div>

> [@David](#):
>
> I’d like to know if OpenFHE supports bootstrapping to a specific target level.

No, it is not currently supported. It could be easily added. I’ve created an issue for it: [Support CKKS bootstrapping to a specific output level · Issue #927 · openfheorg/openfhe-development · GitHub](https://github.com/openfheorg/openfhe-development/issues/927)

---

<div class="post-metadata">

**Author:** ![David](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@David](https://openfhe.discourse.group/u/David)\
**Post date:** [December 25, 2024, 6:14am UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803/5 "2024-12-25T06:14:15Z")

</div>

thank you very much！！！

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [January 31, 2025, 10:12pm UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803/6 "2025-01-31T22:12:11Z")

</div>

I took a pass at adding this capability. Unfortunately, it turned out to be more complicated than I thought. I added more detailed comments in the issue. I moved to the issue to the Future Releases milestone. In other words, it will not be available in v1.3, which is the next significant version of OpenFHE.

---

<div class="post-metadata">

**Author:** ![David](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@David](https://openfhe.discourse.group/u/David)\
**Post date:** [March 13, 2025, 3:47am UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803/7 "2025-03-13T03:47:29Z")

</div>

Could you guide me on how to use openfhe-python to compute the time it takes for a ciphertext to bootstrap from level 0, progressing to level 1, level 2, and so on, up to level 24 (the maximum level that bootstrapping can reach)? Bootstrapping also consumes layers, so the full level should be the maximum level that bootstrapping can reach plus the number of layers consumed by bootstrapping, right?

Also, could you explain the relationship between “depth” and “ciphertext level” in the code? The comments mention that the “level” is the number of rescale executions, and that rescaling consumes layers, which seems to be the opposite of the level. This is a bit confusing.

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [March 14, 2025, 10:48pm UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803/8 "2025-03-14T22:48:55Z")

</div>

This topic is closed, and the questions are different from the original ones. I suggest opening a new topic.

---

<div class="post-metadata">

**Author:** ![oksuman](https://avatars.discourse-cdn.com/v4/letter/o/6de8d8/32.png) [@oksuman](https://openfhe.discourse.group/u/oksuman)\
**Post date:** [June 4, 2025, 12:21pm UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803/9 "2025-06-04T12:21:27Z")

</div>

> [@ypolyakov](#):
>
> The technique outperforms hybrid (or BV) key switching only when the number of digits is 4 or higher.

Hello, I have a question about the meaning of “digits” in this context.  
Does the number of digits correspond to _dnum_ in the paper [Better Bootstrapping for Approximate Homomorphic Encryption](https://eprint.iacr.org/2019/688.pdf)?

Thank you.

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [June 4, 2025, 8:03pm UTC](https://openfhe.discourse.group/t/inquiries-on-ckks-scheme-and-real-number-optimization-in-openfhe/1803/10 "2025-06-04T20:03:12Z")

</div>

In the case of hybrid key switching, yes, it is dnum.
