@@ -73,7 +73,7 @@ class ILDCRTParams final : public ElemParams<IntType> {
73
73
using ILNativeParams = ILParamsImpl<NativeInteger>;
74
74
75
75
ILDCRTParams (uint32_t corder, const IntType& modulus, const IntType& rootOfUnity = IntType(0 ))
76
- : ElemParams<IntType>(corder, modulus), m_originalModulus(modulus) {
76
+ : ElemParams<IntType>(corder, modulus) {
77
77
// NOTE params generation uses this constructor to make an empty params that
78
78
// it will later populate during the gen process. For that special case...
79
79
// we don't populate, and we just return
@@ -146,8 +146,8 @@ class ILDCRTParams final : public ElemParams<IntType> {
146
146
147
147
ILDCRTParams (uint32_t corder, const std::vector<NativeInteger>& moduli,
148
148
const std::vector<NativeInteger>& rootsOfUnity, const std::vector<NativeInteger>& moduliBig,
149
- const std::vector<NativeInteger>& rootsOfUnityBig, const IntType& inputOriginalModulus = IntType( 0 ) )
150
- : ElemParams<IntType>(corder, 0 ), m_originalModulus(inputOriginalModulus) {
149
+ const std::vector<NativeInteger>& rootsOfUnityBig)
150
+ : ElemParams<IntType>(corder, 0 ) {
151
151
size_t limbs{moduli.size ()};
152
152
if (limbs != rootsOfUnity.size () || limbs != moduliBig.size () || limbs != rootsOfUnityBig.size ())
153
153
OPENFHE_THROW (" sizes of moduli and roots of unity do not match 2" );
@@ -170,9 +170,7 @@ class ILDCRTParams final : public ElemParams<IntType> {
170
170
* @param corder the order of the ciphertext
171
171
* @param &moduli is the tower of moduli
172
172
*/
173
- ILDCRTParams (uint32_t corder, const std::vector<NativeInteger>& moduli,
174
- const IntType& inputOriginalModulus = IntType(0 ))
175
- : ElemParams<IntType>(corder, 0 ), m_originalModulus(inputOriginalModulus) {
173
+ ILDCRTParams (uint32_t corder, const std::vector<NativeInteger>& moduli) : ElemParams<IntType>(corder, 0 ) {
176
174
size_t limbs{moduli.size ()};
177
175
m_params.reserve (limbs);
178
176
IntType compositeModulus (1 );
@@ -191,19 +189,15 @@ class ILDCRTParams final : public ElemParams<IntType> {
191
189
* @param params the componet parameters.
192
190
* @return
193
191
*/
194
- ILDCRTParams (uint32_t corder, const std::vector<std::shared_ptr<ILNativeParams>>& params,
195
- const IntType& inputOriginalModulus = IntType(0 ))
196
- : ElemParams<IntType>(corder, 0 ), m_params(params), m_originalModulus(inputOriginalModulus) {
192
+ ILDCRTParams (uint32_t corder, const std::vector<std::shared_ptr<ILNativeParams>>& params)
193
+ : ElemParams<IntType>(corder, 0 ), m_params(params) {
197
194
RecalculateModulus ();
198
195
}
199
196
200
- ILDCRTParams (const ILDCRTParams& rhs)
201
- : ElemParams<IntType>(rhs), m_params(rhs.m_params), m_originalModulus(rhs.m_originalModulus) {}
197
+ ILDCRTParams (const ILDCRTParams& rhs) : ElemParams<IntType>(rhs), m_params(rhs.m_params) {}
202
198
203
199
ILDCRTParams (ILDCRTParams&& rhs) noexcept
204
- : ElemParams<IntType>(rhs),
205
- m_params (std::move(rhs.m_params)),
206
- m_originalModulus (std::move(rhs.m_originalModulus)) {}
200
+ : ElemParams<IntType>(std::move(rhs)), m_params(std::move(rhs.m_params)) {}
207
201
208
202
/* *
209
203
* Assignment Operator.
@@ -213,15 +207,13 @@ class ILDCRTParams final : public ElemParams<IntType> {
213
207
*/
214
208
ILDCRTParams& operator =(const ILDCRTParams& rhs) {
215
209
ElemParams<IntType>::operator =(rhs);
216
- m_params = rhs.m_params ;
217
- m_originalModulus = rhs.m_originalModulus ;
210
+ m_params = rhs.m_params ;
218
211
return *this ;
219
212
}
220
213
221
214
ILDCRTParams& operator =(ILDCRTParams&& rhs) noexcept {
222
- ElemParams<IntType>::operator =(rhs);
223
- m_params = std::move (rhs.m_params );
224
- m_originalModulus = std::move (rhs.m_originalModulus );
215
+ ElemParams<IntType>::operator =(std::move (rhs));
216
+ m_params = std::move (rhs.m_params );
225
217
return *this ;
226
218
}
227
219
@@ -242,28 +234,12 @@ class ILDCRTParams final : public ElemParams<IntType> {
242
234
* @return A vector of the component polynomial parameters.
243
235
*/
244
236
std::vector<std::shared_ptr<ILNativeParams>> GetParamPartition (uint32_t start, uint32_t end) const {
245
- if (end < start || end > m_params.size ())
237
+ if (end < start || end >= m_params.size ())
246
238
OPENFHE_THROW (" Incorrect parameters for GetParamPartition - (start: " + std::to_string (start) +
247
239
" , end:" + std::to_string (end) + " )" );
248
240
return std::vector<std::shared_ptr<ILNativeParams>>(m_params.begin () + start, m_params.begin () + end + 1 );
249
241
}
250
242
251
- /* *
252
- * @brief Simple getter method for the original modulus, not the ciphertex
253
- * modulus.
254
- * @return The original modulus, not the big ciphertext modulus.
255
- */
256
- const IntType& GetOriginalModulus () const {
257
- return m_originalModulus;
258
- }
259
- /* *
260
- * @brief Simple setter method for the original modulus, not the ciphertex
261
- * modulus.
262
- * @return void
263
- */
264
- void SetOriginalModulus (const IntType& inputOriginalModulus) {
265
- m_originalModulus = inputOriginalModulus;
266
- }
267
243
/* *
268
244
* @brief Getter method for the component parameters of a specific index.
269
245
* @param i the index of the parameters to return. Note this this call is
@@ -321,7 +297,7 @@ class ILDCRTParams final : public ElemParams<IntType> {
321
297
if (*m_params[i] != *dcrtParams->m_params [i])
322
298
return false ;
323
299
}
324
- return (m_originalModulus == dcrtParams-> GetOriginalModulus ()) ;
300
+ return true ;
325
301
}
326
302
327
303
/* *
@@ -350,7 +326,6 @@ class ILDCRTParams final : public ElemParams<IntType> {
350
326
void save (Archive& ar, std::uint32_t const version) const {
351
327
ar (::cereal::base_class<ElemParams<IntType>>(this ));
352
328
ar (::cereal::make_nvp (" p" , m_params));
353
- ar (::cereal::make_nvp (" m" , m_originalModulus));
354
329
}
355
330
356
331
template <class Archive >
@@ -361,7 +336,6 @@ class ILDCRTParams final : public ElemParams<IntType> {
361
336
}
362
337
ar (::cereal::base_class<ElemParams<IntType>>(this ));
363
338
ar (::cereal::make_nvp (" p" , m_params));
364
- ar (::cereal::make_nvp (" m" , m_originalModulus));
365
339
}
366
340
367
341
std::string SerializedObjectName () const override {
@@ -378,18 +352,11 @@ class ILDCRTParams final : public ElemParams<IntType> {
378
352
out << std::endl << " m_params:" << std::endl;
379
353
for (size_t i = 0 ; i < m_params.size (); ++i)
380
354
out << " " << i << " : " << *m_params[i];
381
- return out << " m_originalModulus: " << m_originalModulus << std::endl;
355
+ return out << std::endl;
382
356
}
383
357
384
358
// array of smaller ILParams
385
359
std::vector<std::shared_ptr<ILNativeParams>> m_params;
386
-
387
- // original modulus when being constructed from a Poly or when
388
- // ctor is passed that parameter
389
- // note orignalModulus will be <= composite modules
390
- // i.e. \Prod_i=0^k-1 m_params[i]->GetModulus()
391
- // note not using ElemParams::ciphertextModulus due to object stripping
392
- IntType m_originalModulus;
393
360
};
394
361
395
362
} // namespace lbcrypto
0 commit comments