CKKS Bootstrapping level management

Hi!
I want to know that in advanced-ckks-bootstrapping.cpp,we set the ciphertext to level depth - 1 which will only remain 1 level for bootstrapping. How can we finish a bootstrapping in 1 level?
usint depth = levelsAvailableAfterBootstrap +
FHECKKSRNS::GetBootstrapDepth(levelBudget, secretKeyDist);
parameters.SetMultiplicativeDepth(depth);
Plaintext ptxt = cryptoContext->MakeCKKSPackedPlaintext(x, 1, depth - 1, nullptr, numSlots);
ptxt->SetLength(numSlots);
std::cout << "Input: " << ptxt << std::endl;

// Encrypt the encoded vectors
Ciphertext<DCRTPoly> ciph = cryptoContext->Encrypt(keyPair.publicKey, ptxt);

std::cout << "Initial number of levels remaining: " << depth - ciph->GetLevel() << std::endl;

// Step 5: Perform the bootstrapping operation. The goal is to increase the number of levels remaining
// for HE computation.
auto ciphertextAfter = cryptoContext->EvalBootstrap(ciph);

std::cout << "Number of levels remaining after bootstrapping: " << depth - ciphertextAfter->GetLevel() << std::endl
          << std::endl;

// Step 7: Decryption and output
Plaintext result;
cryptoContext->Decrypt(keyPair.secretKey, ciphertextAfter, &result);
result->SetLength(numSlots);
std::cout << "Output after bootstrapping \n\t" << result << std::endl;

}

Inside CKKS bootstrapping, the ciphertext’s level is increased to the max, enabling bootstrapping to proceed without issues. The code you’re referring to simulates a ciphertext that has reached its computational limit - i.e., a state where no further homomorphic operations can be performed. This is the typical scenario where bootstrapping is invoked.

Thanks!
What’s more,I want to know if there’s anyway for us to increase levels remaining after bootstrapping. Because when I use ring dimension like 65536, levels don’t change sometimes. Even for dimension like 8192 or 4096,there’s still only 10 levels remaining which are unacceptable. I know we can use the iteration bootstrapping but I’m concerning that will caused efficiency declined.

Your question is not clear. What do you mean by “levels don’t change sometimes”?
You can always set the multiplicative depth as high as you want, but this might pump up the ring dimension which causes the scheme to run very slowly.

Using reasonable parameters (ring dimension = 64k) and bootstrap more is usually better than pumping the ring dimension to 2^17 and bootstrap less. This rule of thumb is generally true but it depends on the use case of interest.

I do not understand the part below. Do you claim you can do bootstrapping and get 10 levels after that with ring dimensions 2^13 or 2^14?! The only way I see this happens is if you disable the security check, which is not recommended.

Furthermore, please provide your code so we can help you better.