- unsigned result = 0;
-
- cout << "timing determinant of univariate symbolic Vandermonde matrices" << flush;
- clog << "-------determinant of univariate symbolic Vandermonde matrices:" << endl;
-
- vector<unsigned> sizes;
- vector<double> times;
- timer swatch;
-
- sizes.push_back(4);
- sizes.push_back(6);
- sizes.push_back(8);
- sizes.push_back(10);
-
- for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
- int count = 1;
- swatch.start();
- result += vandermonde_det(*i);
- // correct for very small times:
- while (swatch.read()<0.02) {
- vandermonde_det(*i);
- ++count;
- }
- times.push_back(swatch.read()/count);
- cout << '.' << flush;
- }
-
- if (!result) {
- cout << " passed ";
- clog << "(no output)" << endl;
- } else {
- cout << " failed ";
- }
- // print the report:
- cout << endl << " dim: ";
- for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i)
- cout << '\t' << *i << 'x' << *i;
- cout << endl << " time/s:";
- for (vector<double>::iterator i=times.begin(); i!=times.end(); ++i)
- cout << '\t' << int(1000*(*i))*0.001;
- cout << endl;
-
- return result;
+ unsigned result = 0;
+
+ cout << "timing determinant of univariate symbolic Vandermonde matrices" << flush;
+ clog << "-------determinant of univariate symbolic Vandermonde matrices:" << endl;
+
+ vector<unsigned> sizes;
+ vector<double> times;
+ timer swatch;
+
+ sizes.push_back(4);
+ sizes.push_back(6);
+ sizes.push_back(8);
+ sizes.push_back(10);
+
+ for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
+ int count = 1;
+ swatch.start();
+ result += vandermonde_det(*i);
+ // correct for very small times:
+ while (swatch.read()<0.02) {
+ vandermonde_det(*i);
+ ++count;
+ }
+ times.push_back(swatch.read()/count);
+ cout << '.' << flush;
+ }
+
+ if (!result) {
+ cout << " passed ";
+ clog << "(no output)" << endl;
+ } else {
+ cout << " failed ";
+ }
+ // print the report:
+ cout << endl << " dim: ";
+ for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i)
+ cout << '\t' << *i << 'x' << *i;
+ cout << endl << " time/s:";
+ for (vector<double>::iterator i=times.begin(); i!=times.end(); ++i)
+ cout << '\t' << int(1000*(*i))*0.001;
+ cout << endl;
+
+ return result;