2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-21 03:22:14 +00:00

REVERSE_ITERATOR_OVERLOADS are default

Many fixes picked by INTERNAL concept checks


[SVN r24876]
This commit is contained in:
Michael Stevens
2004-09-02 17:28:58 +00:00
parent 1a895d3083
commit d92ce4367a
10 changed files with 51 additions and 144 deletions

View File

@@ -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<class M>
typename banded_adaptor<M>::const_matrix_type banded_adaptor<M>::nil_;
typename banded_adaptor<M>::matrix_type banded_adaptor<M>::nil_;
template<class M>
typename banded_adaptor<M>::const_value_type banded_adaptor<M>::zero_
#ifdef BOOST_UBLAS_STATIC_OLD_INIT

View File

@@ -1321,12 +1321,12 @@ namespace boost { namespace numeric { namespace ublas {
IndexedRandomAccess1DIteratorConcept<matrix_vector_slice<matrix<double> >::const_reverse_iterator>::constraints ();
MutableIndexedRandomAccess1DIteratorConcept<matrix_vector_slice<matrix<double> >::reverse_iterator>::constraints ();
VectorExpressionConcept<const matrix_vector_indirect<const matrix<double> > >::constraints ();
MutableVectorExpressionConcept<matrix_vector_indirect<matrix<double> > >::constraints ();
IndexedRandomAccess1DIteratorConcept<matrix_vector_indirect<matrix<double> >::const_iterator>::constraints ();
MutableIndexedRandomAccess1DIteratorConcept<matrix_vector_indirect<matrix<double> >::iterator>::constraints ();
IndexedRandomAccess1DIteratorConcept<matrix_vector_indirect<matrix<double> >::const_reverse_iterator>::constraints ();
MutableIndexedRandomAccess1DIteratorConcept<matrix_vector_indirect<matrix<double> >::reverse_iterator>::constraints ();
VectorExpressionConcept<const matrix_vector_indirect<const matrix<double>, vector<unsigned> > >::constraints ();
MutableVectorExpressionConcept<matrix_vector_indirect<matrix<double>, vector<unsigned> > >::constraints ();
IndexedRandomAccess1DIteratorConcept<matrix_vector_indirect<matrix<double>, vector<unsigned> >::const_iterator>::constraints ();
MutableIndexedRandomAccess1DIteratorConcept<matrix_vector_indirect<matrix<double>, vector<unsigned> >::iterator>::constraints ();
IndexedRandomAccess1DIteratorConcept<matrix_vector_indirect<matrix<double>, vector<unsigned> >::const_reverse_iterator>::constraints ();
MutableIndexedRandomAccess1DIteratorConcept<matrix_vector_indirect<matrix<double>, vector<unsigned> >::reverse_iterator>::constraints ();
#endif
MatrixExpressionConcept<const matrix_range<const matrix<double> > >::constraints ();
@@ -1476,6 +1476,7 @@ namespace boost { namespace numeric { namespace ublas {
MutableIndexedBidirectional2DIteratorConcept<sparse_matrix<double>::reverse_iterator1,
sparse_matrix<double>::reverse_iterator2>::constraints ();
/* FIXME - sparse_vector_of_sparse_vector broken
MatrixConcept<const sparse_vector_of_sparse_vector<double> >::constraints ();
MutableMatrixConcept<sparse_vector_of_sparse_vector<double> >::constraints ();
IndexedBidirectional2DIteratorConcept<sparse_vector_of_sparse_vector<double>::const_iterator1,
@@ -1497,6 +1498,7 @@ namespace boost { namespace numeric { namespace ublas {
compressed_matrix<double>::const_reverse_iterator2>::constraints ();
MutableIndexedBidirectional2DIteratorConcept<compressed_matrix<double>::reverse_iterator1,
compressed_matrix<double>::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<matrix_const_reference<matrix<double> > >::constraints ();
IndexedRandomAccess2DIteratorConcept<matrix_const_reference<matrix<double> >::const_iterator1,
matrix_const_reference<matrix<double> >::const_iterator2>::constraints ();
IndexedRandomAccess2DIteratorConcept<matrix_const_reference<matrix<double> >::const_reverse_iterator1,
matrix_const_reference<matrix<double> >::const_reverse_iterator2>::constraints ();
MatrixExpressionConcept<matrix_reference<matrix<double> > >::constraints ();
// MutableMatrixExpressionConcept<matrix_reference<matrix<double> > >::constraints ();
IndexedRandomAccess2DIteratorConcept<matrix_reference<matrix<double> >::const_iterator1,

View File

@@ -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

View File

@@ -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<self_type> (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<self_type> (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<class M, class F>
typename hermitian_adaptor<M, F>::const_matrix_type hermitian_adaptor<M, F>::nil_;
typename hermitian_adaptor<M, F>::matrix_type hermitian_adaptor<M, F>::nil_;
template<class M, class F>
typename hermitian_adaptor<M, F>::value_type hermitian_adaptor<M, F>::conj_;

View File

@@ -804,7 +804,7 @@ namespace boost { namespace numeric { namespace ublas {
reverse_iterator_base (const iterator_type &it):
std::reverse_iterator<iterator_type> (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<iterator_type> (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<iterator_type> (it) {}
#ifdef BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS
#if BOOST_UBLAS_REVERSE_ITERATOR_OVERLOADS
// Arithmetic
BOOST_UBLAS_INLINE
reverse_iterator_base2 &operator ++ () {

View File

@@ -1039,9 +1039,9 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
vector_of_vector (const matrix_expression<AE> &ae):
matrix_expression<self_type> (),
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<reference, BOOST_UBLAS_TYPENAME AE::value_type> (), *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];
}
}

View File

@@ -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<self_type> (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<self_type> (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<class M, class F>
typename symmetric_adaptor<M, F>::const_matrix_type symmetric_adaptor<M, F>::nil_;
typename symmetric_adaptor<M, F>::matrix_type symmetric_adaptor<M, F>::nil_;
}}}

View File

@@ -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<class M, class F>
typename triangular_adaptor<M, F>::const_matrix_type triangular_adaptor<M, F>::nil_;
typename triangular_adaptor<M, F>::matrix_type triangular_adaptor<M, F>::nil_;
template<class M, class F>
const typename triangular_adaptor<M, F>::value_type triangular_adaptor<M, F>::zero_
#ifdef BOOST_UBLAS_STATIC_OLD_INIT

View File

@@ -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_;
}

View File

@@ -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<class T>
const typename scalar_const_reference<T>::value_type scalar_const_reference<T>::nil_;
const typename scalar_const_reference<T>::value_type scalar_const_reference<T>::nil_
= BOOST_UBLAS_TYPENAME scalar_const_reference<T>::value_type ();
@@ -194,111 +201,6 @@ namespace boost { namespace numeric { namespace ublas {
#endif
};
#ifndef BOOST_UBLAS_CT_REFERENCE_BASE_TYPEDEFS
template<class E>
class vector_const_reference:
public vector_expression<vector_const_reference<E> > {
public:
#ifndef BOOST_UBLAS_NO_PROXY_SHORTCUTS
BOOST_UBLAS_USING vector_expression<vector_const_reference<E> >::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_iterator, value_type, const_reference> const_reverse_iterator;
#else
typedef reverse_iterator_base<const_iterator> 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<const_iterator, value_type, const_reference> reverse_iterator;
#else
typedef reverse_iterator_base<const_iterator> reverse_iterator;
#endif
private:
const expression_type &e_;
static const expression_type nil_;
};
template<class E>
const typename vector_const_reference<E>::expression_type vector_const_reference<E>::nil_;
#endif
template<class E>
class vector_reference:
public vector_expression<vector_reference<E> > {
@@ -518,11 +420,11 @@ namespace boost { namespace numeric { namespace ublas {
private:
expression_type &e_;
const static expression_type nil_;
static expression_type nil_;
};
template<class E>
const typename vector_reference<E>::expression_type vector_reference<E>::nil_;
typename vector_reference<E>::expression_type vector_reference<E>::nil_;
template<class E, class F>
class vector_unary: