Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51762 - trunk/libs/numeric/ublas/test
From: guwi17_at_[hidden]
Date: 2009-03-13 16:50:43


Author: guwi17
Date: 2009-03-13 16:50:42 EDT (Fri, 13 Mar 2009)
New Revision: 51762
URL: http://svn.boost.org/trac/boost/changeset/51762

Log:
test71.cpp: fixed initialization of vector of intervals
test73.cpp: fixed typo (size instead of size1)
test7.cpp: added comment

Text files modified:
   trunk/libs/numeric/ublas/test/test7.cpp | 2 ++
   trunk/libs/numeric/ublas/test/test71.cpp | 34 ++++++++++++++++++++++------------
   trunk/libs/numeric/ublas/test/test73.cpp | 2 +-
   3 files changed, 25 insertions(+), 13 deletions(-)

Modified: trunk/libs/numeric/ublas/test/test7.cpp
==============================================================================
--- trunk/libs/numeric/ublas/test/test7.cpp (original)
+++ trunk/libs/numeric/ublas/test/test7.cpp 2009-03-13 16:50:42 EDT (Fri, 13 Mar 2009)
@@ -21,6 +21,8 @@
 
 #include "test7.hpp"
 
+// this testcase requires fix of task #2473
+
 int main () {
     test_vector ();
     test_matrix_vector ();

Modified: trunk/libs/numeric/ublas/test/test71.cpp
==============================================================================
--- trunk/libs/numeric/ublas/test/test71.cpp (original)
+++ trunk/libs/numeric/ublas/test/test71.cpp 2009-03-13 16:50:42 EDT (Fri, 13 Mar 2009)
@@ -11,6 +11,16 @@
 
 #include "test7.hpp"
 
+namespace detail {
+ template<class V>
+ void initialize_vector (V &v) {
+ typename V::size_type size = v.size ();
+ for (typename V::size_type i = 0; i < size; ++ i)
+ v [i] = typename V::value_type (i + 1.0, i + 5.0);
+ // use float because of ticket 2473
+ }
+}
+
 // Test vector expression templates
 template<class V, int N>
 struct test_my_vector {
@@ -26,8 +36,8 @@
             real_type n;
 
             // Copy and swap
- initialize_vector (v1);
- initialize_vector (v2);
+ detail::initialize_vector (v1);
+ detail::initialize_vector (v2);
             v1 = v2;
             std::cout << "v1 = v2 = " << v1 << std::endl;
             v1.assign_temporary (v2);
@@ -41,15 +51,15 @@
             v1 = v2;
 
             // Unary vector operations resulting in a vector
- initialize_vector (v1);
+ detail::initialize_vector (v1);
             v2 = - v1;
             std::cout << "- v1 = " << v2 << std::endl;
             v2 = ublas::conj (v1);
             std::cout << "conj (v1) = " << v2 << std::endl;
 
             // Binary vector operations resulting in a vector
- initialize_vector (v1);
- initialize_vector (v2);
+ detail::initialize_vector (v1);
+ detail::initialize_vector (v2);
             v3 = v1 + v2;
             std::cout << "v1 + v2 = " << v3 << std::endl;
 
@@ -58,20 +68,20 @@
 
             // Scaling a vector
             t = value_type (N);
- initialize_vector (v1);
+ detail::initialize_vector (v1);
             v2 = value_type (1.) * v1;
             std::cout << "1. * v1 = " << v2 << std::endl;
 // v2 = t * v1;
             std::cout << "N * v1 = " << v2 << std::endl;
- initialize_vector (v1);
+ detail::initialize_vector (v1);
 // v2 = v1 * value_type (1.);
             std::cout << "v1 * 1. = " << v2 << std::endl;
 // v2 = v1 * t;
             std::cout << "v1 * N = " << v2 << std::endl;
 
             // Some assignments
- initialize_vector (v1);
- initialize_vector (v2);
+ detail::initialize_vector (v1);
+ detail::initialize_vector (v2);
             v2 += v1;
             std::cout << "v2 += v1 = " << v2 << std::endl;
             v2 -= v1;
@@ -86,7 +96,7 @@
             std::cout << "v1 *= N = " << v1 << std::endl;
 
             // Unary vector operations resulting in a scalar
- initialize_vector (v1);
+ detail::initialize_vector (v1);
             t = ublas::sum (v1);
             std::cout << "sum (v1) = " << t << std::endl;
             n = ublas::norm_1 (v1);
@@ -100,8 +110,8 @@
             std::cout << "index_norm_inf (v1) = " << i << std::endl;
 
             // Binary vector operations resulting in a scalar
- initialize_vector (v1);
- initialize_vector (v2);
+ detail::initialize_vector (v1);
+ detail::initialize_vector (v2);
             t = ublas::inner_prod (v1, v2);
             std::cout << "inner_prod (v1, v2) = " << t << std::endl;
         }

Modified: trunk/libs/numeric/ublas/test/test73.cpp
==============================================================================
--- trunk/libs/numeric/ublas/test/test73.cpp (original)
+++ trunk/libs/numeric/ublas/test/test73.cpp 2009-03-13 16:50:42 EDT (Fri, 13 Mar 2009)
@@ -33,7 +33,7 @@
             std::cout << "m1.swap (m2) = " << m1 << " " << m2 << std::endl;
 
             // Zero assignment
- m1 = ublas::zero_matrix<> (m1.size (), m1.size2 ());
+ m1 = ublas::zero_matrix<> (m1.size1 (), m1.size2 ());
             std::cout << "m1.zero_matrix = " << m1 << std::endl;
             m1 = m2;
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk