$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r51765 - in trunk/boost/numeric/ublas: . detail
From: guwi17_at_[hidden]
Date: 2009-03-13 17:10:05
Author: guwi17
Date: 2009-03-13 17:10:04 EDT (Fri, 13 Mar 2009)
New Revision: 51765
URL: http://svn.boost.org/trac/boost/changeset/51765
Log:
fwd.hpp:
* default arguments for generalized_vector_of_vector
expression_types.hpp:
* added self_type to matrix_expression
detail/concepts.hpp:
* added documentation and missing concept checks to scalar expression and vector expression
traits.hpp:
* added container_traits
* added vector_traits
* added matrix_traits
Text files modified: 
   trunk/boost/numeric/ublas/detail/concepts.hpp  |    27 +++++++++++++                           
   trunk/boost/numeric/ublas/expression_types.hpp |     2                                         
   trunk/boost/numeric/ublas/fwd.hpp              |     3 +                                       
   trunk/boost/numeric/ublas/traits.hpp           |    83 ++++++++++++++++++++++++++++++++++++++++
   4 files changed, 115 insertions(+), 0 deletions(-)
Modified: trunk/boost/numeric/ublas/detail/concepts.hpp
==============================================================================
--- trunk/boost/numeric/ublas/detail/concepts.hpp	(original)
+++ trunk/boost/numeric/ublas/detail/concepts.hpp	2009-03-13 17:10:04 EDT (Fri, 13 Mar 2009)
@@ -237,11 +237,22 @@
         }
     };
 
+    /** \brief Scalar expression concept.
+     *
+     * requirements
+     * \li \c SE::value_type is the type of the scalar expression
+     * \li \c SE must be convertable to \c SE::value_type
+     * \li the constant \c SE::complexity must exist
+     *
+     * \param SE the type of the scalar expression
+     */
     template<class SE>
     struct ScalarExpressionConcept {
         typedef SE scalar_expression_type;
         typedef typename SE::value_type value_type;
 
+        static const unsigned complexity = SE::complexity;
+
         void constraints () {
             scalar_expression_type *sp;
             scalar_expression_type s = *sp;
@@ -252,12 +263,28 @@
         }
     };
 
+    /** \brief Vector expression concept.
+     *
+     * requirements
+     * \li \c VE::value_type is the type of the elements
+     * \li \c VE::const_reference The return type when accessing an element of a constant vector 
+     * expression. Must be convertable to a \c value_type.
+     * \li \c VE::size_type is the (unsigned) type of the indices
+     * \li \c VE::difference_type is the (signed) type of distances between indices
+     * \li \c VE::category
+     * 
+     * \li the constant \c SE::complexity must exist
+     *
+     * \param SE the type of the scalar expression
+     */
     template<class VE>
     struct VectorExpressionConcept {
         typedef VE vector_expression_type;
         typedef typename VE::type_category type_category;
         typedef typename VE::size_type size_type;
+        typedef typename VE::difference_type size_type;
         typedef typename VE::value_type value_type;
+        typedef typename VE::const_reference const_reference;
         typedef typename VE::const_iterator const_iterator_type;
         typedef typename VE::const_reverse_iterator const_reverse_iterator_type;
 
Modified: trunk/boost/numeric/ublas/expression_types.hpp
==============================================================================
--- trunk/boost/numeric/ublas/expression_types.hpp	(original)
+++ trunk/boost/numeric/ublas/expression_types.hpp	2009-03-13 17:10:04 EDT (Fri, 13 Mar 2009)
@@ -291,6 +291,8 @@
     template<class E>
     class matrix_expression:
         public ublas_expression<E> {
+    private:
+        typedef matrix_expression<E> self_type;
     public:
         static const unsigned complexity = 0;
         typedef E expression_type;
Modified: trunk/boost/numeric/ublas/fwd.hpp
==============================================================================
--- trunk/boost/numeric/ublas/fwd.hpp	(original)
+++ trunk/boost/numeric/ublas/fwd.hpp	2009-03-13 17:10:04 EDT (Fri, 13 Mar 2009)
@@ -139,6 +139,9 @@
     template<class T, class L = row_major, class A = unbounded_array<unbounded_array<T> > >
     class vector_of_vector;
 
+    template<class T, class L = row_major, class A = vector<compressed_vector<T> > >
+    class generalized_vector_of_vector;
+
     // Triangular matrix type
     struct lower_tag {};
     struct upper_tag {};
Modified: trunk/boost/numeric/ublas/traits.hpp
==============================================================================
--- trunk/boost/numeric/ublas/traits.hpp	(original)
+++ trunk/boost/numeric/ublas/traits.hpp	2009-03-13 17:10:04 EDT (Fri, 13 Mar 2009)
@@ -511,6 +511,89 @@
 
     }
 
+
+    /**  \brief Traits class to extract type information from a matrix or vector CONTAINER.
+     *
+     */
+    template < class E >
+    struct container_traits {
+        /// type of indices
+        typedef typename E::size_type             size_type;
+        /// type of differences of indices
+        typedef typename E::difference_type       difference_type;
+
+        /// storage category: \c unknown_storage_tag, \c dense_tag, \c packed_tag, ...
+        typedef typename E::storage_category      storage_category;
+
+        /// 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.
+     *
+     */
+    template < class MATRIX >
+    struct matrix_traits : container_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;
+  
+    };
+
+    /**  \brief Traits class to extract type information from a VECTOR.
+     *
+     */
+    template < class VECTOR >
+    struct vector_traits : container_traits <VECTOR> {
+
+    };
+
+    template < class T, int M, int N > 
+    struct matrix_traits < T[M][N] > {
+        typedef T              matrix_type[M][N];
+
+        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;
+    };
+
+    template < class T, int N  > 
+    struct vector_traits < T[N] > {
+        typedef T              vector_type[N];
+
+        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;
+    };
+
 }}}
 
 #endif