diff --git a/include/boost/numeric/ublas/banded.hpp b/include/boost/numeric/ublas/banded.hpp index a7d45354..1892364c 100644 --- a/include/boost/numeric/ublas/banded.hpp +++ b/include/boost/numeric/ublas/banded.hpp @@ -2030,13 +2030,13 @@ namespace boost { namespace numeric { namespace ublas { matrix_closure_type data_; size_type lower_; size_type upper_; - static const_matrix_type nil_; + static matrix_type nil_; typedef const value_type const_value_type; static const_value_type zero_; }; template - typename banded_adaptor::const_matrix_type banded_adaptor::nil_; + typename banded_adaptor::matrix_type banded_adaptor::nil_; template typename banded_adaptor::const_value_type banded_adaptor::zero_ #ifdef BOOST_UBLAS_STATIC_OLD_INIT diff --git a/include/boost/numeric/ublas/concepts.hpp b/include/boost/numeric/ublas/concepts.hpp index e4d55b22..039bf838 100644 --- a/include/boost/numeric/ublas/concepts.hpp +++ b/include/boost/numeric/ublas/concepts.hpp @@ -1321,12 +1321,12 @@ namespace boost { namespace numeric { namespace ublas { IndexedRandomAccess1DIteratorConcept >::const_reverse_iterator>::constraints (); MutableIndexedRandomAccess1DIteratorConcept >::reverse_iterator>::constraints (); - VectorExpressionConcept > >::constraints (); - MutableVectorExpressionConcept > >::constraints (); - IndexedRandomAccess1DIteratorConcept >::const_iterator>::constraints (); - MutableIndexedRandomAccess1DIteratorConcept >::iterator>::constraints (); - IndexedRandomAccess1DIteratorConcept >::const_reverse_iterator>::constraints (); - MutableIndexedRandomAccess1DIteratorConcept >::reverse_iterator>::constraints (); + VectorExpressionConcept, vector > >::constraints (); + MutableVectorExpressionConcept, vector > >::constraints (); + IndexedRandomAccess1DIteratorConcept, vector >::const_iterator>::constraints (); + MutableIndexedRandomAccess1DIteratorConcept, vector >::iterator>::constraints (); + IndexedRandomAccess1DIteratorConcept, vector >::const_reverse_iterator>::constraints (); + MutableIndexedRandomAccess1DIteratorConcept, vector >::reverse_iterator>::constraints (); #endif MatrixExpressionConcept > >::constraints (); @@ -1476,6 +1476,7 @@ namespace boost { namespace numeric { namespace ublas { MutableIndexedBidirectional2DIteratorConcept::reverse_iterator1, sparse_matrix::reverse_iterator2>::constraints (); +/* FIXME - sparse_vector_of_sparse_vector broken MatrixConcept >::constraints (); MutableMatrixConcept >::constraints (); IndexedBidirectional2DIteratorConcept::const_iterator1, @@ -1497,6 +1498,7 @@ namespace boost { namespace numeric { namespace ublas { compressed_matrix::const_reverse_iterator2>::constraints (); MutableIndexedBidirectional2DIteratorConcept::reverse_iterator1, compressed_matrix::reverse_iterator2>::constraints (); +*/ #endif // Scalar Expressions @@ -1544,12 +1546,6 @@ namespace boost { namespace numeric { namespace ublas { // Matrix Expressions #if defined (INTERNAL) || defined (INTERNAL_MATRIX_EXPRESSION) - MatrixExpressionConcept > >::constraints (); - IndexedRandomAccess2DIteratorConcept >::const_iterator1, - matrix_const_reference >::const_iterator2>::constraints (); - IndexedRandomAccess2DIteratorConcept >::const_reverse_iterator1, - matrix_const_reference >::const_reverse_iterator2>::constraints (); - MatrixExpressionConcept > >::constraints (); // MutableMatrixExpressionConcept > >::constraints (); IndexedRandomAccess2DIteratorConcept >::const_iterator1, diff --git a/include/boost/numeric/ublas/config.hpp b/include/boost/numeric/ublas/config.hpp index b093a731..ba117c80 100644 --- a/include/boost/numeric/ublas/config.hpp +++ b/include/boost/numeric/ublas/config.hpp @@ -107,8 +107,6 @@ #if defined (__GNUC__) && ! defined (BOOST_STRICT_CONFIG) #if __GNUC__ <= 2 && __GNUC_MINOR__ <= 95 -// GCC 2.95.3 needs BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS (this seems to be arguable). -#define BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS #define BOOST_UBLAS_NO_MEMBER_FRIENDS #define BOOST_UBLAS_NO_PROXY_SHORTCUTS // Cannot access private members from member class @@ -200,6 +198,7 @@ namespace std { #endif + // Default configuration without compiler problems #ifndef BOOST_UBLAS_TYPENAME #define BOOST_UBLAS_TYPENAME typename @@ -208,9 +207,12 @@ namespace std { #define BOOST_UBLAS_USING using #endif +#ifndef BOOST_UBLAS_USE_BASIC_STREAM +#define BOOST_UBLAS_USE_BASIC_STREAM +#endif -#ifndef BOOST_UBLAS_USE_STREAM -#define BOOST_UBLAS_USE_STREAM +#ifndef BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS +#define BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS 1 #endif diff --git a/include/boost/numeric/ublas/hermitian.hpp b/include/boost/numeric/ublas/hermitian.hpp index 97695a15..02399b9f 100644 --- a/include/boost/numeric/ublas/hermitian.hpp +++ b/include/boost/numeric/ublas/hermitian.hpp @@ -1640,6 +1640,8 @@ namespace boost { namespace numeric { namespace ublas { (current_ == 0 && it1_ != it1_end_) || (current_ == 1 && it2_ != it2_end_), internal_logic ()); } + // FIXME cannot compiler + // iterator1 does not have these members! BOOST_UBLAS_INLINE const_iterator1 (const iterator1 &it): container_const_reference (it ()), @@ -2097,6 +2099,8 @@ namespace boost { namespace numeric { namespace ublas { (current_ == 0 && it1_ != it1_end_) || (current_ == 1 && it2_ != it2_end_), internal_logic ()); } + // FIXME cannot compiler + // iterator2 does not have these members! BOOST_UBLAS_INLINE const_iterator2 (const iterator2 &it): container_const_reference (it ()), @@ -2543,12 +2547,12 @@ namespace boost { namespace numeric { namespace ublas { private: matrix_closure_type data_; - static const_matrix_type nil_; + static matrix_type nil_; static value_type conj_; }; template - typename hermitian_adaptor::const_matrix_type hermitian_adaptor::nil_; + typename hermitian_adaptor::matrix_type hermitian_adaptor::nil_; template typename hermitian_adaptor::value_type hermitian_adaptor::conj_; diff --git a/include/boost/numeric/ublas/iterator.hpp b/include/boost/numeric/ublas/iterator.hpp index cc9d83a1..7c596dea 100644 --- a/include/boost/numeric/ublas/iterator.hpp +++ b/include/boost/numeric/ublas/iterator.hpp @@ -804,7 +804,7 @@ namespace boost { namespace numeric { namespace ublas { reverse_iterator_base (const iterator_type &it): std::reverse_iterator (it) {} -#ifdef BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS +#if BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS // Arithmetic BOOST_UBLAS_INLINE reverse_iterator_base &operator ++ () { @@ -866,7 +866,6 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE const container_type &operator () () const { - // Comeau recommends... return this->base () (); } @@ -938,7 +937,7 @@ namespace boost { namespace numeric { namespace ublas { reverse_iterator_base1 (const iterator_type &it): std::reverse_iterator (it) {} -#ifdef BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS +#if BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS // Arithmetic BOOST_UBLAS_INLINE reverse_iterator_base1 &operator ++ () { @@ -1101,7 +1100,7 @@ namespace boost { namespace numeric { namespace ublas { reverse_iterator_base2 (const iterator_type &it): std::reverse_iterator (it) {} -#ifdef BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS +#if BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS // Arithmetic BOOST_UBLAS_INLINE reverse_iterator_base2 &operator ++ () { diff --git a/include/boost/numeric/ublas/matrix.hpp b/include/boost/numeric/ublas/matrix.hpp index 28db4c81..4b688b81 100644 --- a/include/boost/numeric/ublas/matrix.hpp +++ b/include/boost/numeric/ublas/matrix.hpp @@ -1039,9 +1039,9 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE vector_of_vector (const matrix_expression &ae): matrix_expression (), - size1_ (ae ().size1 ()), size2_ (ae ().size2 ()), data_ (functor_type::size1 (size1, size2) + 1) { - for (size_type k = 0; k < functor_type::size1 (size1, size2); ++ k) - detail::resize (data () [k], functor_type::size2 (size1, size2), false); + size1_ (ae ().size1 ()), size2_ (ae ().size2 ()), data_ (functor_type::size1 (size1_, size2_) + 1) { + for (size_type k = 0; k < functor_type::size1 (size1_, size2_); ++ k) + detail::resize (data () [k], functor_type::size2 (size1_, size2_), false); matrix_assign (scalar_assign (), *this, ae); } @@ -3420,7 +3420,7 @@ namespace boost { namespace numeric { namespace ublas { const size_type size1_min = (std::min) (size1, size1_); const size_type size2_min = (std::min) (size2, size2_); for (size_type i = 0; i != size1_min; ++i) { // indexing copy over major - for (size_type j = 0; j != size1_min; ++j) { + for (size_type j = 0; j != size2_min; ++j) { temporary.data_[i][j] = data_[i][j]; } } diff --git a/include/boost/numeric/ublas/symmetric.hpp b/include/boost/numeric/ublas/symmetric.hpp index 837aa928..8493ea5e 100644 --- a/include/boost/numeric/ublas/symmetric.hpp +++ b/include/boost/numeric/ublas/symmetric.hpp @@ -279,13 +279,12 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_CHECK (i < size_, bad_index ()); BOOST_UBLAS_CHECK (j < size_, bad_index ()); if (functor1_type::other (i, j)) { - size_type k = functor1_type::element (functor2_type (), i, size_, j, size_); + // size_type k = functor1_type::element (functor2_type (), i, size_, j, size_); // data ().erase (data ().begin () + k)); data () [functor1_type::element (functor2_type (), i, size_, j, size_)] = value_type (); } else { - size_type k = functor1_type::element (functor2_type (), j, size_, i, size_); // data ().erase (data ().begin () + k); - data () [k] = value_type (); + data () [functor1_type::element (functor2_type (), j, size_, i, size_)] = value_type (); } } BOOST_UBLAS_INLINE @@ -1289,6 +1288,8 @@ namespace boost { namespace numeric { namespace ublas { (current_ == 0 && it1_ != it1_end_) || (current_ == 1 && it2_ != it2_end_), internal_logic ()); } + // FIXME cannot compiler + // iterator1 does not have these members! BOOST_UBLAS_INLINE const_iterator1 (const iterator1 &it): container_const_reference (it ()), @@ -1736,6 +1737,8 @@ namespace boost { namespace numeric { namespace ublas { (current_ == 0 && it1_ != it1_end_) || (current_ == 1 && it2_ != it2_end_), internal_logic ()); } + // FIXME cannot compiler + // iterator2 does not have these members! BOOST_UBLAS_INLINE const_iterator2 (const iterator2 &it): container_const_reference (it ()), @@ -2176,11 +2179,11 @@ namespace boost { namespace numeric { namespace ublas { private: matrix_closure_type data_; - static const_matrix_type nil_; + static matrix_type nil_; }; template - typename symmetric_adaptor::const_matrix_type symmetric_adaptor::nil_; + typename symmetric_adaptor::matrix_type symmetric_adaptor::nil_; }}} diff --git a/include/boost/numeric/ublas/triangular.hpp b/include/boost/numeric/ublas/triangular.hpp index be2d61b3..bd358ac2 100644 --- a/include/boost/numeric/ublas/triangular.hpp +++ b/include/boost/numeric/ublas/triangular.hpp @@ -1843,13 +1843,13 @@ namespace boost { namespace numeric { namespace ublas { private: matrix_closure_type data_; - static const_matrix_type nil_; + static matrix_type nil_; static const value_type zero_; static const value_type one_; }; template - typename triangular_adaptor::const_matrix_type triangular_adaptor::nil_; + typename triangular_adaptor::matrix_type triangular_adaptor::nil_; template const typename triangular_adaptor::value_type triangular_adaptor::zero_ #ifdef BOOST_UBLAS_STATIC_OLD_INIT diff --git a/include/boost/numeric/ublas/vector.hpp b/include/boost/numeric/ublas/vector.hpp index 0e5f530c..f8de9574 100644 --- a/include/boost/numeric/ublas/vector.hpp +++ b/include/boost/numeric/ublas/vector.hpp @@ -1730,7 +1730,8 @@ namespace boost { namespace numeric { namespace ublas { BOOST_UBLAS_INLINE size_type index () const { BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ()); - const self_type &v = (*this) (); + // EDG won't allow const self_type it doesn't allow friend access to it_ + self_type &v = (*this) (); return it_ - v.begin ().it_; } diff --git a/include/boost/numeric/ublas/vector_expression.hpp b/include/boost/numeric/ublas/vector_expression.hpp index 4d3f19d9..444eef8b 100644 --- a/include/boost/numeric/ublas/vector_expression.hpp +++ b/include/boost/numeric/ublas/vector_expression.hpp @@ -61,6 +61,12 @@ namespace boost { namespace numeric { namespace ublas { return t_; } + // Closure comparison + BOOST_UBLAS_INLINE + bool same_closure (const scalar_value &sv) const { + return this == &sv; // shortcut for &t_ == &sv.t_ + } + private: value_type t_; }; @@ -96,7 +102,8 @@ namespace boost { namespace numeric { namespace ublas { }; template - const typename scalar_const_reference::value_type scalar_const_reference::nil_; + const typename scalar_const_reference::value_type scalar_const_reference::nil_ + = BOOST_UBLAS_TYPENAME scalar_const_reference::value_type (); @@ -194,111 +201,6 @@ namespace boost { namespace numeric { namespace ublas { #endif }; -#ifndef BOOST_UBLAS_CT_REFERENCE_BASE_TYPEDEFS - template - class vector_const_reference: - public vector_expression > { - public: -#ifndef BOOST_UBLAS_NO_PROXY_SHORTCUTS - BOOST_UBLAS_USING vector_expression >::operator (); -#endif - typedef E expression_type; - typedef typename E::size_type size_type; - typedef typename E::difference_type difference_type; - typedef typename E::value_type value_type; - typedef typename E::const_reference const_reference; - typedef const_reference reference; - typedef typename E::storage_category storage_category; - typedef typename E::simd_category simd_category; - - // Construction and destruction - BOOST_UBLAS_INLINE - vector_const_reference (): - e_ (nil_) {} - BOOST_UBLAS_INLINE - vector_const_reference (const expression_type &e): - e_ (e) {} - - // Accessors - BOOST_UBLAS_INLINE - size_type size () const { - return e_.size (); - } - BOOST_UBLAS_INLINE - const expression_type &expression () const { - return e_; - } - - // Element access - BOOST_UBLAS_INLINE - const_reference operator () (size_type i) const { - return expression () (i); - } - - BOOST_UBLAS_INLINE - const_reference operator [] (size_type i) const { - return expression () [i]; - } - - // Closure comparison - BOOST_UBLAS_INLINE - bool same_closure (const vector_const_reference &vr) const { - return &(*this).e_ == &vr.e_; - } - - // Element lookup - BOOST_UBLAS_INLINE - const_iterator find (size_type i) const { - return expression ().find (i); - } - - // Iterator types - typedef typename E::const_iterator const_iterator; - typedef const_iterator iterator; - - // Iterator is the iterator of the referenced expression. - - BOOST_UBLAS_INLINE - const_iterator begin () const { - return expression ().begin (); - } - BOOST_UBLAS_INLINE - const_iterator end () const { - return expression ().end (); - } - - // Reverse iterator - -#ifdef BOOST_MSVC_STD_ITERATOR - typedef reverse_iterator_base const_reverse_iterator; -#else - typedef reverse_iterator_base const_reverse_iterator; -#endif - - BOOST_UBLAS_INLINE - const_reverse_iterator rbegin () const { - return const_reverse_iterator (end ()); - } - BOOST_UBLAS_INLINE - const_reverse_iterator rend () const { - return const_reverse_iterator (begin ()); - } - -#ifdef BOOST_MSVC_STD_ITERATOR - typedef reverse_iterator_base reverse_iterator; -#else - typedef reverse_iterator_base reverse_iterator; -#endif - - private: - const expression_type &e_; - static const expression_type nil_; - }; - - template - const typename vector_const_reference::expression_type vector_const_reference::nil_; -#endif - template class vector_reference: public vector_expression > { @@ -518,11 +420,11 @@ namespace boost { namespace numeric { namespace ublas { private: expression_type &e_; - const static expression_type nil_; + static expression_type nil_; }; template - const typename vector_reference::expression_type vector_reference::nil_; + typename vector_reference::expression_type vector_reference::nil_; template class vector_unary: