# Advanced-ckks-bootstrapping related questions

**URL:** <https://openfhe.discourse.group/t/advanced-ckks-bootstrapping-related-questions/1613>\
**Category:** Library Questions\
**Created:** [October 1, 2024, 11:36am UTC](https://openfhe.discourse.group/t/advanced-ckks-bootstrapping-related-questions/1613 "2024-10-01T11:36:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhavinmoriya](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@bhavinmoriya](https://openfhe.discourse.group/u/bhavinmoriya)\
**Post date:** [October 1, 2024, 11:36am UTC](https://openfhe.discourse.group/t/advanced-ckks-bootstrapping-related-questions/1613/1 "2024-10-01T11:36:26Z")

</div>

Hi,

My questions are based on the following link,

> <https://github.com/openfheorg/openfhe-development/blob/main/src/pke/examples/advanced-ckks-bootstrapping.cpp>

1. line 80: Does reducing complexity means increase the space in the context of spacetime continuum. As a result reduce time?

2. line 105: `parameters.SetFirstModSize(firstMod);` - What does it corresponds to in the CKKS paper?

3. How does `std::vector<uint32_t> levelBudget = {3, 3};` plays a role in deciding `FHECKKSRNS::GetBootstrapDepth(levelBudget, secretKeyDist); `– I was taking look at the function definition as follows,

```auto
uint32_t FHECKKSRNS::GetBootstrapDepth(uint32_t approxModDepth, const std::vector<uint32_t>& levelBudget,
                                       SecretKeyDist secretKeyDist) {
    if (secretKeyDist == UNIFORM_TERNARY) {
        approxModDepth += R_UNIFORM - 1;
    }

    return approxModDepth + levelBudget[0] + levelBudget[1];
}

uint32_t FHECKKSRNS::GetBootstrapDepth(const std::vector<uint32_t>& levelBudget, SecretKeyDist secretKeyDist) {
    uint32_t approxModDepth = GetModDepthInternal(secretKeyDist);

    return approxModDepth + levelBudget[0] + levelBudget[1];
}

```

I was wondering, we could have written `levelBudget = 6` intead. What is the reason we pass it as a vector and then sum it in the function definition than giving it as a sum beforehand?

Thank you very much.  
Bhavin.

---

<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:** [October 2, 2024, 2:39pm UTC](https://openfhe.discourse.group/t/advanced-ckks-bootstrapping-related-questions/1613/2 "2024-10-02T14:39:58Z")

</div>

1. Yes, it reduces the complexity in number of operations, but increases the memory complexity.
2. FirstModSize is the size of the lowest level modulus, q\_0.
3. The vector of levelBudget is not only used here, but also when doing precomputations for the homomorphic encoding and decoding, where you need to know how many levels each consumes, not just the sum. For simplicity, instead of passing the sum of the levels for one function and the vector of levels for another function, we pass the vector directly.

---

<div class="post-metadata">

**Author:** ![bhavinmoriya](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@bhavinmoriya](https://openfhe.discourse.group/u/bhavinmoriya)\
**Post date:** [October 2, 2024, 9:28pm UTC](https://openfhe.discourse.group/t/advanced-ckks-bootstrapping-related-questions/1613/3 "2024-10-02T21:28:43Z")

</div>

Thank you very much Andreea!
