Not able to use EvalLinearWSum with BGV

I am trying to run the same functionality as given in the example here
but with BGV/BFV instead of CKKS. However, it doesn’t seem to work. I get the following error -

EvalSumKeyGen operation has not been enabled

Hi @tremblerz

EvalLinearWSum takes as the second argument a vector of doubles, which makes sense only for CKKS. So this method is not supported in BGV.

In the case of BGV, one would need to work with a vector of scaled-up integers to get the same effect. Currently OpenFHE does not provide any special interface for working with fixed-precision arithmetic in BGV. It is assumed that the user would scale all real numbers and then round them to integers at the application level. Note that CKKS is significantly more efficient for real-number arithmetic.

I tried changing the linear weighted sum example to BGV and got an expected exception for this case:

======EXAMPLE FOR EVAL LINEAR WEIGHTED SUM========

Generating evaluation key for homomorphic multiplication...Completed.
terminate called after throwing an instance of 'lbcrypto::not_implemented_error'
  what():  /.../openfhe-development/src/pke/include/schemebase/base-advancedshe.h:113 EvalLinearWSum is not implemented for this scheme.

I would assume that there were some issues in your example as EvalSum keys are not needed for evaluating a linear weighted sum. In other words, OpenFHE appears to behave as expected in this case.

Please feel free to post your example here if you want me to tell what in your example for BGV has triggered this exception you saw.