Hello everyone, I have a question. When manually searching for precision bounds and using scaleModSize=40, I still get solutions. However, when I reduce it to 39, I encounter the following error:

what(): /usr/lib/openfhe-development/src/pke/lib/scheme/ckksrns/ckksrns-fhe.cpp:l.455:EvalBootstrap(): Degree [13] must be less than or equal to the correction factor [10].

Obviously, the correction factor or scaling factor is smaller than the degree of the polynomial. Is there a method to automatically calculate the degree so that I don’t have to manually search for lower bounds? Thanks in advance

Based on the error message, you seem to be asking about CKKS bootstrapping. When CKKS bootstrapping is used, FirstModSize should not exceed ScaleModSize by too many bits (10-12 or so). It sounds like you reduced scaleModSize to 39, while keeping FirstModSize at 60 (or some other high value). You should reduce FirstModSize to 50 or so. Please keep in mind that using ScaleModSize = 39 for bootstrapping will result in very low precision, so I would not recommend using such small values in principle.

To follow up on this question: is there a method to manually calculate the scaleModSize and corresponding bootstrapping precision? And is there a reason why FirstModSize should not exceed ScaleModSize by too many bits?

is there a method to manually calculate the scaleModSize and corresponding bootstrapping precision?

There is no estimator available for this in OpenFHE (it is a tricky problem). However, you can run a computation either in ESTIMATION or EXECUTION mode and examine the output precision reported by OpenFHE (several pke examples show this).

And is there a reason why FirstModSize should not exceed ScaleModSize by too many bits?

In scenarios with bootstrapping, we have limited room (if we use 64-bit integers) to achieve reasonable precision because a polynomial approximation of the sine function is used to approximate the desired modulo reduction operation (the main bottleneck of CKKS bootstrapping). This is why we try to set ScaleModSize as close to 60 as possible (to get highest precision).