in src/gowrapper/ckks/evaluator.go [126:145]
func lattigo_rescaleMany(evalHandle Handle4, paramsHandle Handle4, ctInHandle Handle4, numRescales uint64, ctOutHandle Handle4) {
var params *ckks.Parameters
params = getStoredParameters(paramsHandle)
var ctIn *ckks.Ciphertext
ctIn = getStoredCiphertext(ctInHandle)
var targetScale float64
targetScale = ctIn.Scale
for i := 0; i < int(numRescales); i++ {
targetScale /= (float64(params.RingQ().Modulus[ctIn.Level()-i]))
}
if targetScale <= 0 {
panic(errors.New("Target scale is too small: " + strconv.FormatFloat(targetScale, 'E', -1, 64) + "\t" + strconv.FormatFloat(ctIn.Scale, 'E', -1, 64) + "\t" + strconv.FormatFloat(math.Log2(ctIn.Scale), 'E', -1, 64) + "\t" + strconv.FormatUint(numRescales, 10)))
}
lattigo_rescale(evalHandle, ctInHandle, targetScale, ctOutHandle)
}