Gröbner basis project
Codebase for research into Gröbner basis computation
pack_exponents_test.cxx
1 #include <bitset>
2 #include <cstring>
3 #include <iostream>
4 
5 using std::cout; using std::endl; using std::bitset;
6 
7 int main(int argc, char ** argv) {
8  unsigned long * a = new unsigned long[8];
9  unsigned long * b = new unsigned long[8];
10  unsigned long long * c = new unsigned long long[4] {0} ;
11  unsigned long long * d = new unsigned long long[4] {0} ;
12  for (unsigned long long i = 0; i < 8; ++i) {
13  a[i] = b[i] = i;
14  if ((i % 2) == 0)
15  c[i/2] = d[i/2] += i;
16  else
17  c[i/2] = d[i/2] += (i << 32);
18  }
19  cout << "size of unsigned long " << sizeof(unsigned long) << endl;
20  cout << "size of unsigned long long " << sizeof(unsigned long long) << endl;
21  cout << endl;
22  for (unsigned i = 0; i < 8; ++i)
23  cout << bitset<64>(a[i]) << endl << bitset<64>(b[i]) << endl;
24  cout << endl;
25  for (unsigned i = 0; i < 4; ++i)
26  cout << bitset<64>(c[i]) << endl << bitset<64>(d[i]) << endl;
27  if (argc > 1) {
28  if (!strcmp(argv[1],"1")) {
29  for (unsigned i = 0; i < 128000003; ++i)
30  for (unsigned j = 0; j < 8; ++j)
31  if (a[j] != b[j]) cout << "fault " << j << endl;
32  } else {
33  for (unsigned i = 0; i < 128000003; ++i)
34  for (unsigned j = 0; j < 4; ++j)
35  if (c[j] != d[j]) cout << "fault " << j << endl;
36  }
37  }
38 }