This example illustrates how to use FAAST::Field::ArtinSchreierExtension(), pushDown() and liftUp().
#include <faast.hpp>
#include <cstdlib>
using namespace std;
using namespace FAAST;
int main(int argv, char* argc[]) {
double cputime;
int retval = 0;
gfp::Infrastructure::BigInt p;
long d, l;
if (cin.peek() != EOF) {
cin >> p; cin >> d; cin >> l;
} else {
p = 3; d = 1; l = 4;
}
cout << "Using " << gfp::Infrastructure::name << endl << endl;
cputime = -NTL::GetTime();
cputime += NTL::GetTime();
cout << *K << " in " << cputime << endl;
#ifdef FAAST_TIMINGS
cout << "Time spent building the irreducible polynomial : "
<< gfp::TIME.BUILDIRRED << endl;
#endif
cout << endl;
cout << "\tPDown\tLUp\tLUPre" << endl;
for (int i = 1 ; i <= l ; i++) {
cputime = -NTL::GetTime();
cputime += NTL::GetTime();
cout << *K << " in " << cputime << endl;
for (int i = 1 ; i <= 3 ; i++) {
vector<gfp_E> down;
cputime = -GetTime();
cputime += GetTime();
cout << cputime << "\t";
cputime = -GetTime();
cputime += GetTime();
cout << cputime << "\t";
#ifdef FAAST_TIMINGS
cout << gfp::TIME.LIFTUP;
#endif
if (a != b) {
cout << endl << "ERROR : Results don't match" << endl;
cout << a << endl << b << endl;
vector<gfp_E>::iterator it;
for (it = down.begin() ; it != down.end() ; it++)
cout << *it << " ";
cout << endl;
retval = 1;
}
cout << endl;
}
}
#ifdef FAAST_TIMINGS
cout << endl << "Time spent building the cyclotomic polynomial : "
<< gfp::TIME.CYCLOTOMIC << endl;
#endif
return retval;
}