@@ -1175,10 +1175,14 @@ class CryptoContextImpl : public Serializable {
11751175 */
11761176 Plaintext MakeCoefPackedPlaintext (const std::vector<int64_t >& value, size_t noiseScaleDeg = 1 ,
11771177 uint32_t level = 0 ) const {
1178+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::MakeCoefPackedPlaintext(std::vector<int64_t>,size_t,uint32_t)" ));
1179+ IF_TRACE (t->registerInput (value, " value" ));
1180+ IF_TRACE (t->registerInput (noiseScaleDeg, " noiseScaleDeg" ));
1181+ IF_TRACE (t->registerInput (level, " level" ));
11781182 if (!value.size ())
11791183 OPENFHE_THROW (" Cannot encode an empty value vector" );
11801184
1181- return MakePlaintext (COEF_PACKED_ENCODING, value, noiseScaleDeg, level);
1185+ return REGISTER_IF_TRACE ( MakePlaintext (COEF_PACKED_ENCODING, value, noiseScaleDeg, level) );
11821186 }
11831187
11841188 /* *
@@ -1191,10 +1195,14 @@ class CryptoContextImpl : public Serializable {
11911195 */
11921196 Plaintext MakePackedPlaintext (const std::vector<int64_t >& value, size_t noiseScaleDeg = 1 ,
11931197 uint32_t level = 0 ) const {
1198+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::MakePackedPlaintext(std::vector<int64_t>,size_t,uint32_t)" ));
1199+ IF_TRACE (t->registerInput (value, " value" ));
1200+ IF_TRACE (t->registerInput (noiseScaleDeg, " noiseScaleDeg" ));
1201+ IF_TRACE (t->registerInput (level, " level" ));
11941202 if (!value.size ())
11951203 OPENFHE_THROW (" Cannot encode an empty value vector" );
11961204
1197- return MakePlaintext (PACKED_ENCODING, value, noiseScaleDeg, level);
1205+ return REGISTER_IF_TRACE ( MakePlaintext (PACKED_ENCODING, value, noiseScaleDeg, level) );
11981206 }
11991207
12001208 /* *
@@ -1210,11 +1218,16 @@ class CryptoContextImpl : public Serializable {
12101218 Plaintext MakeCKKSPackedPlaintext (const std::vector<std::complex <double >>& value, size_t noiseScaleDeg = 1 ,
12111219 uint32_t level = 0 , const std::shared_ptr<ParmType> params = nullptr ,
12121220 uint32_t slots = 0 ) const {
1221+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::MakeCKKSPackedPlaintext(std::vector<std::complex<double>>,size_t,uint32_t,ParmType,uint32_t)" ));
1222+ IF_TRACE (t->registerInput (value, " value" ));
1223+ IF_TRACE (t->registerInput (noiseScaleDeg, " noiseScaleDeg" ));
1224+ IF_TRACE (t->registerInput (level, " level" ));
1225+ IF_TRACE (t->registerInput (slots, " slots" ));
12131226 VerifyCKKSScheme (__func__);
12141227 if (!value.size ())
12151228 OPENFHE_THROW (" Cannot encode an empty value vector" );
12161229
1217- return MakeCKKSPackedPlaintextInternal (value, noiseScaleDeg, level, params, slots);
1230+ return REGISTER_IF_TRACE ( MakeCKKSPackedPlaintextInternal (value, noiseScaleDeg, level, params, slots) );
12181231 }
12191232
12201233 /* *
@@ -1229,6 +1242,11 @@ class CryptoContextImpl : public Serializable {
12291242 */
12301243 Plaintext MakeCKKSPackedPlaintext (const std::vector<double >& value, size_t noiseScaleDeg = 1 , uint32_t level = 0 ,
12311244 const std::shared_ptr<ParmType> params = nullptr , uint32_t slots = 0 ) const {
1245+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::MakeCKKSPackedPlaintext(std::vector<double>,size_t,uint32_t,ParmType,uint32_t)" ));
1246+ IF_TRACE (t->registerInput (value, " value" ));
1247+ IF_TRACE (t->registerInput (noiseScaleDeg, " noiseScaleDeg" ));
1248+ IF_TRACE (t->registerInput (level, " level" ));
1249+ IF_TRACE (t->registerInput (slots, " slots" ));
12321250 VerifyCKKSScheme (__func__);
12331251 if (!value.size ())
12341252 OPENFHE_THROW (" Cannot encode an empty value vector" );
@@ -1237,7 +1255,7 @@ class CryptoContextImpl : public Serializable {
12371255 std::transform (value.begin (), value.end (), complexValue.begin (),
12381256 [](double da) { return std::complex <double >(da); });
12391257
1240- return MakeCKKSPackedPlaintextInternal (complexValue, noiseScaleDeg, level, params, slots);
1258+ return REGISTER_IF_TRACE ( MakeCKKSPackedPlaintextInternal (complexValue, noiseScaleDeg, level, params, slots) );
12411259 }
12421260
12431261 /* *
@@ -1315,7 +1333,10 @@ class CryptoContextImpl : public Serializable {
13151333 * @return Encrypted ciphertext (or null on failure).
13161334 */
13171335 Ciphertext<Element> Encrypt (const PublicKey<Element>& publicKey, ConstPlaintext& plaintext) const {
1318- return Encrypt (plaintext, publicKey);
1336+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::Encrypt(PublicKey,Plaintext)" ));
1337+ IF_TRACE (t->registerInput (publicKey));
1338+ IF_TRACE (t->registerInput (plaintext));
1339+ return REGISTER_IF_TRACE (Encrypt (plaintext, publicKey));
13191340 }
13201341
13211342 /* *
@@ -1356,7 +1377,10 @@ class CryptoContextImpl : public Serializable {
13561377 * @return Encrypted ciphertext (or null on failure).
13571378 */
13581379 Ciphertext<Element> Encrypt (const PrivateKey<Element>& privateKey, ConstPlaintext& plaintext) const {
1359- return Encrypt (plaintext, privateKey);
1380+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::Encrypt(PrivateKey,Plaintext)" ));
1381+ IF_TRACE (t->registerInput (privateKey));
1382+ IF_TRACE (t->registerInput (plaintext));
1383+ return REGISTER_IF_TRACE (Encrypt (plaintext, privateKey));
13601384 }
13611385
13621386 /* *
@@ -1380,6 +1404,9 @@ class CryptoContextImpl : public Serializable {
13801404 */
13811405 inline DecryptResult Decrypt (const PrivateKey<Element>& privateKey, ConstCiphertext<Element>& ciphertext,
13821406 Plaintext* plaintext) {
1407+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::Decrypt(PrivateKey,Ciphertext,Plaintext*)" ));
1408+ IF_TRACE (t->registerInput (privateKey));
1409+ IF_TRACE (t->registerInput (ciphertext));
13831410 return Decrypt (ciphertext, privateKey, plaintext);
13841411 }
13851412
@@ -1543,7 +1570,10 @@ class CryptoContextImpl : public Serializable {
15431570 * @return Resulting ciphertext.
15441571 */
15451572 inline Ciphertext<Element> EvalAdd (Plaintext& plaintext, ConstCiphertext<Element>& ciphertext) const {
1546- return EvalAdd (ciphertext, plaintext);
1573+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalAdd(Plaintext,Ciphertext)" ));
1574+ IF_TRACE (t->registerInput (plaintext));
1575+ IF_TRACE (t->registerInput (ciphertext));
1576+ return REGISTER_IF_TRACE (EvalAdd (ciphertext, plaintext));
15471577 }
15481578
15491579 /* *
@@ -1568,7 +1598,11 @@ class CryptoContextImpl : public Serializable {
15681598 * @param ciphertext Ciphertext to modify.
15691599 */
15701600 void EvalAddInPlace (Plaintext& plaintext, Ciphertext<Element>& ciphertext) const {
1601+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalAddInPlace(Plaintext,Ciphertext)" ));
1602+ IF_TRACE (t->registerInput (plaintext));
1603+ IF_TRACE (t->registerInput (ciphertext));
15711604 EvalAddInPlace (ciphertext, plaintext);
1605+ IF_TRACE (t->registerOutput (ciphertext));
15721606 }
15731607
15741608 /* *
@@ -1594,7 +1628,10 @@ class CryptoContextImpl : public Serializable {
15941628 * @return Resulting ciphertext.
15951629 */
15961630 Ciphertext<Element> EvalAddMutable (Plaintext& plaintext, Ciphertext<Element>& ciphertext) const {
1597- return EvalAddMutable (ciphertext, plaintext);
1631+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalAddMutable(Plaintext,Ciphertext)" ));
1632+ IF_TRACE (t->registerInput (plaintext));
1633+ IF_TRACE (t->registerInput (ciphertext));
1634+ return REGISTER_IF_TRACE (EvalAddMutable (ciphertext, plaintext));
15981635 }
15991636
16001637 // TODO (dsuponit): commented the code below to avoid compiler errors
@@ -1645,7 +1682,10 @@ class CryptoContextImpl : public Serializable {
16451682 * @return Resulting ciphertext.
16461683 */
16471684 Ciphertext<Element> EvalAdd (double scalar, ConstCiphertext<Element>& ciphertext) const {
1648- return EvalAdd (ciphertext, scalar);
1685+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalAdd(double,Ciphertext)" ));
1686+ IF_TRACE (t->registerInput (scalar));
1687+ IF_TRACE (t->registerInput (ciphertext));
1688+ return REGISTER_IF_TRACE (EvalAdd (ciphertext, scalar));
16491689 }
16501690
16511691 /* *
@@ -1678,7 +1718,11 @@ class CryptoContextImpl : public Serializable {
16781718 * @param ciphertext Ciphertext to modify.
16791719 */
16801720 void EvalAddInPlace (double scalar, Ciphertext<Element>& ciphertext) const {
1721+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalAddInPlace(double,Ciphertext)" ));
1722+ IF_TRACE (t->registerInput (scalar));
1723+ IF_TRACE (t->registerInput (ciphertext));
16811724 EvalAddInPlace (ciphertext, scalar);
1725+ IF_TRACE (t->registerOutput (ciphertext));
16821726 }
16831727
16841728 /* *
@@ -1703,7 +1747,11 @@ class CryptoContextImpl : public Serializable {
17031747 * @return Resulting ciphertext.
17041748 */
17051749 Ciphertext<Element> EvalAdd (std::complex <double > scalar, ConstCiphertext<Element>& ciphertext) const {
1706- return EvalAdd (ciphertext, scalar);
1750+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalAdd(std::complex<double>,Ciphertext)" ));
1751+ IF_TRACE (t->registerInput (static_cast <double >(scalar.real ()), " real" ));
1752+ IF_TRACE (t->registerInput (static_cast <double >(scalar.imag ()), " imag" ));
1753+ IF_TRACE (t->registerInput (ciphertext));
1754+ return REGISTER_IF_TRACE (EvalAdd (ciphertext, scalar));
17071755 }
17081756
17091757 /* *
@@ -1729,7 +1777,12 @@ class CryptoContextImpl : public Serializable {
17291777 * @param ciphertext Ciphertext to modify.
17301778 */
17311779 void EvalAddInPlace (std::complex <double > scalar, Ciphertext<Element>& ciphertext) const {
1780+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalAddInPlace(std::complex<double>,Ciphertext)" ));
1781+ IF_TRACE (t->registerInput (static_cast <double >(scalar.real ()), " real" ));
1782+ IF_TRACE (t->registerInput (static_cast <double >(scalar.imag ()), " imag" ));
1783+ IF_TRACE (t->registerInput (ciphertext));
17321784 EvalAddInPlace (ciphertext, scalar);
1785+ IF_TRACE (t->registerOutput (ciphertext));
17331786 }
17341787
17351788 // ------------------------------------------------------------------------------
@@ -1954,8 +2007,11 @@ class CryptoContextImpl : public Serializable {
19542007 * @param ciphertext Ciphertext to modify.
19552008 */
19562009 void EvalSubInPlace (std::complex <double > scalar, Ciphertext<Element>& ciphertext) const {
2010+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalSubInPlace(complex<double>,Ciphertext)" , {ciphertext}));
2011+ IF_TRACE (t->registerInput (scalar, " scalar" ));
19572012 EvalNegateInPlace (ciphertext);
19582013 EvalAddInPlace (ciphertext, scalar);
2014+ IF_TRACE (t->registerOutput (ciphertext));
19592015 }
19602016
19612017 // TODO (dsuponit): commented the code below to avoid compiler errors
@@ -2207,7 +2263,9 @@ class CryptoContextImpl : public Serializable {
22072263 * @return Resulting ciphertext.
22082264 */
22092265 Ciphertext<Element> EvalMult (ConstPlaintext& plaintext, ConstCiphertext<Element>& ciphertext) const {
2210- return EvalMult (ciphertext, plaintext);
2266+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalMult(Plaintext,Ciphertext)" , {ciphertext}));
2267+ IF_TRACE (t->registerInput (plaintext));
2268+ return REGISTER_IF_TRACE (EvalMult (ciphertext, plaintext));
22112269 }
22122270
22132271 /* *
@@ -2232,7 +2290,9 @@ class CryptoContextImpl : public Serializable {
22322290 * @return Resulting ciphertext.
22332291 */
22342292 Ciphertext<Element> EvalMultMutable (Plaintext& plaintext, Ciphertext<Element>& ciphertext) const {
2235- return EvalMultMutable (ciphertext, plaintext);
2293+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalMultMutable(Plaintext,Ciphertext)" , {ciphertext}));
2294+ IF_TRACE (t->registerInput (plaintext));
2295+ return REGISTER_IF_TRACE (EvalMultMutable (ciphertext, plaintext));
22362296 }
22372297
22382298 // TODO (dsuponit): commented the code below to avoid compiler errors
@@ -2286,7 +2346,9 @@ class CryptoContextImpl : public Serializable {
22862346 * @return Resulting ciphertext.
22872347 */
22882348 inline Ciphertext<Element> EvalMult (double scalar, ConstCiphertext<Element>& ciphertext) const {
2289- return EvalMult (ciphertext, scalar);
2349+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalMult(double,Ciphertext)" , {ciphertext}));
2350+ IF_TRACE (t->registerInput (scalar, " scalar" ));
2351+ return REGISTER_IF_TRACE (EvalMult (ciphertext, scalar));
22902352 }
22912353
22922354 /* *
@@ -2311,7 +2373,10 @@ class CryptoContextImpl : public Serializable {
23112373 * @param ciphertext Ciphertext to modify (multiplicand).
23122374 */
23132375 inline void EvalMultInPlace (double scalar, Ciphertext<Element>& ciphertext) const {
2376+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalMultInPlace(double,Ciphertext)" , {ciphertext}));
2377+ IF_TRACE (t->registerInput (scalar, " scalar" ));
23142378 EvalMultInPlace (ciphertext, scalar);
2379+ IF_TRACE (t->registerOutput (ciphertext));
23152380 }
23162381
23172382 /* *
@@ -2338,7 +2403,9 @@ class CryptoContextImpl : public Serializable {
23382403 * @return Resulting ciphertext.
23392404 */
23402405 inline Ciphertext<Element> EvalMult (std::complex <double > scalar, ConstCiphertext<Element>& ciphertext) const {
2341- return EvalMult (ciphertext, scalar);
2406+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalMult(complex<double>,Ciphertext)" , {ciphertext}));
2407+ IF_TRACE (t->registerInput (scalar, " scalar" ));
2408+ return REGISTER_IF_TRACE (EvalMult (ciphertext, scalar));
23422409 }
23432410
23442411 /* *
@@ -2363,7 +2430,10 @@ class CryptoContextImpl : public Serializable {
23632430 * @param ciphertext Ciphertext to modify (multiplicand).
23642431 */
23652432 inline void EvalMultInPlace (std::complex <double > scalar, Ciphertext<Element>& ciphertext) const {
2433+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalMultInPlace(complex<double>,Ciphertext)" , {ciphertext}));
2434+ IF_TRACE (t->registerInput (scalar, " scalar" ));
23662435 EvalMultInPlace (ciphertext, scalar);
2436+ IF_TRACE (t->registerOutput (ciphertext));
23672437 }
23682438
23692439 // ------------------------------------------------------------------------------
@@ -2624,6 +2694,10 @@ class CryptoContextImpl : public Serializable {
26242694 */
26252695 void EvalRotateKeyGen (const PrivateKey<Element> privateKey, const std::vector<int32_t >& indexList,
26262696 const PublicKey<Element> publicKey = nullptr ) {
2697+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalRotateKeyGen(PrivateKey,vector<int32_t>,PublicKey)" ));
2698+ IF_TRACE (t->registerInput (privateKey));
2699+ IF_TRACE (t->registerInput (indexList, " indexList" ));
2700+ if (publicKey) IF_TRACE (t->registerInput (publicKey));
26272701 EvalAtIndexKeyGen (privateKey, indexList, publicKey);
26282702 };
26292703
@@ -2862,7 +2936,10 @@ class CryptoContextImpl : public Serializable {
28622936 */
28632937 Ciphertext<Element> EvalLinearWSum (const std::vector<double >& constantsVec,
28642938 std::vector<ReadOnlyCiphertext<Element>>& ciphertextVec) const {
2865- return EvalLinearWSum (ciphertextVec, constantsVec);
2939+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalLinearWSum(vector<double>,vector<ReadOnlyCiphertext>)" ));
2940+ IF_TRACE (t->registerInput (constantsVec, " constantsVec" ));
2941+ IF_TRACE (for (const auto & ct : ciphertextVec) t->registerInput (ct, " ciphertext" ));
2942+ return REGISTER_IF_TRACE (EvalLinearWSum (ciphertextVec, constantsVec));
28662943 }
28672944
28682945 /* *
@@ -2889,7 +2966,10 @@ class CryptoContextImpl : public Serializable {
28892966 */
28902967 Ciphertext<Element> EvalLinearWSumMutable (const std::vector<double >& constantsVec,
28912968 std::vector<Ciphertext<Element>>& ciphertextVec) const {
2892- return EvalLinearWSumMutable (ciphertextVec, constantsVec);
2969+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::EvalLinearWSumMutable(vector<double>,vector<Ciphertext>)" ));
2970+ IF_TRACE (t->registerInput (constantsVec, " constantsVec" ));
2971+ IF_TRACE (for (const auto & ct : ciphertextVec) t->registerInput (ct, " ciphertext" ));
2972+ return REGISTER_IF_TRACE (EvalLinearWSumMutable (ciphertextVec, constantsVec));
28932973 }
28942974
28952975 // ------------------------------------------------------------------------------
@@ -3944,6 +4024,7 @@ class CryptoContextImpl : public Serializable {
39444024 * @param params Scheme switching parameter object to populate.
39454025 */
39464026 void SetParamsFromCKKSCryptocontext (SchSwchParams& params) {
4027+ IF_TRACE (auto t = m_tracer->StartFunctionTrace (" CryptoContext::SetParamsFromCKKSCryptocontext(SchSwchParams)" ));
39474028 const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersCKKSRNS>(GetCryptoParameters ());
39484029 if (!cryptoParams)
39494030 OPENFHE_THROW (" std::dynamic_pointer_cast<CryptoParametersCKKSRNS>() failed" );
0 commit comments