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, totaltime;
int retval = 0;
gfp::Infrastructure::BigInt p;
long d, l;
if (cin.peek() != EOF) {
cin >> p; cin >> d; cin >> l;
} else {
p = 2; 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 << "\tCreate\tPushDow\tLiftUp\tPreLift\tMul\tInv" << endl;
totaltime = -GetTime();
for (int i = 1 ; i <= l ; i++) {
cout << i << "\t";
cputime = -NTL::GetTime();
cputime += NTL::GetTime();
cout << cputime << "\t";
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
cout << "\t";
if (a != b) {
cout << "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;
}
cputime = -GetTime();
a*b;
cputime += GetTime();
cout << cputime << "\t";
cputime = -GetTime();
cputime += GetTime();
cout << cputime << endl;
}
totaltime += GetTime();
#ifdef FAAST_TIMINGS
cout << endl << "Time spent building the cyclotomic polynomial : "
<< gfp::TIME.CYCLOTOMIC << endl;
#endif
cout << endl;
cout << "Total duration : " << totaltime << endl;
return retval;
}