X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Ftime_vandermonde.cpp;h=f878b0b886ddc398355b836d97e694852838e61e;hp=364ca5a5ec8c340302494a53f261fa0304e26169;hb=1566be23d91ed1311bee2071bdae9ef93d0b7cf6;hpb=fdf2f2da4e2b00870cd05c2ac9121de53e56ce3b diff --git a/check/time_vandermonde.cpp b/check/time_vandermonde.cpp index 364ca5a5..f878b0b8 100644 --- a/check/time_vandermonde.cpp +++ b/check/time_vandermonde.cpp @@ -7,7 +7,7 @@ */ /* - * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,75 +28,77 @@ static unsigned vandermonde_det(unsigned size) { - unsigned result = 0; - symbol a("a"); - - // construct Vandermonde matrix: - matrix M(size,size); - for (unsigned ro=0; ro sizes; - vector times; - timer swatch; - - sizes.push_back(4); - sizes.push_back(6); - sizes.push_back(8); - sizes.push_back(10); - - for (vector::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::iterator i=sizes.begin(); i!=sizes.end(); ++i) - cout << '\t' << *i << 'x' << *i; - cout << endl << " time/s:"; - for (vector::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 sizes; + vector times; + timer swatch; + + sizes.push_back(4); + sizes.push_back(6); + sizes.push_back(8); + sizes.push_back(10); + + for (vector::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::iterator i=sizes.begin(); i!=sizes.end(); ++i) + cout << '\t' << *i << 'x' << *i; + cout << endl << " time/s:"; + for (vector::iterator i=times.begin(); i!=times.end(); ++i) + cout << '\t' << int(1000*(*i))*0.001; + cout << endl; + + return result; }