@@ -1184,22 +1184,8 @@ class Ctxt
11841184 return true ;
11851185 }
11861186
1187- #if 0
1188- // VJS-NOTE: this is incorrectly defined, so I took it out
1189- // for now. It is currently only used in a nonessential
1190- // way in Test_extractDigits.cpp and GTestExtractDigits.cpp,
1191- // and I commented out those usages.
1192- // For a correct implementation that takes into account
1193- // both the total noise bound and the relation between
1194- // relevant norms, see the code in SecKey::Decrypt.
1195-
11961187 // ! @brief Would this ciphertext be decrypted without errors?
1197- bool isCorrect() const
1198- {
1199- NTL::ZZ q = context.productOfPrimes(primeSet);
1200- return NTL::to_xdouble(q) > noiseBound * 2;
1201- }
1202- #endif
1188+ bool isCorrect () const ;
12031189
12041190 const Context& getContext () const { return context; }
12051191 const PubKey& getPubKey () const { return pubKey; }
@@ -1252,7 +1238,9 @@ class Ctxt
12521238 // plaintext leakage attacks, as in the paper
12531239 // "On the Security of Homomorphic Encryption on Approximate Numbers",
12541240 // by Li and Micciancio.
1255- void addNoiseForCKKSDecryption (const SecKey& sk, double eps);
1241+ void addedNoiseForCKKSDecryption (const SecKey& sk,
1242+ double eps,
1243+ NTL::ZZX& noise) const ;
12561244};
12571245
12581246// set out=prod_{i=0}^{n-1} v[j], takes depth log n and n-1 products
@@ -1298,6 +1286,27 @@ inline Ctxt innerProduct(const std::vector<Ctxt>& v1,
12981286 return ret;
12991287}
13001288
1289+ // ! frobeniusAutomorph: free function version of frobeniusAutomorph method
1290+ inline void frobeniusAutomorph (Ctxt& ctxt, long j)
1291+ {
1292+ ctxt.frobeniusAutomorph (j);
1293+ }
1294+
1295+ // ! conjugate: free function that is equivalent to frobeniusAutomorph(ctxt, 1)
1296+ inline void conjugate (Ctxt& ctxt) { frobeniusAutomorph (ctxt, 1 ); }
1297+
1298+ // ! Free functions to extract real and imaginary parts.
1299+ // ! Unlike the corresponding Ctxt method, extractImPart is thread safe.
1300+ // ! NOTES: (1) these will raise an error for BGV ciphertexts.
1301+ void extractRealPart (Ctxt& c);
1302+ void extractImPart (Ctxt& c);
1303+
1304+ // ! power: free function version of power method
1305+ inline void power (Ctxt& ctxt, long e) { ctxt.power (e); }
1306+
1307+ // ! negate: free function version of negate method
1308+ inline void negate (Ctxt& ctxt) { ctxt.negate (); }
1309+
13011310// ! print to cerr some info about ciphertext
13021311void CheckCtxt (const Ctxt& c, const char * label);
13031312
0 commit comments