Change logic for BGV modulus switching in the AUTO mode
Currently, PALISADE does modulus switching right before the next multiplication, both ciphertext-ciphertext and ciphertext-plaintext. In the latter case, this causes unnecessary extra modulus switching operations. Change the logic so that automated modulus switching (down to the original noise scale) is done only right before ciphertext-ciphertext multiplications.
This will speed up the BGV AUTO modulus switching mode when many ciphertext-plaintext multiplications are done and then the results are aggregated before calling a ciphertext-ciphertext multiplication. In this scenario, the number of modulus switching operations will get reduced.
Edited by Yuriy Polyakov