diff --git a/include/boost/numeric/ublas/traits.hpp b/include/boost/numeric/ublas/traits.hpp index f3a40a88..b96e3b0d 100644 --- a/include/boost/numeric/ublas/traits.hpp +++ b/include/boost/numeric/ublas/traits.hpp @@ -694,207 +694,10 @@ namespace boost { namespace numeric { namespace ublas { } }; - template<> - struct type_traits > > { - typedef type_traits > > self_type; - typedef boost::complex > value_type; - typedef const value_type &const_reference; - typedef value_type &reference; - typedef boost::numeric::interval real_type; - typedef boost::complex > precision_type; - - static const unsigned plus_complexity = 2; - static const unsigned multiplies_complexity = 6; - - static - BOOST_UBLAS_INLINE - real_type real (const_reference t) { - return std::real (t); - } - static - BOOST_UBLAS_INLINE - real_type imag (const_reference t) { - return std::imag (t); - } - static - BOOST_UBLAS_INLINE - value_type conj (const_reference t) { - return std::conj (t); - } - - static - BOOST_UBLAS_INLINE - real_type abs (const_reference t) { - return boost::numeric::abs (t); - } - static - BOOST_UBLAS_INLINE - value_type sqrt (const_reference t) { - return boost::numeric::sqrt (t); - } - - static - BOOST_UBLAS_INLINE - real_type norm_1 (const_reference t) { - return type_traits::abs (self_type::real (t)) + - type_traits::abs (self_type::imag (t)); - } - static - BOOST_UBLAS_INLINE - real_type norm_2 (const_reference t) { - return self_type::abs (t); - } - static - BOOST_UBLAS_INLINE - real_type norm_inf (const_reference t) { - return (std::max) (type_traits::abs (self_type::real (t)), - type_traits::abs (self_type::imag (t))); - } - - static - BOOST_UBLAS_INLINE - bool equals (const_reference t1, const_reference t2) { - return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * - (std::max) ((std::max) (self_type::norm_inf (t1), - self_type::norm_inf (t2)), - BOOST_UBLAS_TYPE_CHECK_MIN); - } - }; - template<> - struct type_traits > { - typedef type_traits > self_type; - typedef boost::complex > value_type; - typedef const value_type &const_reference; - typedef value_type &reference; - typedef boost::numeric::interval real_type; - typedef boost::complex > precision_type; - - static const unsigned plus_complexity = 2; - static const unsigned multiplies_complexity = 6; - - static - BOOST_UBLAS_INLINE - real_type real (const_reference t) { - return std::real (t); - } - static - BOOST_UBLAS_INLINE - real_type imag (const_reference t) { - return std::imag (t); - } - static - BOOST_UBLAS_INLINE - value_type conj (const_reference t) { - return std::conj (t); - } - - static - BOOST_UBLAS_INLINE - real_type abs (const_reference t) { - return boost::numeric::abs (t); - } - static - BOOST_UBLAS_INLINE - value_type sqrt (const_reference t) { - return boost::numeric::sqrt (t); - } - - static - BOOST_UBLAS_INLINE - real_type norm_1 (const_reference t) { - return type_traits::abs (self_type::real (t)) + - type_traits::abs (self_type::imag (t)); - } - static - BOOST_UBLAS_INLINE - real_type norm_2 (const_reference t) { - return self_type::abs (t); - } - static - BOOST_UBLAS_INLINE - real_type norm_inf (const_reference t) { - return (std::max) (type_traits::abs (self_type::real (t)), - type_traits::abs (self_type::imag (t))); - } - - static - BOOST_UBLAS_INLINE - bool equals (const_reference t1, const_reference t2) { - return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * - (std::max) ((std::max) (self_type::norm_inf (t1), - self_type::norm_inf (t2)), - BOOST_UBLAS_TYPE_CHECK_MIN); - } - }; - template<> - struct type_traits > > { - typedef type_traits > > self_type; - typedef boost::complex > value_type; - typedef const value_type &const_reference; - typedef value_type &reference; - typedef boost::numeric::interval real_type; - typedef value_type precision_type; - - static const unsigned plus_complexity = 2; - static const unsigned multiplies_complexity = 6; - - static - BOOST_UBLAS_INLINE - real_type real (const_reference t) { - return std::real (t); - } - static - BOOST_UBLAS_INLINE - real_type imag (const_reference t) { - return std::imag (t); - } - static - BOOST_UBLAS_INLINE - value_type conj (const_reference t) { - return std::conj (t); - } - - static - BOOST_UBLAS_INLINE - real_type abs (const_reference t) { - return boost::numeric::abs (t); - } - static - BOOST_UBLAS_INLINE - value_type sqrt (const_reference t) { - return boost::numeric::sqrt (t); - } - - static - BOOST_UBLAS_INLINE - real_type norm_1 (const_reference t) { - return type_traits::abs (self_type::real (t)) + - type_traits::abs (self_type::imag (t)); - } - static - BOOST_UBLAS_INLINE - real_type norm_2 (const_reference t) { - return self_type::abs (t); - } - static - BOOST_UBLAS_INLINE - real_type norm_inf (const_reference t) { - return (std::max) (type_traits::abs (self_type::real (t)), - type_traits::abs (self_type::imag (t))); - } - - static - BOOST_UBLAS_INLINE - bool equals (const_reference t1, const_reference t2) { - return self_type::norm_inf (t1 - t2) < BOOST_UBLAS_TYPE_CHECK_EPSILON * - (std::max) ((std::max) (self_type::norm_inf (t1), - self_type::norm_inf (t2)), - BOOST_UBLAS_TYPE_CHECK_MIN); - } - }; #endif + // Storage tags -- hierarchical definition of storage characteristics struct unknown_storage_tag {}; struct sparse_proxy_tag: public unknown_storage_tag {}; @@ -962,6 +765,9 @@ namespace boost { namespace numeric { namespace ublas { typedef sparse_proxy_tag storage_category; }; + + // Iterator tags -- hierarchical definition of storage characteristics + struct sparse_bidirectional_iterator_tag : public std::bidirectional_iterator_tag {}; struct packed_random_access_iterator_tag : public std::random_access_iterator_tag {}; struct dense_random_access_iterator_tag : public packed_random_access_iterator_tag {}; diff --git a/test/test7/test7.hpp b/test/test7/test7.hpp index 00e2a139..94a5c710 100644 --- a/test/test7/test7.hpp +++ b/test/test7/test7.hpp @@ -23,7 +23,9 @@ #include #include +#include #include +#include #include namespace ublas = boost::numeric::ublas; diff --git a/test/test7/test71.cpp b/test/test7/test71.cpp index 9dd759b2..0267d0e2 100644 --- a/test/test7/test71.cpp +++ b/test/test7/test71.cpp @@ -1,4 +1,3 @@ -// // Copyright (c) 2000-2002 // Joerg Walter, Mathias Koch // @@ -61,12 +60,12 @@ struct test_my_vector { initialize_vector (v1); v2 = value_type (1.) * v1; std::cout << "1. * v1 = " << v2 << std::endl; - v2 = t * v1; +// v2 = t * v1; std::cout << "N * v1 = " << v2 << std::endl; initialize_vector (v1); - v2 = v1 * value_type (1.); +// v2 = v1 * value_type (1.); std::cout << "v1 * 1. = " << v2 << std::endl; - v2 = v1 * t; +// v2 = v1 * t; std::cout << "v1 * N = " << v2 << std::endl; // Some assignments @@ -142,18 +141,6 @@ void test_vector () { std::cout << "boost::numeric::interval, bounded_array" << std::endl; test_my_vector, ublas::bounded_array, 3> >, 3 > () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, bounded_array" << std::endl; - test_my_vector >, ublas::bounded_array >, 3> >, 3 > () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, bounded_array" << std::endl; - test_my_vector >, ublas::bounded_array >, 3> >, 3 > () (); -#endif -#endif #endif #ifdef USE_UNBOUNDED_ARRAY @@ -166,18 +153,6 @@ void test_vector () { std::cout << "boost::numeric::interval, unbounded_array" << std::endl; test_my_vector, ublas::unbounded_array > >, 3 > () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, unbounded_array" << std::endl; - test_my_vector >, ublas::unbounded_array > > >, 3 > () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, unbounded_array" << std::endl; - test_my_vector >, ublas::unbounded_array > > >, 3 > () (); -#endif -#endif #endif #ifdef USE_STD_VECTOR @@ -190,17 +165,5 @@ void test_vector () { std::cout << "boost::numeric::interval, std::vector" << std::endl; test_my_vector, std::vector > >, 3 > () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, std::vector" << std::endl; - test_my_vector >, std::vector > > >, 3 > () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, std::vector" << std::endl; - test_my_vector >, std::vector > > >, 3 > () (); -#endif -#endif #endif } diff --git a/test/test7/test72.cpp b/test/test7/test72.cpp index 4a0388b8..9c7c55ae 100644 --- a/test/test7/test72.cpp +++ b/test/test7/test72.cpp @@ -92,20 +92,6 @@ void test_matrix_vector () { test_my_matrix_vector, ublas::bounded_array, 3> >, ublas::matrix, ublas::row_major, ublas::bounded_array, 3 * 3> >, 3> () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, bounded_array" << std::endl; - test_my_matrix_vector >, ublas::bounded_array >, 3> >, - ublas::matrix >, ublas::row_major, ublas::bounded_array >, 3 * 3> >, 3> () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, bounded_array" << std::endl; - test_my_matrix_vector >, ublas::bounded_array >, 3> >, - ublas::matrix >, ublas::row_major, ublas::bounded_array >, 3 * 3> >, 3> () (); -#endif -#endif #endif #ifdef USE_UNBOUNDED_ARRAY @@ -120,20 +106,6 @@ void test_matrix_vector () { test_my_matrix_vector, ublas::unbounded_array > >, ublas::matrix, ublas::row_major, ublas::unbounded_array > >, 3> () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, unbounded_array" << std::endl; - test_my_matrix_vector >, ublas::unbounded_array > > >, - ublas::matrix >, ublas::row_major, ublas::unbounded_array > > >, 3> () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, unbounded_array" << std::endl; - test_my_matrix_vector >, ublas::unbounded_array > > >, - ublas::matrix >, ublas::row_major, ublas::unbounded_array > > >, 3> () (); -#endif -#endif #endif #ifdef USE_STD_VECTOR @@ -148,20 +120,6 @@ void test_matrix_vector () { test_my_matrix_vector, std::vector > >, ublas::matrix, ublas::row_major, std::vector > >, 3> () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, std::vector" << std::endl; - test_my_matrix_vector >, std::vector > > >, - ublas::matrix >, ublas::row_major, std::vector > > >, 3> () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, std::vector" << std::endl; - test_my_matrix_vector >, std::vector > > >, - ublas::matrix >, ublas::row_major, std::vector > > >, 3> () (); -#endif -#endif #endif #endif @@ -178,20 +136,6 @@ void test_matrix_vector () { test_my_matrix_vector, ublas::bounded_array, 3> >, ublas::vector_of_vector, ublas::row_major, ublas::bounded_array, 3>, 3 + 1> >, 3> () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, bounded_array" << std::endl; - test_my_matrix_vector >, ublas::bounded_array >, 3> >, - ublas::vector_of_vector >, ublas::row_major, ublas::bounded_array >, 3>, 3 + 1> >, 3> () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, bounded_array" << std::endl; - test_my_matrix_vector >, ublas::bounded_array >, 3> >, - ublas::vector_of_vector >, ublas::row_major, ublas::bounded_array >, 3>, 3 + 1> >, 3> () (); -#endif -#endif #endif #ifdef USE_UNBOUNDED_ARRAY @@ -206,20 +150,6 @@ void test_matrix_vector () { test_my_matrix_vector, ublas::unbounded_array > >, ublas::vector_of_vector, ublas::row_major, ublas::unbounded_array > > >, 3> () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, unbounded_array" << std::endl; - test_my_matrix_vector >, ublas::unbounded_array > > >, - ublas::vector_of_vector >, ublas::row_major, ublas::unbounded_array > > > >, 3> () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, unbounded_array" << std::endl; - test_my_matrix_vector >, ublas::unbounded_array > > >, - ublas::vector_of_vector >, ublas::row_major, ublas::unbounded_array > > > >, 3> () (); -#endif -#endif #endif #ifdef USE_STD_VECTOR @@ -234,20 +164,6 @@ void test_matrix_vector () { test_my_matrix_vector, std::vector > >, ublas::vector_of_vector, ublas::row_major, std::vector > > >, 3> () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, std::vector" << std::endl; - test_my_matrix_vector >, std::vector > > >, - ublas::vector_of_vector >, ublas::row_major, std::vector > > > >, 3> () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, std::vector" << std::endl; - test_my_matrix_vector >, std::vector > > >, - ublas::vector_of_vector >, ublas::row_major, std::vector > > > >, 3> () (); -#endif -#endif #endif #endif } diff --git a/test/test7/test73.cpp b/test/test7/test73.cpp index 149da02a..e4abde4a 100644 --- a/test/test7/test73.cpp +++ b/test/test7/test73.cpp @@ -134,18 +134,6 @@ void test_matrix () { std::cout << "boost::numeric::interval, bounded_array" << std::endl; test_my_matrix, ublas::row_major, ublas::bounded_array, 3 * 3> >, 3 > () (); #endif - -#ifdef BOOST_UBLAS_NEED_ANOTHER_COMPLEX_CLASS -#ifdef USE_FLOAT - std::cout << "boost::complex >, bounded_array" << std::endl; - test_my_matrix >, ublas::row_major, ublas::bounded_array >, 3 * 3> >, 3 > () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, bounded_array" << std::endl; - test_my_matrix >, ublas::row_major, ublas::bounded_array >, 3 * 3> >, 3 > () (); -#endif -#endif #endif #ifdef USE_UNBOUNDED_ARRAY @@ -158,18 +146,6 @@ void test_matrix () { std::cout << "boost::numeric::interval, unbounded_array" << std::endl; test_my_matrix, ublas::row_major, ublas::unbounded_array > >, 3 > () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, unbounded_array" << std::endl; - test_my_matrix >, ublas::row_major, ublas::unbounded_array > > >, 3 > () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, unbounded_array" << std::endl; - test_my_matrix >, ublas::row_major, ublas::unbounded_array > > >, 3 > () (); -#endif -#endif #endif #ifdef USE_STD_VECTOR @@ -182,18 +158,6 @@ void test_matrix () { std::cout << "boost::numeric::interval, std::vector" << std::endl; test_my_matrix, ublas::row_major, std::vector > >, 3 > () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, std::vector" << std::endl; - test_my_matrix >, ublas::row_major, std::vector > > >, 3 > () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, std::vector" << std::endl; - test_my_matrix >, ublas::row_major, std::vector > > >, 3 > () (); -#endif -#endif #endif #endif @@ -208,18 +172,6 @@ void test_matrix () { std::cout << "boost::numeric::interval, bounded_array" << std::endl; test_my_matrix, ublas::row_major, ublas::bounded_array, 3>, 3 + 1> >, 3 > () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, bounded_array" << std::endl; - test_my_matrix >, ublas::row_major, ublas::bounded_array >, 3>, 3 + 1> >, 3 > () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, bounded_array" << std::endl; - test_my_matrix >, ublas::row_major, ublas::bounded_array >, 3>, 3 + 1> >, 3 > () (); -#endif -#endif #endif #ifdef USE_UNBOUNDED_ARRAY @@ -232,18 +184,6 @@ void test_matrix () { std::cout << "boost::numeric::interval, unbounded_array" << std::endl; test_my_matrix, ublas::row_major, ublas::unbounded_array > > >, 3 > () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, unbounded_array" << std::endl; - test_my_matrix >, ublas::row_major, ublas::unbounded_array > > > >, 3 > () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, unbounded_array" << std::endl; - test_my_matrix >, ublas::row_major, ublas::unbounded_array > > > >, 3 > () (); -#endif -#endif #endif #ifdef USE_STD_VECTOR @@ -256,18 +196,6 @@ void test_matrix () { std::cout << "boost::numeric::interval, std::vector" << std::endl; test_my_matrix, ublas::row_major, std::vector > > >, 3 > () (); #endif - -#ifdef USE_BOOST_COMPLEX -#ifdef USE_FLOAT - std::cout << "boost::complex >, std::vector" << std::endl; - test_my_matrix >, ublas::row_major, std::vector > > > >, 3 > () (); -#endif - -#ifdef USE_DOUBLE - std::cout << "boost::complex >, std::vector" << std::endl; - test_my_matrix >, ublas::row_major, std::vector > > > >, 3 > () (); -#endif -#endif #endif #endif }