$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r80644 - trunk/libs/numeric/ublas/test
From: guwi17_at_[hidden]
Date: 2012-09-22 17:03:51
Author: guwi17
Date: 2012-09-22 17:03:50 EDT (Sat, 22 Sep 2012)
New Revision: 80644
URL: http://svn.boost.org/trac/boost/changeset/80644
Log:
* libs/numeric/ublas/test/test_triangular.cpp: switch to boost::timer and enable all tests, see #7296
* libs/numeric/ublas/test/Jamfile.v2: add required lib boost_timer
Text files modified: 
   trunk/libs/numeric/ublas/test/Jamfile.v2          |     3 ++                                      
   trunk/libs/numeric/ublas/test/test_triangular.cpp |    47 +++++++++++++++++---------------------- 
   2 files changed, 23 insertions(+), 27 deletions(-)
Modified: trunk/libs/numeric/ublas/test/Jamfile.v2
==============================================================================
--- trunk/libs/numeric/ublas/test/Jamfile.v2	(original)
+++ trunk/libs/numeric/ublas/test/Jamfile.v2	2012-09-22 17:03:50 EDT (Sat, 22 Sep 2012)
@@ -174,6 +174,9 @@
           : :
           ]
           [ run test_triangular.cpp
+        :
+        :
+        : <library>/boost/timer//boost_timer
           ]
           [ run test_ticket7296.cpp
           ]
Modified: trunk/libs/numeric/ublas/test/test_triangular.cpp
==============================================================================
--- trunk/libs/numeric/ublas/test/test_triangular.cpp	(original)
+++ trunk/libs/numeric/ublas/test/test_triangular.cpp	2012-09-22 17:03:50 EDT (Sat, 22 Sep 2012)
@@ -6,6 +6,7 @@
 #include <boost/numeric/ublas/triangular.hpp>
 #include <boost/numeric/ublas/io.hpp>
 
+#include <boost/timer/timer.hpp>
 
 namespace ublas  = boost::numeric::ublas;
 
@@ -28,7 +29,7 @@
 
 
 int main() {
-  const int n=10000;
+  const int n=7000;
 #if 1
   ublas::compressed_matrix<double, ublas::row_major>     mat_row_upp(n, n);
   ublas::compressed_matrix<double, ublas::column_major>  mat_col_upp(n, n);
@@ -71,62 +72,54 @@
 
   std::cerr << "Starting..." << std::endl;
   {
-    clock_t start = clock();
+    boost::timer::auto_cpu_timer t(std::cerr, "col_low x: %t sec CPU, %w sec real\n");
     ublas::vector<double>  x(b);
     ublas::inplace_solve(mat_col_low,  x, ublas::lower_tag());
-    std::cerr << "Col_low x: " << clock()-start << std::endl;
     std::cerr << "delta: " << diff(mat_col_low, x, b) << "\n";
   }
   {
-    clock_t start = clock();
+    boost::timer::auto_cpu_timer t(std::cerr, "row_low x: %t sec CPU, %w sec real\n");
     ublas::vector<double>  x(b);
     ublas::inplace_solve(mat_row_low, x, ublas::lower_tag());
-    std::cerr << "Row_low x: " << clock()-start << std::endl;
     std::cerr << "delta: " << diff(mat_row_low, x, b) << "\n";
   }
 
   {
-    clock_t start = clock();
+    boost::timer::auto_cpu_timer t(std::cerr, "col_upp x: %t sec CPU, %w sec real\n");
     ublas::vector<double>  x(b);
     ublas::inplace_solve(mat_col_upp,  x, ublas::upper_tag());
-    std::cerr << "col_upp x: " << clock()-start << std::endl;
     std::cerr << "delta: " << diff(mat_col_upp, x, b) << "\n";
   }
   {
-    clock_t start = clock();
+    boost::timer::auto_cpu_timer t(std::cerr, "row_upp x: %t sec CPU, %w sec real\n");
     ublas::vector<double>  x(b);
     ublas::inplace_solve(mat_row_upp, x, ublas::upper_tag());
-    std::cerr << "row_upp x: " << clock()-start << std::endl;
     std::cerr << "delta: " << diff(mat_row_upp, x, b) << "\n";
   }
 
-//   {
-//     clock_t start = clock();
-//     ublas::vector<double>  x(b);
-//     ublas::inplace_solve(x, mat_col_low, ublas::lower_tag());
-//     std::cerr << "x col_low: " << clock()-start << std::endl;
-//     std::cerr << "delta: " << diff(x, mat_col_low, b) << "\n";
-//   }
   {
-    clock_t start = clock();
+    boost::timer::auto_cpu_timer t(std::cerr, "x col_low: %t sec CPU, %w sec real\n");
+    ublas::vector<double>  x(b);
+    ublas::inplace_solve(x, mat_col_low, ublas::lower_tag());
+    std::cerr << "delta: " << diff(x, mat_col_low, b) << "\n";
+  }
+  {
+    boost::timer::auto_cpu_timer t(std::cerr, "x row_low: %t sec CPU, %w sec real\n");
     ublas::vector<double>  x(b);
     ublas::inplace_solve(x, mat_row_low, ublas::lower_tag());
-    std::cerr << "x row_low: " << clock()-start << std::endl;
     std::cerr << "delta: " << diff(x, mat_row_low, b) << "\n";
   }
 
-//   {
-//     clock_t start = clock();
-//     ublas::vector<double>  x(b);
-//     ublas::inplace_solve(x, mat_col_upp, ublas::upper_tag());
-//     std::cerr << "x col_upp: " << clock()-start << std::endl;
-//     std::cerr << "delta: " << diff(x, mat_col_upp, b) << "\n";
-//   }
   {
-    clock_t start = clock();
+    boost::timer::auto_cpu_timer t(std::cerr, "x col_upp: %t sec CPU, %w sec real\n");
+    ublas::vector<double>  x(b);
+    ublas::inplace_solve(x, mat_col_upp, ublas::upper_tag());
+    std::cerr << "delta: " << diff(x, mat_col_upp, b) << "\n";
+  }
+  {
+    boost::timer::auto_cpu_timer t(std::cerr, "x row_upp: %t sec CPU, %w sec real\n");
     ublas::vector<double>  x(b);
     ublas::inplace_solve(x, mat_row_upp, ublas::upper_tag());
-    std::cerr << "x row_upp: " << clock()-start << std::endl;
     std::cerr << "delta: " << diff(x, mat_row_upp, b) << "\n";
   }