template<class type> void EncryptedArrayDerived<type>::buildLinPolyCoeffs(vector<RX>& C, const vector<RX>& L) const { FHE_TIMER_START; RBak bak; bak.save(); restoreContext(); // the NTL context for mod p^r REBak ebak; ebak.save(); restoreContextForG(); // The NTL context for mod G do { typename Lazy< Mat<RE> >::Builder builder(linPolyMatrix); if (!builder()) break; long p = tab.getZMStar().getP(); long r = tab.getR(); Mat<RE> M1; // build d x d matrix, d is taken from the surrent NTL context for G buildLinPolyMatrix(M1, p); Mat<RE> M2; ppInvert(M2, M1, p, r); // invert modulo prime-power p^r UniquePtr< Mat<RE> > ptr; ptr.make(M2); builder.move(ptr); } while (0); Vec<RE> CC, LL; convert(LL, L); mul(CC, LL, *linPolyMatrix); convert(C, CC); }
void buildLinPolyCoeffs(vec_zz_pE& C_out, const vec_zz_pE& L, long p, long r) { FHE_TIMER_START; mat_zz_pE M; buildLinPolyMatrix(M, p); vec_zz_pE C; ppsolve(C, M, L, p, r); C_out = C; FHE_TIMER_STOP; }
void buildLinPolyCoeffs(vec_GF2E& C_out, const vec_GF2E& L, long p, long r) { FHE_TIMER_START; assert(p == 2 && r == 1); mat_GF2E M; buildLinPolyMatrix(M, p); vec_GF2E C; ppsolve(C, M, L, p, r); C_out = C; FHE_TIMER_STOP; }