25 #include "Exceptions.hpp"
26 #include "FieldElement.hpp"
27 #include "FieldPolynomial.hpp"
41 typedef struct TIMINGS {
64 TIMINGS() : CYCLOTOMIC(0),
143 typedef typename T::GFp GFp;
144 typedef typename T::MatGFp MatGFp;
145 typedef typename T::VecGFp VecGFp;
146 typedef typename T::GFpX GFpX;
147 typedef typename T::GFpE GFpE;
148 typedef typename T::GFpEX GFpEX;
149 typedef typename T::BigInt BigInt;
150 typedef typename T::Context Context;
151 typedef typename T::GFpXModulus GFpXModulus;
166 const auto_ptr<const FieldElement<T> > primitive;
168 mutable vector<FieldElement<T> > pseudotraces;
170 mutable auto_ptr<const FieldElement<T> > liftuphelper;
174 mutable MatGFp artin;
178 mutable long artinLine;
182 const bool twopminusone;
184 mutable auto_ptr<const Context> Phi;
200 const auto_ptr<const FieldElement<T> > gen;
205 const auto_ptr<const FieldElement<T> > alpha;
285 throw (NotPrimeException, NotIrreducibleException);
310 (const BigInt&
p, const
long d = 1, const
bool test = true)
356 const throw (CharacteristicTooLargeException, NotIrreducibleException,
449 {
return *stem->primitive >> *
this; }
563 if (!stem->subfield)
throw NoSubFieldException();
564 return *(stem->subfield);
582 if (!stem->overfield)
throw NoOverFieldException();
583 return *(stem->overfield);
692 bool operator==(const
Field<T>& F) const throw () {
return this==&F; }
721 {
return stem->subfield == NULL; }
724 {
return !stem->overfield || stem->overfield->height == 1; }
729 ostream&
print(ostream& o)
const;
733 {
throw FAASTException(
"Destroying fields is no good."); }
745 const FieldElement<T>& getPseudotrace(
const long i)
const;
746 const FieldElement<T>& getLiftup()
const;
747 const MatGFp& getArtinMatrix()
const;
748 const Context& getCyclotomic()
const;
752 void operator=(
const Field<T>&);
753 Field(
const Field<T>&);
763 void couveignes00(FieldElement<T>& res,
const FieldElement<T>& alpha)
const;
770 const Field<T>* over,
772 const FieldElement<T>* pri,
773 const vector<FieldElement<T> >& pseudo,
774 const FieldElement<T>* liftup,
778 const bool twopminuso,
781 const Field<T>* vsub,
782 const FieldElement<T>* g,
783 const FieldElement<T>* a,
788 subfield(sub), overfield(over),
791 pseudotraces(pseudo),
792 liftuphelper(liftup),
793 artin(mat), artinLine(line),
794 plusone(pluso), twopminusone(twopminuso),
796 stem(st), vsubfield(vsub),
809 subfield(sub), overfield(NULL),
811 primitive(new FieldElement<T>(this, pri)),
814 artin(), artinLine(-1),
815 plusone(false), twopminusone(false),
817 stem(this), vsubfield(NULL),
818 gen(new FieldElement<T>(this, g)),
828 subfield(NULL), overfield(NULL),
830 primitive(new FieldElement<T>(this, pri)),
833 artin(), artinLine(-1),
834 plusone(false), twopminusone(false),
836 stem(this), vsubfield(NULL),
837 gen(new FieldElement<T>(this, pri)),
851 const FieldElement<T>* aleph,
852 const Field<T>* vsub = NULL
854 subfield(sub), overfield(NULL),
856 primitive(new FieldElement<T>(this, pri)),
859 artin(), artinLine(-1),
860 plusone(po), twopminusone(tpmo),
862 stem(this), vsubfield(vsub),
863 gen(new FieldElement<T>(this, pri)),
870 const FieldElement<T>& gen,
871 const FieldElement<T>* aleph,
874 subfield(NULL), overfield(NULL),
879 artin(), artinLine(-1),
880 plusone(), twopminusone(),
882 stem(st), vsubfield(vsub),
883 gen(new FieldElement<T>(this, gen.repBase, gen.repExt, gen.base)),
895 template <
class T> ostream& operator<<(ostream& o, const Field<T>& F) {