FAAST  0.2.1
utilities.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 #ifndef UTILITIES_H_
23 #define UTILITIES_H_
24 
25 #include <NTL/ZZ.h>
26 #include <cmath>
27 #include <vector>
28 #include <algorithm>
29 #include "Types.hpp"
30 #include "Exceptions.hpp"
31 
32 namespace FAAST {
58  void factor(long n, vector<pair<long,int> >& factors,
59  const bool trial = true, const int multiplicity = 1);
65  long NumPits(const long p, const long n);
77  template <class T> void expand(typename T::GFpX& res,
78  const typename T::GFpX& P, const long n);
90  template <class T> void contract(typename T::GFpX& res,
91  const typename T::GFpX& P, const long n);
105  template <class T> void compose
106  (typename T::GFpX& res, const typename T::GFpX& Q,
107  const typename T::GFpX& R, const typename T::BigInt& p);
118  template <class T> void cyclotomic
119  (typename T::GFpX& res, const long n, const typename T::BigInt& p);
120 
125 }
126 
127 #endif /*UTILITIES_H_*/