# CKKS RNS variant in the threshold example

**URL:** <https://openfhe.discourse.group/t/ckks-rns-variant-in-the-threshold-example/1003>\
**Category:** Library Questions\
**Tags:** questions\
**Created:** [January 2, 2024, 9:11am UTC](https://openfhe.discourse.group/t/ckks-rns-variant-in-the-threshold-example/1003 "2024-01-02T09:11:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stylianos\_x](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@stylianos\_x](https://openfhe.discourse.group/u/stylianos_x)\
**Post date:** [January 2, 2024, 9:11am UTC](https://openfhe.discourse.group/t/ckks-rns-variant-in-the-threshold-example/1003/1 "2024-01-02T09:11:26Z")

</div>

In [this example](https://github.com/openfheorg/openfhe-development/blob/main/src/pke/examples/threshold-fhe.cpp#L416), we see the usage of

```auto
CCParams<CryptoContextCKKSRNS> parameters;
    parameters.SetMultiplicativeDepth(3);
    parameters.SetScalingModSize(50);
    parameters.SetBatchSize(batchSize);

    CryptoContext<DCRTPoly> cc = GenCryptoContext(parameters);
    // enable features that you wish to use
    cc->Enable(PKE);
    cc->Enable(KEYSWITCH);
    cc->Enable(LEVELEDSHE);
    cc->Enable(ADVANCEDSHE);
    cc->Enable(MULTIPARTY);

```

to generate the parameters.

I was reading [this paper](https://eprint.iacr.org/2022/915.pdf) about the library and wondered,  
which of the RNS variants is used in the code above?

---

<div class="post-metadata">

**Author:** ![mmazz](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@mmazz](https://openfhe.discourse.group/u/mmazz)\
**Post date:** [January 2, 2024, 6:36pm UTC](https://openfhe.discourse.group/t/ckks-rns-variant-in-the-threshold-example/1003/2 "2024-01-02T18:36:45Z")

</div>

If I’m not wrong, by default is in mode FLEXIBLEAUTOEXT that is the variant RE-CKKS-DE in this paper [Approximate Homomorphic Encryption with Reduced Approximation Error](https://eprint.iacr.org/2020/1118).

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [January 2, 2024, 8:32pm UTC](https://openfhe.discourse.group/t/ckks-rns-variant-in-the-threshold-example/1003/3 "2024-01-02T20:32:25Z")

</div>

As @mmazz mentioned, CKKS defaults to `FLEXIBLEAUTOEXT` scaling if no specific technique is selected. You can set the scaling technique as follows:

```auto
CCParams<CryptoContextCKKSRNS> parameters;
parameters.SetScalingTechnique(<your_preferred_technique>);

```
