@@ -28,10 +28,6 @@ void AltCRT::verify()
2828 assert (map.getIndexSet () <= (context.specialPrimes | context.ctxtPrimes ));
2929}
3030
31-
32-
33-
34-
3531// Arithmetic operations. Only the "destructive" versions are used,
3632// i.e., a += b is implemented but not a + b.
3733
@@ -83,10 +79,6 @@ template
8379AltCRT& AltCRT::Op<AltCRT::SubFun>(const AltCRT &other, SubFun fun,
8480 bool matchIndexSets);
8581
86-
87-
88-
89-
9082template <class Fun >
9183AltCRT& AltCRT::Op (const ZZ &num, Fun fun)
9284{
@@ -115,8 +107,6 @@ AltCRT& AltCRT::Op<AltCRT::AddFun>(const ZZ &num, AddFun fun);
115107template
116108AltCRT& AltCRT::Op<AltCRT::SubFun>(const ZZ &num, SubFun fun);
117109
118-
119-
120110AltCRT& AltCRT::Negate (const AltCRT& other)
121111{
122112 if (dryRun) return *this ;
@@ -139,8 +129,6 @@ AltCRT& AltCRT::Negate(const AltCRT& other)
139129 return *this ;
140130}
141131
142-
143-
144132// The following is identical to definition in DoubleCRT
145133
146134template <class Fun >
@@ -154,7 +142,6 @@ AltCRT& AltCRT::Op(const ZZX &poly, Fun fun)
154142 return Op (other, fun);
155143}
156144
157-
158145template
159146AltCRT& AltCRT::Op<AltCRT::MulFun>(const ZZX &poly, MulFun fun);
160147
@@ -164,9 +151,6 @@ AltCRT& AltCRT::Op<AltCRT::AddFun>(const ZZX &poly, AddFun fun);
164151template
165152AltCRT& AltCRT::Op<AltCRT::SubFun>(const ZZX &poly, SubFun fun);
166153
167-
168-
169-
170154// The following is identical to definition in DoubleCRT
171155
172156// break *this into n digits,according to the primeSets in context.digits
@@ -217,9 +201,6 @@ void AltCRT::breakIntoDigits(vector<AltCRT>& digits, long n) const
217201 FHE_TIMER_STOP;
218202}
219203
220-
221-
222-
223204// expand index set by s1.
224205// it is assumed that s1 is disjoint from the current index set.
225206void AltCRT::addPrimes (const IndexSet& s1)
@@ -233,7 +214,6 @@ void AltCRT::addPrimes(const IndexSet& s1)
233214 map.insert (s1); // add new rows to the map
234215 if (dryRun) return ;
235216
236-
237217 zz_pBak bak; bak.save ();
238218
239219 // fill in new rows
@@ -243,11 +223,6 @@ void AltCRT::addPrimes(const IndexSet& s1)
243223 }
244224}
245225
246-
247-
248-
249-
250-
251226// Expand index set by s1, and multiply by \prod{q \in s1}. s1 is assumed to
252227// be disjoint from the current index set. Returns the logarithm of product.
253228double AltCRT::addPrimesAndScale (const IndexSet& s1)
@@ -264,7 +239,6 @@ double AltCRT::addPrimesAndScale(const IndexSet& s1)
264239 logFactor += log ((double )qi);
265240 }
266241
267-
268242 zz_pBak bak; bak.save ();
269243
270244 // scale existing rows
@@ -286,10 +260,6 @@ double AltCRT::addPrimesAndScale(const IndexSet& s1)
286260 return logFactor;
287261}
288262
289-
290-
291-
292-
293263AltCRT::AltCRT (const ZZX& poly, const FHEcontext &_context, const IndexSet& s)
294264: context(_context), map(new AltCRTHelper(_context))
295265{
@@ -306,10 +276,6 @@ AltCRT::AltCRT(const ZZX& poly, const FHEcontext &_context, const IndexSet& s)
306276 }
307277}
308278
309-
310-
311-
312-
313279AltCRT::AltCRT (const ZZX& poly, const FHEcontext &_context)
314280: context(_context), map(new AltCRTHelper(_context))
315281{
@@ -318,7 +284,6 @@ AltCRT::AltCRT(const ZZX& poly, const FHEcontext &_context)
318284 map.insert (s);
319285 if (dryRun) return ;
320286
321-
322287 zz_pBak bak; bak.save ();
323288
324289 for (long i = s.first (); i <= s.last (); i = s.next (i)) {
@@ -327,10 +292,6 @@ AltCRT::AltCRT(const ZZX& poly, const FHEcontext &_context)
327292 }
328293}
329294
330-
331-
332-
333-
334295AltCRT::AltCRT (const ZZX& poly)
335296: context(*activeContext), map(new AltCRTHelper(*activeContext))
336297{
@@ -347,10 +308,6 @@ AltCRT::AltCRT(const ZZX& poly)
347308 }
348309}
349310
350-
351-
352-
353-
354311AltCRT::AltCRT (const FHEcontext &_context, const IndexSet& s)
355312: context(_context), map(new AltCRTHelper(_context))
356313{
@@ -367,10 +324,6 @@ AltCRT::AltCRT(const FHEcontext &_context, const IndexSet& s)
367324 }
368325}
369326
370-
371-
372-
373-
374327AltCRT::AltCRT (const FHEcontext &_context)
375328: context(_context), map(new AltCRTHelper(_context))
376329{
@@ -387,9 +340,6 @@ AltCRT::AltCRT(const FHEcontext &_context)
387340 }
388341}
389342
390-
391-
392-
393343AltCRT& AltCRT::operator =(const AltCRT& other)
394344// optimized for the case of matching index sets
395345{
@@ -413,9 +363,6 @@ AltCRT& AltCRT::operator=(const AltCRT& other)
413363 return *this ;
414364}
415365
416-
417-
418-
419366AltCRT& AltCRT::operator =(const ZZX&poly)
420367{
421368 if (dryRun) return *this ;
@@ -431,10 +378,6 @@ AltCRT& AltCRT::operator=(const ZZX&poly)
431378 return *this ;
432379}
433380
434-
435-
436-
437-
438381AltCRT& AltCRT::operator =(const ZZ& num)
439382{
440383 if (dryRun) return *this ;
@@ -451,7 +394,6 @@ AltCRT& AltCRT::operator=(const ZZ& num)
451394}
452395
453396
454-
455397// DIRT: I am not sure if this function behaves the same
456398// as in DoubleCRT if the prime 2 is allowed: the endpoints
457399// of the interval [-P/2,P/2] may be handled differently.
@@ -474,7 +416,6 @@ void AltCRT::toPoly(ZZX& poly, const IndexSet& s,
474416 ZZ prod;
475417 prod = 1 ;
476418
477-
478419 zz_pBak bak; bak.save ();
479420
480421 for (long i = s1.first (); i <= s1.last (); i = s1.next (i)) {
@@ -492,21 +433,13 @@ void AltCRT::toPoly(ZZX& poly, const IndexSet& s,
492433 }
493434}
494435
495-
496-
497-
498-
499436// The following is identical to definition in DoubleCRT
500-
501437void AltCRT::toPoly (ZZX& p, bool positive) const
502438{
503439 const IndexSet& s = map.getIndexSet ();
504440 toPoly (p, s, positive);
505441}
506442
507-
508-
509-
510443// Division by constant
511444AltCRT& AltCRT::operator /=(const ZZ &num)
512445{
@@ -524,9 +457,6 @@ AltCRT& AltCRT::operator/=(const ZZ &num)
524457 return *this ;
525458}
526459
527-
528-
529-
530460// Small-exponent polynomial exponentiation
531461void AltCRT::Exp (long e)
532462{
@@ -542,9 +472,6 @@ void AltCRT::Exp(long e)
542472 }
543473}
544474
545-
546-
547-
548475// Apply the automorphism F(X) --> F(X^k) (with gcd(k,m)=1)
549476void AltCRT::automorph (long k)
550477{
@@ -580,13 +507,6 @@ void AltCRT::automorph(long k)
580507 }
581508}
582509
583-
584-
585-
586-
587-
588-
589-
590510// FIXME: there is a potential incompatibilty here
591511// with DoubleCRT -- starting from the same seed,
592512// we will get different polynomials. This may lead
@@ -611,36 +531,24 @@ void AltCRT::randomize(const ZZ* seed)
611531 }
612532}
613533
614-
615-
616-
617534AltCRT& AltCRT::operator =(const SingleCRT& scrt)
618535{
619536 assert (0 ); // not implemented
620537}
621538
622-
623539void AltCRT::toSingleCRT (SingleCRT& scrt, const IndexSet& s) const
624540{
625541 assert (0 ); // not implemented
626542}
627543
628-
629-
630544// The following is identical to definition in DoubleCRT
631-
632545void AltCRT::toSingleCRT (SingleCRT& scrt) const
633546{
634547 const IndexSet& s = map.getIndexSet ();
635548 toSingleCRT (scrt, s);
636549}
637550
638-
639-
640-
641551// The following is identical to definition in DoubleCRT
642-
643-
644552void AltCRT::scaleDownToSet (const IndexSet& s, long ptxtSpace)
645553{
646554 assert (ptxtSpace >= 2 );
@@ -691,13 +599,6 @@ void AltCRT::scaleDownToSet(const IndexSet& s, long ptxtSpace)
691599 *this /= diffProd; // *this is divisible by diffProd, so this operation actually scales it down
692600}
693601
694-
695-
696-
697-
698-
699-
700-
701602ostream& operator << (ostream &str, const AltCRT &d)
702603{
703604 assert (0 ); // not implemented
@@ -708,5 +609,3 @@ istream& operator>> (istream &str, AltCRT &d)
708609 assert (0 ); // not implemented
709610}
710611
711-
712-
0 commit comments