I saw cryptoContext->EvalBootstrapKeyGen(keyPair.secretKey, numSlots); Why do we have to spacify the numSlots. Can’t the cryptocontext get it automatically? Can we do bootstrap only to a segment of the ct?
This is about sparse packing, where when you know that you need to work with fewer than ringDim/2 values, you can specify a number of slots (a power of 2 less than ringDim/2) and work with the corresponding subring. Bootstrapping can benefit from using a smaller number of slots (it becomes more efficient), but this doesn’t mean you only bootstrap some slots and not others–all slots are bootstrapped.
By default, numSlots is the value specified as batchSize when creating the cryptocontext. However, OpenFHE supports doing bootstrapping for different values of slots, as there are applications where this is a useful feature. In that case, you can do the necessary key generation and precomputations for various values of slots. You can check the example here.