diff --git a/include/boost/numeric/ublas/detail/concepts.hpp b/include/boost/numeric/ublas/detail/concepts.hpp index 8133670c..45134e3a 100644 --- a/include/boost/numeric/ublas/detail/concepts.hpp +++ b/include/boost/numeric/ublas/detail/concepts.hpp @@ -499,7 +499,7 @@ namespace boost { namespace numeric { namespace ublas { void constraints () { function_requires< VectorConcept >(); - function_requires< DefaultConstructible >(); + function_requires< DefaultConstructible >(); function_requires< Mutable_VectorExpressionConcept >(); size_type n (0); value_type t = value_type (); @@ -580,7 +580,7 @@ namespace boost { namespace numeric { namespace ublas { void constraints () { function_requires< MatrixConcept >(); - function_requires< DefaultConstructible >(); + function_requires< DefaultConstructible >(); function_requires< Mutable_MatrixExpressionConcept >(); size_type n (0); value_type t = value_type (); @@ -905,8 +905,8 @@ namespace boost { namespace numeric { namespace ublas { #define INTERNAL_EXPRESSION #endif - // TODO enable this for development - // #define VIEW_CONCEPTS + // TODO enable this for development + // #define VIEW_CONCEPTS // Element value type for tests typedef float T; @@ -980,7 +980,7 @@ namespace boost { namespace numeric { namespace ublas { #endif #ifdef VIEW_CONCEPTS - // read only vectors + // read only vectors { typedef vector_view container_model; function_requires< RandomAccessContainerConcept >(); diff --git a/include/boost/numeric/ublas/experimental/sparse_view.hpp b/include/boost/numeric/ublas/experimental/sparse_view.hpp index 688d5145..cc6e28c9 100644 --- a/include/boost/numeric/ublas/experimental/sparse_view.hpp +++ b/include/boost/numeric/ublas/experimental/sparse_view.hpp @@ -26,42 +26,42 @@ namespace boost { namespace numeric { namespace ublas { template < class T > class c_array_view - : public storage_array< c_array_view > { + : public storage_array< c_array_view > { private: - typedef c_array_view self_type; - typedef T * pointer; + typedef c_array_view self_type; + typedef T * pointer; public: - // TODO: think about a const pointer - typedef const pointer array_type; + // TODO: think about a const pointer + typedef const pointer array_type; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; - typedef T value_type; - typedef const T &const_reference; - typedef const T *const_pointer; + typedef T value_type; + typedef const T &const_reference; + typedef const T *const_pointer; typedef const_pointer const_iterator; typedef std::reverse_iterator const_reverse_iterator; - // - // typedefs required by vector concept - // + // + // typedefs required by vector concept + // - typedef dense_tag storage_category; + typedef dense_tag storage_category; typedef const vector_reference const_closure_type; - c_array_view(size_type size, array_type data) : - size_(size), data_(data) - {} + c_array_view(size_type size, array_type data) : + size_(size), data_(data) + {} - ~c_array_view() - {} + ~c_array_view() + {} - // - // immutable methods of container concept - // + // + // immutable methods of container concept + // BOOST_UBLAS_INLINE size_type size () const { @@ -93,8 +93,8 @@ namespace boost { namespace numeric { namespace ublas { } private: - size_type size_; - array_type data_; + size_type size_; + array_type data_; }; @@ -133,14 +133,14 @@ namespace boost { namespace numeric { namespace ublas { // ISSUE require type consistency check // is_convertable (IA::size_type, TA::size_type) typedef typename boost::remove_cv::value_type>::type index_type; - // for compatibility, should be removed some day ... + // for compatibility, should be removed some day ... typedef index_type size_type; // size_type for the data arrays. typedef typename vector_view_traits::size_type array_size_type; typedef typename vector_view_traits::difference_type difference_type; typedef const value_type & const_reference; - // do NOT define reference type, because class is read only + // do NOT define reference type, because class is read only // typedef value_type & reference; typedef IA rowptr_array_type; @@ -149,93 +149,93 @@ namespace boost { namespace numeric { namespace ublas { typedef const matrix_reference const_closure_type; typedef matrix_reference closure_type; - // FIXME: define a corresponding temporary type + // FIXME: define a corresponding temporary type // typedef compressed_vector vector_temporary_type; - // FIXME: define a corresponding temporary type + // FIXME: define a corresponding temporary type // typedef self_type matrix_temporary_type; typedef sparse_tag storage_category; typedef typename L::orientation_category orientation_category; - // - // private types for internal use - // + // + // private types for internal use + // private: - typedef typename vector_view_traits::const_iterator const_subiterator_type; + typedef typename vector_view_traits::const_iterator const_subiterator_type; - // + // // Construction and destruction - // + // private: - /// private default constructor because data must be filled by caller + /// private default constructor because data must be filled by caller BOOST_UBLAS_INLINE compressed_matrix_view () { } public: - BOOST_UBLAS_INLINE + BOOST_UBLAS_INLINE compressed_matrix_view (index_type n_rows, index_type n_cols, array_size_type nnz - , const rowptr_array_type & iptr - , const index_array_type & jptr - , const value_array_type & values): + , const rowptr_array_type & iptr + , const index_array_type & jptr + , const value_array_type & values): matrix_expression (), size1_ (n_rows), size2_ (n_cols), nnz_ (nnz), index1_data_ (iptr), - index2_data_ (jptr), - value_data_ (values) { + index2_data_ (jptr), + value_data_ (values) { storage_invariants (); } - BOOST_UBLAS_INLINE - compressed_matrix_view(const compressed_matrix_view& o) : - size1_(size1_), size2_(size2_), - nnz_(nnz_), - index1_data_(index1_data_), - index2_data_(index2_data_), - value_data_(value_data_) - {} + BOOST_UBLAS_INLINE + compressed_matrix_view(const compressed_matrix_view& o) : + size1_(size1_), size2_(size2_), + nnz_(nnz_), + index1_data_(index1_data_), + index2_data_(index2_data_), + value_data_(value_data_) + {} - // - // implement immutable iterator types - // + // + // implement immutable iterator types + // - class const_iterator1 {}; - class const_iterator2 {}; + class const_iterator1 {}; + class const_iterator2 {}; - typedef reverse_iterator_base1 const_reverse_iterator1; + typedef reverse_iterator_base1 const_reverse_iterator1; typedef reverse_iterator_base2 const_reverse_iterator2; - // - // implement all read only methods for the matrix expression concept - // + // + // implement all read only methods for the matrix expression concept + // - //! return the number of rows - index_type size1() const { - return size1_; - } + //! return the number of rows + index_type size1() const { + return size1_; + } - //! return the number of columns - index_type size2() const { - return size2_; - } + //! return the number of columns + index_type size2() const { + return size2_; + } - //! return value at position (i,j) - value_type operator()(index_type i, index_type j) const { - const_pointer p = find_element(i,j); - if (!p) { - return zero_; - } else { - return *p; - } - } - + //! return value at position (i,j) + value_type operator()(index_type i, index_type j) const { + const_pointer p = find_element(i,j); + if (!p) { + return zero_; + } else { + return *p; + } + } + private: - // - // private helper functions - // + // + // private helper functions + // const_pointer find_element (index_type i, index_type j) const { index_type element1 (layout_type::index_M (i, j)); @@ -244,22 +244,22 @@ namespace boost { namespace numeric { namespace ublas { const array_size_type itv = zero_based( index1_data_[element1] ); const array_size_type itv_next = zero_based( index1_data_[element1+1] ); - const_subiterator_type it_start = boost::next(vector_view_traits::begin(index2_data_),itv); - const_subiterator_type it_end = boost::next(vector_view_traits::begin(index2_data_),itv_next); + const_subiterator_type it_start = boost::next(vector_view_traits::begin(index2_data_),itv); + const_subiterator_type it_end = boost::next(vector_view_traits::begin(index2_data_),itv_next); const_subiterator_type it = find_index_in_row(it_start, it_end, element2) ; - + if (it == it_end || *it != k_based (element2)) return 0; return &value_data_ [it - vector_view_traits::begin(index2_data_)]; } - const_subiterator_type find_index_in_row(const_subiterator_type it_start - , const_subiterator_type it_end - , index_type index) const { - return std::lower_bound( it_start - , it_end - , k_based (index) ); - } + const_subiterator_type find_index_in_row(const_subiterator_type it_start + , const_subiterator_type it_end + , index_type index) const { + return std::lower_bound( it_start + , it_end + , k_based (index) ); + } private: @@ -301,13 +301,13 @@ namespace boost { namespace numeric { namespace ublas { template compressed_matrix_view make_compressed_matrix_view(typename vector_view_traits::value_type n_rows - , typename vector_view_traits::value_type n_cols - , typename vector_view_traits::size_type nnz - , const IA & ia - , const JA & ja - , const TA & ta) { + , typename vector_view_traits::value_type n_cols + , typename vector_view_traits::size_type nnz + , const IA & ia + , const JA & ja + , const TA & ta) { - return compressed_matrix_view(n_rows, n_cols, nnz, ia, ja, ta); + return compressed_matrix_view(n_rows, n_cols, nnz, ia, ja, ta); } diff --git a/include/boost/numeric/ublas/traits.hpp b/include/boost/numeric/ublas/traits.hpp index 62828441..6964031c 100644 --- a/include/boost/numeric/ublas/traits.hpp +++ b/include/boost/numeric/ublas/traits.hpp @@ -67,82 +67,82 @@ namespace boost { namespace numeric { namespace ublas { template typename boost::enable_if< - mpl::and_< - boost::is_float, - boost::is_integral - >, - std::complex >::type inline operator+ (I in1, std::complex const& in2 ) { - return R (in1) + in2; + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator+ (I in1, std::complex const& in2 ) { + return R (in1) + in2; } template typename boost::enable_if< - mpl::and_< - boost::is_float, - boost::is_integral - >, - std::complex >::type inline operator+ (std::complex const& in1, I in2) { - return in1 + R (in2); + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator+ (std::complex const& in1, I in2) { + return in1 + R (in2); } template typename boost::enable_if< - mpl::and_< - boost::is_float, - boost::is_integral - >, - std::complex >::type inline operator- (I in1, std::complex const& in2) { - return R (in1) - in2; + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator- (I in1, std::complex const& in2) { + return R (in1) - in2; } template typename boost::enable_if< - mpl::and_< - boost::is_float, - boost::is_integral - >, - std::complex >::type inline operator- (std::complex const& in1, I in2) { - return in1 - R (in2); + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator- (std::complex const& in1, I in2) { + return in1 - R (in2); } template typename boost::enable_if< - mpl::and_< - boost::is_float, - boost::is_integral - >, - std::complex >::type inline operator* (I in1, std::complex const& in2) { - return R (in1) * in2; + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator* (I in1, std::complex const& in2) { + return R (in1) * in2; } template typename boost::enable_if< - mpl::and_< - boost::is_float, - boost::is_integral - >, - std::complex >::type inline operator* (std::complex const& in1, I in2) { - return in1 * R(in2); + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator* (std::complex const& in1, I in2) { + return in1 * R(in2); } template typename boost::enable_if< - mpl::and_< - boost::is_float, - boost::is_integral - >, - std::complex >::type inline operator/ (I in1, std::complex const& in2) { - return R(in1) / in2; + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator/ (I in1, std::complex const& in2) { + return R(in1) / in2; } template typename boost::enable_if< - mpl::and_< - boost::is_float, - boost::is_integral - >, - std::complex >::type inline operator/ (std::complex const& in1, I in2) { - return in1 / R (in2); + mpl::and_< + boost::is_float, + boost::is_integral + >, + std::complex >::type inline operator/ (std::complex const& in1, I in2) { + return in1 / R (in2); } @@ -641,7 +641,7 @@ namespace boost { namespace numeric { namespace ublas { */ template < class E > struct container_traits - : container_view_traits, mutable_container_traits { + : container_view_traits, mutable_container_traits { }; @@ -667,7 +667,7 @@ namespace boost { namespace numeric { namespace ublas { */ template < class MATRIX > struct mutable_matrix_traits - : mutable_container_traits { + : mutable_container_traits { /// row iterator for the matrix typedef typename MATRIX::iterator1 iterator1; @@ -682,7 +682,7 @@ namespace boost { namespace numeric { namespace ublas { */ template < class MATRIX > struct matrix_traits - : matrix_view_traits , mutable_matrix_traits { + : matrix_view_traits , mutable_matrix_traits { }; /** \brief Traits class to extract type information from a VECTOR. @@ -694,16 +694,16 @@ namespace boost { namespace numeric { namespace ublas { /// iterator for the VECTOR typedef typename VECTOR::const_iterator const_iterator; - /// iterator pointing to the first element - static - const_iterator begin(const VECTOR & v) { - return v.begin(); - } - /// iterator pointing behind the last element - static - const_iterator end(const VECTOR & v) { - return v.end(); - } + /// iterator pointing to the first element + static + const_iterator begin(const VECTOR & v) { + return v.begin(); + } + /// iterator pointing behind the last element + static + const_iterator end(const VECTOR & v) { + return v.end(); + } }; @@ -715,17 +715,17 @@ namespace boost { namespace numeric { namespace ublas { /// iterator for the VECTOR typedef typename VECTOR::iterator iterator; - /// iterator pointing to the first element - static - iterator begin(VECTOR & v) { - return v.begin(); - } + /// iterator pointing to the first element + static + iterator begin(VECTOR & v) { + return v.begin(); + } - /// iterator pointing behind the last element - static - iterator end(VECTOR & v) { - return v.end(); - } + /// iterator pointing behind the last element + static + iterator end(VECTOR & v) { + return v.end(); + } }; /** \brief Traits class to extract type information from a VECTOR. @@ -733,7 +733,7 @@ namespace boost { namespace numeric { namespace ublas { */ template < class VECTOR > struct vector_traits - : vector_view_traits , mutable_vector_traits { + : vector_view_traits , mutable_vector_traits { }; diff --git a/test/sparse_view_test.cpp b/test/sparse_view_test.cpp index f60d27db..ce4602c6 100644 --- a/test/sparse_view_test.cpp +++ b/test/sparse_view_test.cpp @@ -75,9 +75,9 @@ BOOST_AUTO_TEST_CASE( test_construction_from_pointers ) { std::cout << ( ublas::make_compressed_matrix_view(4,3,NNZ - , ublas::c_array_view(4,&(IA[0])) - , ublas::c_array_view(6,&(JA[0])) - , ublas::c_array_view(6,&(VA[0]))) ) << std::endl; + , ublas::c_array_view(4,&(IA[0])) + , ublas::c_array_view(6,&(JA[0])) + , ublas::c_array_view(6,&(VA[0]))) ) << std::endl; unsigned int * ia = new unsigned int[4](); unsigned int * ja = new unsigned int[6](); @@ -94,9 +94,9 @@ BOOST_AUTO_TEST_CASE( test_construction_from_pointers ) , ublas::c_array_view > COMPMATVIEW; COMPMATVIEW viewA(4,3,NNZ - , ublas::c_array_view(4,ia) - , ublas::c_array_view(6,ja) - , ublas::c_array_view(6,va)); + , ublas::c_array_view(4,ia) + , ublas::c_array_view(6,ja) + , ublas::c_array_view(6,va)); std::cout << viewA << std::endl; diff --git a/test/utils.hpp b/test/utils.hpp index d0a0c2a4..c0526ce8 100644 --- a/test/utils.hpp +++ b/test/utils.hpp @@ -14,9 +14,9 @@ #define JOIN_(x,y) x ## y #ifndef NDEBUG -# define BOOST_UBLAS_DEBUG_TRACE(x) std::cerr << "[Debug>> " << EXPAND_(x) << std::endl +# define BOOST_UBLAS_DEBUG_TRACE(x) std::cerr << "[Debug>> " << EXPAND_(x) << std::endl #else -# define BOOST_UBLAS_DEBUG_TRACE(x) /**/ +# define BOOST_UBLAS_DEBUG_TRACE(x) /**/ #endif // NDEBUG #define BOOST_UBLAS_TEST_BEGIN() unsigned int test_fails_(0)