Bug[he/rlwe]: he.LinearTransfromationEvaluator.EvaluateManyNew
correctness error
#455
Labels
bug
Something isn't working
Summary
he.EvaluateLinearTransformationsMany
computes the CRT decomposition of the input ciphertext once and stores it in the fieldBuffDecompQP
of therlwe.Evaluator
. It then uses it to compute the necessary lazy-pre-rotated ciphertexts for each linear transformation, re-usingBuffDecompQP
ifMultiplyByDiagMatrixBSGS
is called, or is directly passed as an argument for the lazy gadget forMultiplyByDiagMatrix
.However
BuffDecompQP
is used as a temporary buffer when callingGadgetProductLazy
. This overwrites the pre-computed CRT decomposition of the input ciphertext, resulting in badly produced lazy-pre-rotated after the first linear transformation.Since
GadgetProductHoisted
is called instead when callingMultiplyByDiagMatrix
, it does not happen in this case because this method does not accessBuffDecompQP
.Note that this bug only happens if new lazy-pre-rotated ciphertexts need to be produced from the pre-computed CRT decomposition after the first linear transformation.
Suggested Fix
rlwe.Evaluator
do not modify the bufferBuffDecompQP
or document it if they do.EvaluateLinearTransformationsMany
. The current implementation can result in unnecessary memory allocation and hoisted rotations since ciphertexts that are not needed for the next linear transformation are removed from the map, but they might be needed for the subsequent ones, and thus have to be re-generated.The text was updated successfully, but these errors were encountered: