|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56624 - in branches/release: boost/numeric/ublas boost/numeric/ublas/detail boost/numeric/ublas/experimental boost/numeric/ublas/operation boost/numeric/ublas/traits libs/numeric/ublas libs/numeric/ublas/test
From: guwi17_at_[hidden]
Date: 2009-10-06 19:13:47
Author: guwi17
Date: 2009-10-06 19:13:46 EDT (Tue, 06 Oct 2009)
New Revision: 56624
URL: http://svn.boost.org/trac/boost/changeset/56624
Log:
see #3396 (view concepts), see #3449 (new free functions)
* merged [51765],[56003],[56600],[56602],[56621] into release
* added new free functions to simplify learning uBLAS
Added:
branches/release/boost/numeric/ublas/experimental/
- copied from r56003, /trunk/boost/numeric/ublas/experimental/
branches/release/boost/numeric/ublas/experimental/sparse_view.hpp
- copied unchanged from r56003, /trunk/boost/numeric/ublas/experimental/sparse_view.hpp
branches/release/boost/numeric/ublas/operation/
- copied from r56602, /trunk/boost/numeric/ublas/operation/
branches/release/boost/numeric/ublas/operation/begin.hpp
- copied unchanged from r56602, /trunk/boost/numeric/ublas/operation/begin.hpp
branches/release/boost/numeric/ublas/operation/c_array.hpp
- copied unchanged from r56602, /trunk/boost/numeric/ublas/operation/c_array.hpp
branches/release/boost/numeric/ublas/operation/end.hpp
- copied unchanged from r56602, /trunk/boost/numeric/ublas/operation/end.hpp
branches/release/boost/numeric/ublas/operation/num_columns.hpp
- copied unchanged from r56602, /trunk/boost/numeric/ublas/operation/num_columns.hpp
branches/release/boost/numeric/ublas/operation/num_rows.hpp
- copied unchanged from r56602, /trunk/boost/numeric/ublas/operation/num_rows.hpp
branches/release/boost/numeric/ublas/operation/size.hpp
- copied unchanged from r56602, /trunk/boost/numeric/ublas/operation/size.hpp
branches/release/boost/numeric/ublas/operations.hpp
- copied unchanged from r56602, /trunk/boost/numeric/ublas/operations.hpp
branches/release/boost/numeric/ublas/tags.hpp
- copied unchanged from r56602, /trunk/boost/numeric/ublas/tags.hpp
branches/release/boost/numeric/ublas/traits/
- copied from r56600, /trunk/boost/numeric/ublas/traits/
branches/release/boost/numeric/ublas/traits/c_array.hpp
- copied unchanged from r56600, /trunk/boost/numeric/ublas/traits/c_array.hpp
branches/release/boost/numeric/ublas/traits/const_iterator_type.hpp
- copied unchanged from r56602, /trunk/boost/numeric/ublas/traits/const_iterator_type.hpp
branches/release/boost/numeric/ublas/traits/iterator_type.hpp
- copied unchanged from r56602, /trunk/boost/numeric/ublas/traits/iterator_type.hpp
branches/release/libs/numeric/ublas/test/begin_end.cpp
- copied, changed from r56602, /trunk/libs/numeric/ublas/test/begin_end.cpp
branches/release/libs/numeric/ublas/test/num_columns.cpp
- copied unchanged from r56602, /trunk/libs/numeric/ublas/test/num_columns.cpp
branches/release/libs/numeric/ublas/test/num_rows.cpp
- copied unchanged from r56602, /trunk/libs/numeric/ublas/test/num_rows.cpp
branches/release/libs/numeric/ublas/test/size.cpp
- copied unchanged from r56602, /trunk/libs/numeric/ublas/test/size.cpp
branches/release/libs/numeric/ublas/test/utils.hpp
- copied unchanged from r56602, /trunk/libs/numeric/ublas/test/utils.hpp
Properties modified:
branches/release/boost/numeric/ublas/ (props changed)
branches/release/libs/numeric/ublas/ (props changed)
Text files modified:
branches/release/boost/numeric/ublas/detail/concepts.hpp | 7 +
branches/release/boost/numeric/ublas/traits.hpp | 135 ++++++++++++++++++++++++++++-----------
branches/release/libs/numeric/ublas/test/begin_end.cpp | 3
3 files changed, 103 insertions(+), 42 deletions(-)
Modified: branches/release/boost/numeric/ublas/detail/concepts.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/detail/concepts.hpp (original)
+++ branches/release/boost/numeric/ublas/detail/concepts.hpp 2009-10-06 19:13:46 EDT (Tue, 06 Oct 2009)
@@ -921,6 +921,9 @@
#define INTERNAL_EXPRESSION
#endif
+ // TODO enable this for development
+ // #define VIEW_CONCEPTS
+
// Element value type for tests
typedef float T;
@@ -992,8 +995,8 @@
}
#endif
-#if defined (VECTOR_VIEW)
- // read only vectors
+#ifdef VIEW_CONCEPTS
+ // read only vectors
{
typedef vector_view<T> container_model;
function_requires< RandomAccessContainerConcept<container_model> >();
Modified: branches/release/boost/numeric/ublas/traits.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/traits.hpp (original)
+++ branches/release/boost/numeric/ublas/traits.hpp 2009-10-06 19:13:46 EDT (Tue, 06 Oct 2009)
@@ -512,11 +512,11 @@
}
- /** \brief Traits class to extract type information from a matrix or vector CONTAINER.
+ /** \brief Traits class to extract type information from a constant matrix or vector CONTAINER.
*
*/
template < class E >
- struct container_traits {
+ struct container_view_traits {
/// type of indices
typedef typename E::size_type size_type;
/// type of differences of indices
@@ -527,72 +527,127 @@
/// type of elements
typedef typename E::value_type value_type;
- /// reference to an element
- typedef typename E::reference reference;
/// const reference to an element
typedef typename E::const_reference const_reference;
- /// type used in expressions to mark a reference to this class (usually a container_reference<E> or the class itself)
- typedef typename E::closure_type closure_type;
/// type used in expressions to mark a reference to this class (usually a const container_reference<const E> or the class itself)
typedef typename E::const_closure_type const_closure_type;
};
- /** \brief Traits class to extract type information from a MATRIX.
+ /** \brief Traits class to extract additional type information from a mutable matrix or vector CONTAINER.
+ *
+ */
+ template < class E >
+ struct mutable_container_traits {
+ /// reference to an element
+ typedef typename E::reference reference;
+
+ /// type used in expressions to mark a reference to this class (usually a container_reference<E> or the class itself)
+ typedef typename E::closure_type closure_type;
+ };
+
+ /** \brief Traits class to extract type information from a matrix or vector CONTAINER.
+ *
+ */
+ template < class E >
+ struct container_traits
+ : container_view_traits<E>, mutable_container_traits<E> {
+
+ };
+
+
+ /** \brief Traits class to extract type information from a constant MATRIX.
*
*/
template < class MATRIX >
- struct matrix_traits : container_traits <MATRIX> {
+ struct matrix_view_traits : container_view_traits <MATRIX> {
/// orientation of the matrix, either \c row_major_tag, \c column_major_tag or \c unknown_orientation_tag
typedef typename MATRIX::orientation_category orientation_category;
+ /// row iterator for the matrix
+ typedef typename MATRIX::const_iterator1 const_iterator1;
+
+ /// column iterator for the matrix
+ typedef typename MATRIX::const_iterator2 const_iterator2;
+ };
+
+ /** \brief Traits class to extract additional type information from a mutable MATRIX.
+ *
+ */
+ template < class MATRIX >
+ struct mutable_matrix_traits
+ : mutable_container_traits <MATRIX> {
+
+ /// row iterator for the matrix
+ typedef typename MATRIX::iterator1 iterator1;
+
+ /// column iterator for the matrix
+ typedef typename MATRIX::iterator2 iterator2;
+ };
+
+
+ /** \brief Traits class to extract type information from a MATRIX.
+ *
+ */
+ template < class MATRIX >
+ struct matrix_traits
+ : matrix_view_traits <MATRIX>, mutable_matrix_traits <MATRIX> {
};
/** \brief Traits class to extract type information from a VECTOR.
*
*/
template < class VECTOR >
- struct vector_traits : container_traits <VECTOR> {
+ struct vector_view_traits : container_view_traits <VECTOR> {
- };
+ /// iterator for the VECTOR
+ typedef typename VECTOR::const_iterator const_iterator;
- template < class T, int M, int N >
- struct matrix_traits < T[M][N] > {
- typedef T matrix_type[M][N];
+ /// 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();
+ }
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ };
- typedef row_major_tag orientation_category;
- typedef dense_tag storage_category;
-
- typedef T value_type;
- typedef T *reference;
- typedef const T *const_reference;
-
- // \todo { define correct wrapper }
- typedef matrix_reference<matrix_type> closure_type;
- typedef const matrix_reference<const matrix_type> const_closure_type;
+ /** \brief Traits class to extract type information from a VECTOR.
+ *
+ */
+ template < class VECTOR >
+ struct mutable_vector_traits : mutable_container_traits <VECTOR> {
+ /// 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 behind the last element
+ static
+ iterator end(VECTOR & v) {
+ return v.end();
+ }
};
- template < class T, int N >
- struct vector_traits < T[N] > {
- typedef T vector_type[N];
+ /** \brief Traits class to extract type information from a VECTOR.
+ *
+ */
+ template < class VECTOR >
+ struct vector_traits
+ : vector_view_traits <VECTOR>, mutable_vector_traits <VECTOR> {
+ };
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef dense_tag storage_category;
-
- typedef T value_type;
- typedef T *reference;
- typedef const T *const_reference;
-
- // \todo { define correct wrapper }
- typedef vector_reference<vector_type> closure_type;
- typedef const vector_reference<const vector_type> const_closure_type;
- };
+ // Note: specializations for T[N] and T[M][N] have been moved to traits/c_array.hpp
}}}
Copied: branches/release/libs/numeric/ublas/test/begin_end.cpp (from r56602, /trunk/libs/numeric/ublas/test/begin_end.cpp)
==============================================================================
--- /trunk/libs/numeric/ublas/test/begin_end.cpp (original)
+++ branches/release/libs/numeric/ublas/test/begin_end.cpp 2009-10-06 19:13:46 EDT (Tue, 06 Oct 2009)
@@ -18,6 +18,9 @@
static const double TOL(1.0e-5); ///< Used for comparing two real numbers.
+#ifdef BOOST_UBLAS_NO_NESTED_CLASS_RELATION
+#error "sorry this feature is not supported by your compiler"
+#endif
BOOST_UBLAS_TEST_DEF( test_vector_iteration )
{
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