From 1bd3caa29a59993e98ee23f17bcbfa2c6edb26af Mon Sep 17 00:00:00 2001 From: Andreea Alexandru Date: Thu, 16 May 2024 13:00:39 -0400 Subject: [PATCH 1/2] fixed issue for n=6 --- src/pke/lib/scheme/ckksrns/ckksrns-advancedshe.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pke/lib/scheme/ckksrns/ckksrns-advancedshe.cpp b/src/pke/lib/scheme/ckksrns/ckksrns-advancedshe.cpp index 117f84e38..380bc56df 100644 --- a/src/pke/lib/scheme/ckksrns/ckksrns-advancedshe.cpp +++ b/src/pke/lib/scheme/ckksrns/ckksrns-advancedshe.cpp @@ -906,7 +906,7 @@ Ciphertext AdvancedSHECKKSRNS::EvalChebyshevSeriesPS(ConstCiphertext sum = T[k - 1]; + Ciphertext sum = T[k - 1]->Clone(); for (uint32_t i = 0; i < log2(divqr->q.back()); i++) { sum = cc->EvalAdd(sum, sum); } cc->EvalAddInPlace(qu, sum); } else { - Ciphertext sum = T[k - 1]; + Ciphertext sum = T[k - 1]->Clone(); for (uint32_t i = 0; i < log2(divqr->q.back()); i++) { sum = cc->EvalAdd(sum, sum); } @@ -864,7 +864,7 @@ Ciphertext AdvancedSHECKKSRNS::InnerEvalChebyshevPS(ConstCiphertextEvalAddInPlace(su, T[k - 1]); } else { - su = T[k - 1]; + su = T[k - 1]->Clone(); } // adds the free term (at x^0) @@ -981,7 +981,8 @@ Ciphertext AdvancedSHECKKSRNS::EvalChebyshevSeriesPS(ConstCiphertext> T2(m); - // Compute the Chebyshev polynomials T_{2k}(y), T_{4k}(y), ... , T_{2^{m-1}k}(y) + // Compute the Chebyshev polynomials T_k(y), T_{2k}(y), T_{4k}(y), ... , T_{2^{m-1}k}(y) + // T2[0] is used as a placeholder T2.front() = T.back(); for (uint32_t i = 1; i < m; i++) { auto square = cc->EvalSquare(T2[i - 1]); @@ -1046,7 +1047,7 @@ Ciphertext AdvancedSHECKKSRNS::EvalChebyshevSeriesPS(ConstCiphertextModReduceInPlace(cu); } else { - cu = T.front(); + cu = T.front()->Clone(); } } else {