FAAST  0.2.1
Tmul.hpp
1 /*
2  This file is part of the FAAST library.
3 
4  Copyright (c) 2009 Luca De Feo and Éric Schost.
5 
6  The most recent version of FAAST is available at http://www.lix.polytechnique.fr/~defeo/FAAST
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License
10  as published by the Free Software Foundation; either version 2
11  of the License, or (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; see file COPYING. If not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22 
23 /* Courtesy of E. Schost */
24 
25 #include <NTL/GF2X.h>
26 #include <NTL/lzz_pX.h>
27 #include <NTL/ZZ_pX.h>
28 
29 namespace NTL_NAMESPACE {
35  void TransMulMod(GF2X& x, const GF2X& a, const GF2XTransMultiplier& B, const GF2XModulus& F);
36 
41  inline void TransMulMod(ZZ_pX& x, const ZZ_pX& a,
42  const ZZ_pXMultiplier& B, const ZZ_pXModulus& F){
43  x = 0;
44  vec_ZZ_p X;
45  UpdateMap(X, a.rep, B, F);
46  for (long i = 0; i < X.length(); i++)
47  SetCoeff(x,i,X[i]);
48  x.normalize();
49  }
50 
56  inline void TransMulMod(zz_pX& x, const zz_pX& a,
57  const zz_pXMultiplier& B, const zz_pXModulus& F){
58  x = 0;
59  vec_zz_p X;
60  UpdateMap(X, a.rep, B, F);
61  for (long i = 0; i < X.length(); i++)
62  SetCoeff(x,i,X[i]);
63  x.normalize();
64  }
65 }