# FindBootstrapRotationIndices() error when adding Bootstrap

**URL:** <https://openfhe.discourse.group/t/findbootstraprotationindices-error-when-adding-bootstrap/1834>\
**Category:** Library Questions\
**Created:** [January 14, 2025, 8:24pm UTC](https://openfhe.discourse.group/t/findbootstraprotationindices-error-when-adding-bootstrap/1834 "2025-01-14T20:24:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![malioboro](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@malioboro](https://openfhe.discourse.group/u/malioboro)\
**Post date:** [January 14, 2025, 8:24pm UTC](https://openfhe.discourse.group/t/findbootstraprotationindices-error-when-adding-bootstrap/1834/1 "2025-01-14T20:24:30Z")

</div>

I modified a public code for encrypted inference using CNN (with CKKS scheme). Actually it only needs depth 6 for the inference. But I am just experimenting to put bootstrapping there to test my understanding. I plan to call the bootstrapping in the middle of the inference (like after 3 multiplications)

I set the parameters as below:

```auto
    parameters.SetSecurityLevel(HEStd_128_classic);

    SecretKeyDist secretKeyDist = UNIFORM_TERNARY;
    uint32_t levelsAvailableAfterBootstrap = 5;
    std::vector<uint32_t> levelBudget = {4, 4};
    usint depth = levelsAvailableAfterBootstrap + FHECKKSRNS::GetBootstrapDepth(levelBudget, secretKeyDist);
    parameters.SetMultiplicativeDepth(depth);
    std::cout << "CKKS parameter level required for bootstrap: " << FHECKKSRNS::GetBootstrapDepth(levelBudget, secretKeyDist) << std::endl;
 
    parameters.SetScalingModSize(59);
    parameters.SetFirstModSize(60);
    parameters.SetBatchSize(num_slots); // num_slots=16384

    m_cc = GenCryptoContext(parameters);

    m_cc->Enable(PKE);
    m_cc->Enable(KEYSWITCH);
    m_cc->Enable(LEVELEDSHE);
    m_cc->Enable(ADVANCEDSHE);
    m_cc->Enable(FHE);

    m_cc->EvalBootstrapSetup(levelBudget);

    KeyPair<DCRTPoly> key_pair = m_cc->KeyGen();
    m_SecretKey = key_pair.secretKey;
    m_PublicKey = key_pair.publicKey;

    vector<int32_t> rotations = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 33, 34, 64, 65, 66, 128, 256, 512, 1024, 2048, 4096, 8192};
    m_cc->EvalBootstrapKeyGen(m_SecretKey, num_slots);
    m_cc->EvalRotateKeyGen(m_SecretKey, rotations);
    m_cc->EvalMultKeyGen(m_SecretKey);
   ...

```

And when I run, I keep getting this error while generating keys:

```auto
/ckksrns-fhe.cpp:l.756:FindBootstrapRotationIndices(): Precomputations for 16384 slots were not generated Need to call EvalBootstrapSetup to proceed

```

I don’t really understand what happened here. Can someone help explain why it happened and what I should do. Thanks 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:** [January 14, 2025, 9:43pm UTC](https://openfhe.discourse.group/t/findbootstraprotationindices-error-when-adding-bootstrap/1834/2 "2025-01-14T21:43:01Z")

</div>

It seems you did not pass the number of slots as a parameter to EvalBootstrapSetup (check [openfhe-development/src/pke/examples/advanced-ckks-bootstrapping.cpp at main · openfheorg/openfhe-development · GitHub](https://github.com/openfheorg/openfhe-development/blob/main/src/pke/examples/advanced-ckks-bootstrapping.cpp)). If the argument for the number of slots is not passed, the default value is ring dimension/2. You can print the ring dimension and check its value, but probably it will be larger than num\_slots \* 2 given the error you are getting.
