# More details on EvalFHEWToCKKS and EvalCKKSToFHEW

**URL:** <https://openfhe.discourse.group/t/more-details-on-evalfhewtockks-and-evalckkstofhew/2214>\
**Category:** Library Questions\
**Created:** [November 13, 2025, 10:43am UTC](https://openfhe.discourse.group/t/more-details-on-evalfhewtockks-and-evalckkstofhew/2214 "2025-11-13T10:43:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mosi](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Mosi](https://openfhe.discourse.group/u/Mosi)\
**Post date:** [November 13, 2025, 10:43am UTC](https://openfhe.discourse.group/t/more-details-on-evalfhewtockks-and-evalckkstofhew/2214/1 "2025-11-13T10:43:50Z")

</div>

I took a look at your switch algorithms EvalFHEWToCKKS and EvalCKKSToFHEW in the repository. Comparing them with the switch algorithm in the PEGASUS paper, I see some differences such as: using Chebychev polynomial interpolation for evaluating the modular function, and also using linear transform for partial decryption differently than in PEGASUS (where they used the tiling technique). Could you share a paper/resource, beyond the explanation in SCHEME\_SWITCHING\_CAPABILITY, about these scheme switching algorithms you implemented? Thank you in advance.

---

<div class="post-metadata">

**Author:** ![andreea.alexandru](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/andreea.alexandru/32/378_2.png) [@andreea.alexandru](https://openfhe.discourse.group/u/andreea.alexandru)\
**Post date:** [November 17, 2025, 3:57pm UTC](https://openfhe.discourse.group/t/more-details-on-evalfhewtockks-and-evalckkstofhew/2214/2 "2025-11-17T15:57:58Z")

</div>

The implementation in OpenFHE follows the blueprint of the PEGASUS paper, and the modifications take advantage of the optimizations already implemented in OpenFHE. We use Chebyshev interpolation for the trigonometric approximation of the modular reduction function for numerical stability reasons. For the partial homomorphic decoding, we use a similar linear transform method, optimized to take advantage of double hoisting. Apart from these, in CKKStoFHEW, we do modulus switching to preserve security, and in FHEWtoCKKS, we do various corrections based on whether the messages are bits or larger integers.

We do not have a separate public resource for these algorithms. However, I suggest looking at the algorithms in `ckksrns-schemeswitching.cpp`, since there are many comments explaining the steps.

---

<div class="post-metadata">

**Author:** ![Mosi](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@Mosi](https://openfhe.discourse.group/u/Mosi)\
**Post date:** [November 22, 2025, 11:08am UTC](https://openfhe.discourse.group/t/more-details-on-evalfhewtockks-and-evalckkstofhew/2214/3 "2025-11-22T11:08:20Z")

</div>

Dear Andreea,

Thank you for your explanation; everything is clear to me now.

I also read the comments in the algorithm you mentioned, and those were helpful as well in understanding your implementation.
