Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52142 - in trunk/libs/numeric/ublas/test: . common
From: guwi17_at_[hidden]
Date: 2009-04-02 17:43:25


Author: guwi17
Date: 2009-04-02 17:43:25 EDT (Thu, 02 Apr 2009)
New Revision: 52142
URL: http://svn.boost.org/trac/boost/changeset/52142

Log:
test/test71.cpp reverted some changes regarding boost::interval
test/test73.cpp reverted addition of special initilizer
test/common/init.hpp changed common initilizer to use float instead of (unsigned) int to initialize test vectors/matrices (this solved some boost::interval issues, but revealed other ones)

Text files modified:
   trunk/libs/numeric/ublas/test/common/init.hpp | 6 +++---
   trunk/libs/numeric/ublas/test/test71.cpp | 36 +++++++++++++-----------------------
   trunk/libs/numeric/ublas/test/test73.cpp | 2 +-
   3 files changed, 17 insertions(+), 27 deletions(-)

Modified: trunk/libs/numeric/ublas/test/common/init.hpp
==============================================================================
--- trunk/libs/numeric/ublas/test/common/init.hpp (original)
+++ trunk/libs/numeric/ublas/test/common/init.hpp 2009-04-02 17:43:25 EDT (Thu, 02 Apr 2009)
@@ -43,7 +43,7 @@
 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);
+ v [i] = typename V::value_type ( i + 1.f );
 }
 
 template<class M>
@@ -52,11 +52,11 @@
 #ifndef BOOST_UBLAS_NO_NESTED_CLASS_RELATION
     for (typename M::iterator1 i = m.begin1(); i != m.end1(); ++ i)
         for (typename M::iterator2 j = i.begin(); j != i.end(); ++ j)
- *j = typename M::value_type (i.index1() * size1 + j.index2() + 1);
+ *j = typename M::value_type ( i.index1() * size1 + j.index2() + 1.f );
 #else
     for (typename M::iterator1 i = m.begin1(); i != m.end1(); ++ i)
         for (typename M::iterator2 j = ublas::begin (i, ublas::iterator1_tag ()); j != ublas::end (i, ublas::iterator1_tag ()); ++ j)
- *j = typename M::value_type (i.index1() * size1 + j.index2() + 1);
+ *j = typename M::value_type ( i.index1() * size1 + j.index2() + 1.f );
 #endif
 }
 

Modified: trunk/libs/numeric/ublas/test/test71.cpp
==============================================================================
--- trunk/libs/numeric/ublas/test/test71.cpp (original)
+++ trunk/libs/numeric/ublas/test/test71.cpp 2009-04-02 17:43:25 EDT (Thu, 02 Apr 2009)
@@ -11,16 +11,6 @@
 
 #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 {
@@ -36,8 +26,8 @@
             real_type n;
 
             // Copy and swap
- detail::initialize_vector (v1);
- detail::initialize_vector (v2);
+ initialize_vector (v1);
+ initialize_vector (v2);
             v1 = v2;
             std::cout << "v1 = v2 = " << v1 << std::endl;
             v1.assign_temporary (v2);
@@ -46,20 +36,20 @@
             std::cout << "v1.swap (v2) = " << v1 << " " << v2 << std::endl;
 
             // Zero assignment
- v1 = ublas::zero_vector<> (v1.size ());
+ v1 = ublas::zero_vector<value_type> (v1.size ());
             std::cout << "v1.zero_vector = " << v1 << std::endl;
             v1 = v2;
 
             // Unary vector operations resulting in a vector
- detail::initialize_vector (v1);
+ 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
- detail::initialize_vector (v1);
- detail::initialize_vector (v2);
+ initialize_vector (v1);
+ initialize_vector (v2);
             v3 = v1 + v2;
             std::cout << "v1 + v2 = " << v3 << std::endl;
 
@@ -68,20 +58,20 @@
 
             // Scaling a vector
             t = value_type (N);
- detail::initialize_vector (v1);
+ 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;
- detail::initialize_vector (v1);
+ 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
- detail::initialize_vector (v1);
- detail::initialize_vector (v2);
+ initialize_vector (v1);
+ initialize_vector (v2);
             v2 += v1;
             std::cout << "v2 += v1 = " << v2 << std::endl;
             v2 -= v1;
@@ -96,7 +86,7 @@
             std::cout << "v1 *= N = " << v1 << std::endl;
 
             // Unary vector operations resulting in a scalar
- detail::initialize_vector (v1);
+ initialize_vector (v1);
             t = ublas::sum (v1);
             std::cout << "sum (v1) = " << t << std::endl;
             n = ublas::norm_1 (v1);
@@ -110,8 +100,8 @@
             std::cout << "index_norm_inf (v1) = " << i << std::endl;
 
             // Binary vector operations resulting in a scalar
- detail::initialize_vector (v1);
- detail::initialize_vector (v2);
+ initialize_vector (v1);
+ 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-04-02 17:43:25 EDT (Thu, 02 Apr 2009)
@@ -33,7 +33,7 @@
             std::cout << "m1.swap (m2) = " << m1 << " " << m2 << std::endl;
 
             // Zero assignment
- m1 = ublas::zero_matrix<> (m1.size1 (), m1.size2 ());
+ m1 = ublas::zero_matrix<value_type> (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