$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r57872 - in sandbox/numeric_bindings/boost/numeric/bindings: . detail std tnt ublas ublas/detail
From: rutger_at_[hidden]
Date: 2009-11-23 13:43:26
Author: rutger
Date: 2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
New Revision: 57872
URL: http://svn.boost.org/trac/boost/changeset/57872
Log:
sync of work on new traits system for numeric_bindings
Added:
   sandbox/numeric_bindings/boost/numeric/bindings/begin.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/detail/adaptable_type.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/detail/copy_const.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/detail/dense_iterator.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/detail/tag.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/end.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/identity.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/io.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/tnt/
   sandbox/numeric_bindings/boost/numeric/bindings/tnt/tnt_array1d.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/detail/
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/detail/to_bindings_tag.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/symmetric.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/triangular.hpp   (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_sparse.hpp   (contents, props changed)
Removed:
   sandbox/numeric_bindings/boost/numeric/bindings/detail/dense.hpp
   sandbox/numeric_bindings/boost/numeric/bindings/matrix.hpp
   sandbox/numeric_bindings/boost/numeric/bindings/vector.hpp
Text files modified: 
   sandbox/numeric_bindings/boost/numeric/bindings/detail/adaptor.hpp |    27 ++++++++++++++++++++--                  
   sandbox/numeric_bindings/boost/numeric/bindings/detail/pod.hpp     |    48 +++++++++++++++++++++++++++++---------- 
   sandbox/numeric_bindings/boost/numeric/bindings/std/valarray.hpp   |    22 +++++++++++------                       
   sandbox/numeric_bindings/boost/numeric/bindings/std/vector.hpp     |    24 ++++++++++++-------                     
   sandbox/numeric_bindings/boost/numeric/bindings/tensor_rank.hpp    |     8 +++---                                  
   sandbox/numeric_bindings/boost/numeric/bindings/tensor_size.hpp    |     6 ++--                                    
   sandbox/numeric_bindings/boost/numeric/bindings/transpose.hpp      |    40 ++++++++++----------------------        
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix.hpp   |    28 +++++++++++++++--------                 
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector.hpp   |    22 +++++++++++------                       
   sandbox/numeric_bindings/boost/numeric/bindings/value_type.hpp     |     8 +++---                                  
   10 files changed, 144 insertions(+), 89 deletions(-)
Added: sandbox/numeric_bindings/boost/numeric/bindings/begin.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/begin.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,44 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_BEGIN_HPP
+#define BOOST_NUMERIC_BINDINGS_BEGIN_HPP
+
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+#include <boost/numeric/bindings/detail/dense_iterator.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+
+namespace result_of {
+
+template< typename T >
+struct begin {
+    typedef detail::dense_iterator< typename value_type<T>::type > type;
+};
+
+}
+
+template< typename T >
+detail::dense_iterator< typename value_type<T>::type > begin( T& t ) {
+    return detail::dense_iterator< typename value_type<T>::type >(
+        detail::adaptor_access<T>::data( t ) );
+}
+
+template< typename T >
+detail::dense_iterator< typename value_type<T const>::type > begin( T const& t ) {
+    return detail::dense_iterator< typename value_type<T const>::type>(
+        detail::adaptor_access<T const>::data( t ) );
+}
+
+} // bindings
+} // numeric
+} // boost
+
+#endif
Added: sandbox/numeric_bindings/boost/numeric/bindings/detail/adaptable_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/detail/adaptable_type.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,44 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_ADAPTABLE_TYPE_HPP
+#define BOOST_NUMERIC_BINDINGS_DETAIL_ADAPTABLE_TYPE_HPP
+
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename Derived >
+struct adaptable_type {
+
+    inline
+    Derived& derived() {
+        return *static_cast<Derived*>(this);
+    }
+
+    inline
+    Derived const& derived() const {
+        return *static_cast<Derived const*>(this);
+    }
+
+};
+
+
+} // detail
+} // bindings
+} // numeric
+} // boost
+
+template< typename T >
+std::ostream& operator<<( std::ostream& os,
+    boost::numeric::bindings::detail::adaptable_type<T> const& object );
+
+#endif
Modified: sandbox/numeric_bindings/boost/numeric/bindings/detail/adaptor.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/detail/adaptor.hpp	(original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/detail/adaptor.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -11,7 +11,12 @@
 
 #include <boost/utility/enable_if.hpp>
 #include <boost/numeric/bindings/is_numeric.hpp>
+#include <boost/numeric/bindings/detail/tag.hpp>
+#include <boost/numeric/bindings/detail/copy_const.hpp>
 #include <boost/type_traits/remove_const.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/has_key.hpp>
 
 namespace boost {
 namespace numeric {
@@ -19,17 +24,33 @@
 namespace detail {
 
 template< typename T, typename Id, typename Enable = void >
-struct adaptor {};
+struct adaptor {
+    typedef mpl::map<
+        mpl::pair< tag::value_type, void >
+    > property_map;
+};
 
 template< typename T, typename Enable = void >
 struct adaptor_access {};
 
 template< typename T >
+struct is_adaptable: is_numeric< typename mpl::at<
+        typename adaptor< typename boost::remove_const<T>::type, T >::property_map,
+        tag::value_type >::type > {};
+
+template< typename T >
 struct adaptor_access< T,
-        typename boost::enable_if< is_numeric< typename adaptor< 
-                typename boost::remove_const<T>::type, T >::value_type > >::type >:
+        typename boost::enable_if< is_adaptable<T> >::type >:
     adaptor< typename boost::remove_const<T>::type, T > {};
 
+template< typename T, typename Key >
+struct property_has_key: mpl::has_key< typename adaptor_access<T>::property_map, Key > {};
+
+template< typename T, typename Key >
+struct property_at {
+    typedef typename mpl::at< typename adaptor_access<T>::property_map, Key >::type type;
+};
+
 } // detail
 } // bindings
 } // numeric
Added: sandbox/numeric_bindings/boost/numeric/bindings/detail/copy_const.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/detail/copy_const.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,32 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_COPY_CONST_HPP
+#define BOOST_NUMERIC_BINDINGS_DETAIL_COPY_CONST_HPP
+
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/add_const.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename Source, typename Target >
+struct copy_const {
+    typedef typename mpl::if_< is_const<Source>,
+        typename add_const<Target>::type, Target >::type type;
+};
+
+} // detail
+} // bindings
+} // numeric
+} // boost
+
+#endif
Deleted: sandbox/numeric_bindings/boost/numeric/bindings/detail/dense.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/detail/dense.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
+++ (empty file)
@@ -1,31 +0,0 @@
-//
-// Copyright (c) 2009 Rutger ter Borg
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_DENSE_HPP
-#define BOOST_NUMERIC_BINDINGS_DETAIL_DENSE_HPP
-
-#include <boost/mpl/int.hpp>
-
-namespace boost {
-namespace numeric {
-namespace bindings {
-namespace detail {
-
-// Storage layout tags
-struct dense_tag {};
-
-// Dense stuff
-struct column_major_tag {};
-struct row_major_tag {};
-
-} // detail
-} // bindings
-} // numeric
-} // boost
-
-#endif
Added: sandbox/numeric_bindings/boost/numeric/bindings/detail/dense_iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/detail/dense_iterator.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,46 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_DENSE_ITERATOR_HPP
+#define BOOST_NUMERIC_BINDINGS_DETAIL_DENSE_ITERATOR_HPP
+
+#include <boost/iterator/iterator_adaptor.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T >
+class dense_iterator: public boost::iterator_adaptor<
+        dense_iterator<T>,
+        T* > {
+public:
+    dense_iterator():
+        dense_iterator::iterator_adaptor_(0) {}
+
+    explicit dense_iterator( T* p ):
+        dense_iterator::iterator_adaptor_(p) {}
+
+ private:
+    friend class boost::iterator_core_access;
+
+    void increment() {
+        ++(this->base_reference());
+    }
+
+};
+
+
+} // detail
+} // bindings
+} // numeric
+} // boost
+
+#endif
+
Modified: sandbox/numeric_bindings/boost/numeric/bindings/detail/pod.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/detail/pod.hpp	(original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/detail/pod.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -20,31 +20,49 @@
 template< typename T, typename Id >
 struct adaptor< T, Id, typename boost::enable_if< is_numeric<T> >::type > {
 
-    // Generic information
-    typedef T value_type;
-    typedef boost::mpl::int_<0> tensor_rank;
+    typedef typename copy_const< Id, T >::type value_type;
+    typedef mpl::map<
+        mpl::pair< tag::value_type, value_type >,
+        mpl::pair< tag::entity, tag::scalar >
+    > property_map;
+
+    static value_type* data( Id& t ) {
+        return &t;
+    }
 
 };
 
 template< typename T, std::size_t N, typename Id >
 struct adaptor< T[N], Id, typename boost::enable_if< is_numeric<T> >::type > {
 
-    // Generic information
-    typedef T value_type;
-    typedef boost::mpl::int_<1> tensor_rank;
+    typedef typename copy_const< Id, T >::type value_type;
+    typedef mpl::map<
+        mpl::pair< tag::value_type, value_type >,
+        mpl::pair< tag::entity, tag::vector >,
+        mpl::pair< tag::data_structure, tag::linear_array >
+    > property_map;
 
     static std::ptrdiff_t size1( Id const& t ) {
         return N;
     }
 
+    static value_type* data( Id& t ) {
+        return &t[0];
+    }
+
 };
 
 template< typename T, std::size_t N, std::size_t M, typename Id >
 struct adaptor< T[N][M], Id, typename boost::enable_if< is_numeric<T> >::type > {
 
-    // Generic information
-    typedef T value_type;
-    typedef boost::mpl::int_<2> tensor_rank;
+    typedef typename copy_const< Id, T >::type value_type;
+    typedef mpl::map<
+        mpl::pair< tag::value_type, value_type >,
+        mpl::pair< tag::entity, tag::matrix >,
+        mpl::pair< tag::matrix_type, tag::general >,
+        mpl::pair< tag::data_structure, tag::linear_array >,
+        mpl::pair< tag::data_order, tag::row_major >
+    > property_map;
 
     static std::ptrdiff_t size1( Id const& t ) {
         return N;
@@ -54,11 +72,15 @@
         return M;
     }
 
+    static value_type* data( Id& t ) {
+        return &t[0][0];
+    }
+
 };
 
-} // detail
-} // bindings
-} // numeric
-} // boost
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
 
 #endif
Added: sandbox/numeric_bindings/boost/numeric/bindings/detail/tag.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/detail/tag.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,83 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_DETAIL_TAG_HPP
+#define BOOST_NUMERIC_BINDINGS_DETAIL_TAG_HPP
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+namespace tag {
+
+// key: entity
+struct value_type {};
+struct entity {};
+
+struct matrix_type {};
+struct matrix_side {};
+
+struct data_structure {};
+struct data_order {};
+struct data_side {};
+
+template< int Rank >
+struct tensor: mpl::int_< Rank > {};
+
+struct scalar: tensor<0> {};
+struct vector: tensor<1> {};
+struct matrix: tensor<2> {};
+
+
+struct linear_array {};
+struct triangular_array {};
+struct associative_array {};
+struct compressed {};
+struct coordinate {};
+
+struct structure {};
+struct general {};
+struct triangular {};
+struct symmetric {};
+
+struct num_strides {};
+
+struct row_major {};
+struct column_major {};
+
+struct upper {};
+struct lower {};
+struct unit_upper {};
+struct unit_lower {};
+
+} // tag
+
+template< typename T >
+struct to_bindings_tag {};
+
+template< typename T >
+struct erase_unit {
+    typedef T type;
+};
+
+template<>
+struct erase_unit< tag::unit_upper > {
+    typedef tag::upper type;
+};
+
+template<>
+struct erase_unit< tag::unit_lower > {
+    typedef tag::lower type;
+};
+
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif
Added: sandbox/numeric_bindings/boost/numeric/bindings/end.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/end.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,44 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_END_HPP
+#define BOOST_NUMERIC_BINDINGS_END_HPP
+
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+#include <boost/numeric/bindings/detail/dense_iterator.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+
+namespace result_of {
+
+template< typename T >
+struct end {
+    typedef detail::dense_iterator< typename value_type<T>::type > type;
+};
+
+}
+
+template< typename T >
+detail::dense_iterator< typename value_type<T>::type > end( T& t ) {
+    return detail::dense_iterator< typename value_type<T>::type >(
+        detail::adaptor_access<T>::data( t ) ) + tensor_size1( t );
+}
+
+template< typename T >
+detail::dense_iterator< typename value_type<T const>::type > end( T const& t ) {
+    return detail::dense_iterator< typename value_type<T const>::type >(
+        detail::adaptor_access<T const>::data( t ) ) + tensor_size1( t );
+}
+
+} // bindings
+} // numeric
+} // boost
+
+#endif
Added: sandbox/numeric_bindings/boost/numeric/bindings/identity.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/identity.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,68 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_IDENTITY_HPP
+#define BOOST_NUMERIC_BINDINGS_IDENTITY_HPP
+
+#include <boost/numeric/bindings/detail/adaptable_type.hpp>
+#include <boost/ref.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T >
+struct identity_wrapper:
+        adaptable_type< identity_wrapper<T> >,
+        reference_wrapper<T> {
+    identity_wrapper( T& t ): reference_wrapper<T>( t ) {}
+};
+
+template< typename T, typename Id, typename Enable >
+struct adaptor< identity_wrapper<T>, Id, Enable > {
+
+    typedef adaptor< typename boost::remove_const<T>::type, T > underlying_adaptor;
+    typedef typename underlying_adaptor::property_map property_map;
+
+    static std::ptrdiff_t size1( Id const& id ) {
+        return underlying_adaptor::size1( id.get() );
+    }
+
+    static typename mpl::at< property_map, tag::value_type >::type* data( Id& id ) {
+        return underlying_adaptor::data( id.get() );
+    }
+
+};
+
+} // namespace detail
+
+namespace result_of {
+
+template< typename T >
+struct identity {
+    typedef detail::identity_wrapper<T> type;
+};
+
+} // namespace result_of
+
+template< typename T >
+detail::identity_wrapper<T> identity( T& underlying ) {
+    return detail::identity_wrapper<T>( underlying );
+}
+
+template< typename T >
+detail::identity_wrapper<T const> identity( T const& underlying ) {
+    return detail::identity_wrapper<T const>( underlying );
+}
+
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif
Added: sandbox/numeric_bindings/boost/numeric/bindings/io.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/io.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,45 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_IO_HPP
+#define BOOST_NUMERIC_BINDINGS_IO_HPP
+
+#include <iostream>
+#include <boost/utility/enable_if.hpp>
+#include <boost/numeric/bindings/begin.hpp>
+#include <boost/numeric/bindings/end.hpp>
+#include <boost/numeric/bindings/detail/adaptable_type.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename Stream, typename T >
+Stream& pretty_print( Stream& os, T const& t ) {
+    os << "[" << vector_size(t) << "] ";
+    for( typename result_of::begin<T const>::type i = begin(t); i != end(t); ++i ) {
+        os << *i << " ";
+    }
+    return os;
+}
+
+} // detail
+} // bindings
+} // numeric
+} // boost
+
+
+template< typename T >
+std::ostream& operator<<( std::ostream& os,
+        boost::numeric::bindings::detail::adaptable_type<T> const& object ) {
+    return boost::numeric::bindings::detail::pretty_print( os, object.derived() );
+}
+
+
+#endif
Deleted: sandbox/numeric_bindings/boost/numeric/bindings/matrix.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/matrix.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
+++ (empty file)
@@ -1,15 +0,0 @@
-//
-// Copyright (c) 2009 Rutger ter Borg
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_NUMERIC_BINDINGS_MATRIX_HPP
-#define BOOST_NUMERIC_BINDINGS_MATRIX_HPP
-
-#include <boost/numeric/bindings/matrix_num_rows.hpp>
-#include <boost/numeric/bindings/matrix_num_columns.hpp>
-
-#endif
Modified: sandbox/numeric_bindings/boost/numeric/bindings/std/valarray.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/std/valarray.hpp	(original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/std/valarray.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -10,7 +10,6 @@
 #define BOOST_NUMERIC_BINDINGS_STD_VALARRAY_HPP
 
 #include <boost/numeric/bindings/detail/adaptor.hpp>
-#include <boost/numeric/bindings/detail/dense.hpp>
 #include <valarray>
 
 namespace boost {
@@ -21,19 +20,26 @@
 template< typename T, typename Id, typename Enable >
 struct adaptor< std::valarray< T >, Id, Enable > {
 
-    // Generic information
-    typedef typename Id::value_type value_type;
-    typedef boost::mpl::int_<1> tensor_rank;
+    typedef typename copy_const< Id, T >::type value_type;
+    typedef mpl::map<
+        mpl::pair< tag::value_type, value_type >,
+        mpl::pair< tag::entity, tag::vector >,
+        mpl::pair< tag::data_structure, tag::linear_array >
+    > property_map;
 
     static std::ptrdiff_t size1( Id const& t ) {
         return t.size();
     }
 
+    static value_type* data( Id& t ) {
+        return &t.front();
+    }
+
 };
 
-} // detail
-} // bindings
-} // numeric
-} // boost
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
 
 #endif
Modified: sandbox/numeric_bindings/boost/numeric/bindings/std/vector.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/std/vector.hpp	(original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/std/vector.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -10,7 +10,6 @@
 #define BOOST_NUMERIC_BINDINGS_STD_VECTOR_HPP
 
 #include <boost/numeric/bindings/detail/adaptor.hpp>
-#include <boost/numeric/bindings/detail/dense.hpp>
 #include <vector>
 
 namespace boost {
@@ -21,19 +20,26 @@
 template< typename T, typename Alloc, typename Id, typename Enable >
 struct adaptor< std::vector< T, Alloc >, Id, Enable > {
 
-    // Generic information
-    typedef typename Id::value_type value_type;
-    typedef boost::mpl::int_<1> tensor_rank;
+    typedef typename copy_const< Id, T >::type value_type;
+    typedef mpl::map<
+        mpl::pair< tag::value_type, value_type >,
+        mpl::pair< tag::entity, tag::vector >,
+        mpl::pair< tag::data_structure, tag::linear_array >
+    > property_map;
 
-    static std::ptrdiff_t size1( std::vector< T, Alloc > const& t ) {
+    static std::ptrdiff_t size1( Id const& t ) {
         return t.size();
     }
 
+    static value_type* data( Id& t ) {
+        return &t.front();
+    }
+
 };
 
-} // detail
-} // bindings
-} // numeric
-} // boost
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
 
 #endif
Modified: sandbox/numeric_bindings/boost/numeric/bindings/tensor_rank.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/tensor_rank.hpp	(original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/tensor_rank.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -16,10 +16,10 @@
 namespace bindings {
 
 template< typename T >
-struct tensor_rank: detail::adaptor_access< T >::tensor_rank {};
+struct tensor_rank: mpl::int_< detail::property_at< T, detail::tag::entity >::type::value > {};
 
-} // bindings
-} // numeric
-} // boost
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
 
 #endif
Modified: sandbox/numeric_bindings/boost/numeric/bindings/tensor_size.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/tensor_size.hpp	(original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/tensor_size.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -60,9 +60,9 @@
     return tensor_size_impl<T,2>::size2( t );
 }
 
-} // bindings
-} // numeric
-} // boost
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
 
 #endif
 
Added: sandbox/numeric_bindings/boost/numeric/bindings/tnt/tnt_array1d.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/tnt/tnt_array1d.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,45 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_TNT_ARRAY1D_HPP
+#define BOOST_NUMERIC_BINDINGS_TNT_ARRAY1D_HPP
+
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+#include <tnt_array1d.h>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T, typename Id, typename Enable >
+struct adaptor< TNT::Array1D< T >, Id, Enable > {
+
+    typedef typename copy_const< Id, T >::type value_type;
+    typedef mpl::map<
+        mpl::pair< tag::value_type, value_type >,
+        mpl::pair< tag::entity, tag::vector >,
+        mpl::pair< tag::data_structure, tag::linear_array >
+    > property_map;
+
+    static std::ptrdiff_t size1( Id const& t ) {
+        return t.dim();
+    }
+
+    static value_type* data( Id& t ) {
+        return &t[0];
+    }
+
+};
+
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif
Modified: sandbox/numeric_bindings/boost/numeric/bindings/transpose.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/transpose.hpp	(original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/transpose.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -10,34 +10,16 @@
 #define BOOST_NUMERIC_BINDINGS_TRANSPOSE_HPP
 
 #include <boost/numeric/bindings/value_type.hpp>
-#include <boost/numeric/bindings/tensor_rank.hpp>
+#include <boost/numeric/bindings/entity.hpp>
 #include <boost/mpl/max.hpp>
 
 namespace boost {
 namespace numeric {
 namespace bindings {
-
 namespace detail {
 
 template< typename T >
-struct transpose_wrapper {
-
-    typedef T type;
-
-    transpose_wrapper( T& t ):
-        m_ref( t ) {}
-
-    T& get() {
-        return m_ref;
-    }
-
-    T const& get() const {
-        return m_ref;
-    }
-
-private:
-    T& m_ref;
-};
+struct transpose_wrapper: reference_wrapper<T> {}
 
 template< typename T, typename Id, typename Enable >
 struct adaptor< transpose_wrapper<T>, Id, Enable > {
@@ -45,14 +27,14 @@
     typedef typename value_type<T>::type value_type;
     typedef typename boost::mpl::max<
             boost::mpl::int_<2>,
-            typename tensor_rank<T>::type >::type tensor_rank;
+            typename entity<T>::type >::type entity;
 
     static std::ptrdiff_t size1( Id const& t ) {
-        return tensor_size2( t.get() );
+        return bindings::tensor_size2( t.get() );
     }
 
     static std::ptrdiff_t size2( Id const& t ) {
-        return tensor_size1( t.get() );
+        return bindings::tensor_size1( t.get() );
     }
 
 };
@@ -65,9 +47,13 @@
     return detail::transpose_wrapper<T>( underlying );
 }
 
-} // bindings
-} // numeric
-} // boost
+template< typename T >
+detail::transpose_wrapper<T const> trans( T const& underlying ) {
+    return detail::transpose_wrapper<T const>( underlying );
+}
+
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
 
 #endif
-
Added: sandbox/numeric_bindings/boost/numeric/bindings/ublas/detail/to_bindings_tag.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/detail/to_bindings_tag.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,55 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_DETAIL_TO_BINDINGS_TAG_HPP
+#define BOOST_NUMERIC_BINDINGS_UBLAS_DETAIL_TO_BINDINGS_TAG_HPP
+
+#include <boost/numeric/bindings/detail/tag.hpp>
+#include <boost/numeric/ublas/fwd.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template<>
+struct to_bindings_tag< ublas::lower > {
+    typedef tag::lower type;
+};
+
+template<>
+struct to_bindings_tag< ublas::upper > {
+    typedef tag::upper type;
+};
+
+template<>
+struct to_bindings_tag< ublas::unit_lower > {
+    typedef tag::unit_lower type;
+};
+
+template<>
+struct to_bindings_tag< ublas::unit_upper > {
+    typedef tag::unit_upper type;
+};
+
+template<>
+struct to_bindings_tag< ublas::row_major > {
+    typedef tag::row_major type;
+};
+
+template<>
+struct to_bindings_tag< ublas::column_major > {
+    typedef tag::column_major type;
+};
+
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif
Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix.hpp	(original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -10,7 +10,7 @@
 #define BOOST_NUMERIC_BINDINGS_UBLAS_MATRIX_HPP
 
 #include <boost/numeric/bindings/detail/adaptor.hpp>
-#include <boost/numeric/bindings/detail/dense.hpp>
+#include <boost/numeric/bindings/ublas/detail/to_bindings_tag.hpp>
 #include <boost/numeric/ublas/matrix.hpp>
 
 namespace boost {
@@ -18,12 +18,16 @@
 namespace bindings {
 namespace detail {
 
-template< typename T, typename Alloc, typename Id, typename Enable >
-struct adaptor< boost::numeric::ublas::matrix< T, Alloc >, Id, Enable > {
+template< typename T, typename F, typename A, typename Id, typename Enable >
+struct adaptor< boost::numeric::ublas::matrix< T, F, A >, Id, Enable > {
 
-    // Generic information
-    typedef typename Id::value_type value_type;
-    typedef boost::mpl::int_<2> tensor_rank;
+    typedef typename copy_const< Id, T >::type value_type;
+    typedef mpl::map<
+        mpl::pair< tag::value_type, value_type >,
+        mpl::pair< tag::entity, tag::matrix >,
+        mpl::pair< tag::data_structure, tag::linear_array >,
+        mpl::pair< tag::data_order, typename detail::to_bindings_tag<F>::type >
+    > property_map;
 
     static std::ptrdiff_t size1( Id const& t ) {
         return t.size1();
@@ -33,11 +37,15 @@
         return t.size2();
     }
 
+    static value_type* data( Id& t ) {
+        return &t.data()[0];
+    }
+
 };
 
-} // detail
-} // bindings
-} // numeric
-} // boost
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
 
 #endif
Added: sandbox/numeric_bindings/boost/numeric/bindings/ublas/symmetric.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/symmetric.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,49 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_SYMMETRIC_HPP
+#define BOOST_NUMERIC_BINDINGS_UBLAS_SYMMETRIC_HPP
+
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+#include <boost/numeric/bindings/ublas/detail/to_bindings_tag.hpp>
+#include <boost/numeric/ublas/symmetric.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T, typename F1, typename F2, typename A, typename Id, typename Enable >
+struct adaptor< ublas::symmetric_matrix< T, F1, F2, A >, Id, Enable > {
+
+    typedef typename copy_const< Id, T >::type value_type;
+    typedef mpl::map<
+        mpl::pair< tag::value_type, value_type >,
+        mpl::pair< tag::entity, tag::matrix >,
+        mpl::pair< tag::matrix_type, tag::symmetric >,
+        mpl::pair< tag::data_structure, tag::triangular_array >,
+        mpl::pair< tag::data_side, typename to_bindings_tag<F1>::type >,
+        mpl::pair< tag::data_order, typename to_bindings_tag<F2>::type >
+    > property_map;
+
+    static std::ptrdiff_t size1( Id const& t ) {
+        return t.size1();
+    }
+
+    static std::ptrdiff_t size2( Id const& t ) {
+        return t.size2();
+    }
+
+};
+
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif
Added: sandbox/numeric_bindings/boost/numeric/bindings/ublas/triangular.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/triangular.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,51 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_TRIANGULAR_HPP
+#define BOOST_NUMERIC_BINDINGS_UBLAS_TRIANGULAR_HPP
+
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+#include <boost/numeric/bindings/ublas/detail/to_bindings_tag.hpp>
+#include <boost/numeric/ublas/triangular.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T, typename F1, typename F2, typename A, typename Id, typename Enable >
+struct adaptor< ublas::triangular_matrix< T, F1, F2, A >, Id, Enable > {
+
+    typedef typename copy_const< Id, T >::type value_type;
+    typedef mpl::map<
+        mpl::pair< tag::value_type, T >,
+        mpl::pair< tag::entity, tag::matrix >,
+        mpl::pair< tag::matrix_type, tag::triangular >,
+        mpl::pair< tag::matrix_side, typename to_bindings_tag<F1>::type >,
+        mpl::pair< tag::data_structure, tag::triangular_array >,
+        mpl::pair< tag::data_side, typename erase_unit<
+                typename to_bindings_tag<F1>::type >::type >,
+        mpl::pair< tag::data_order, typename to_bindings_tag<F2>::type >
+    > property_map;
+
+    static std::ptrdiff_t size1( Id const& t ) {
+        return t.size1();
+    }
+
+    static std::ptrdiff_t size2( Id const& t ) {
+        return t.size2();
+    }
+
+};
+
+} // detail
+} // bindings
+} // numeric
+} // boost
+
+#endif
Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector.hpp	(original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -10,7 +10,6 @@
 #define BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_HPP
 
 #include <boost/numeric/bindings/detail/adaptor.hpp>
-#include <boost/numeric/bindings/detail/dense.hpp>
 #include <boost/numeric/ublas/vector.hpp>
 
 namespace boost {
@@ -21,19 +20,26 @@
 template< typename T, typename Alloc, typename Id, typename Enable >
 struct adaptor< boost::numeric::ublas::vector< T, Alloc >, Id, Enable > {
 
-    // Generic information
-    typedef typename Id::value_type value_type;
-    typedef boost::mpl::int_<1> tensor_rank;
+    typedef typename copy_const< Id, T >::type value_type;
+    typedef mpl::map<
+        mpl::pair< tag::value_type, value_type >,
+        mpl::pair< tag::entity, tag::vector >,
+        mpl::pair< tag::data_structure, tag::linear_array >
+    > property_map;
 
     static std::ptrdiff_t size1( Id const& t ) {
         return t.size();
     }
 
+    static value_type* data( Id& t ) {
+        return &t.data()[0];
+    }
+
 };
 
-} // detail
-} // bindings
-} // numeric
-} // boost
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
 
 #endif
Added: sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_sparse.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_sparse.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -0,0 +1,41 @@
+//
+// Copyright (c) 2009 Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_SPARSE_HPP
+#define BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_SPARSE_HPP
+
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+#include <boost/numeric/ublas/vector_sparse.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T, typename A, typename Id, typename Enable >
+struct adaptor< ublas::mapped_vector< T, A >, Id, Enable > {
+
+    typedef mpl::map<
+        mpl::pair< tag::value_type, T >,
+        mpl::pair< tag::entity, tag::vector >,
+        mpl::pair< tag::data_structure, tag::associative_array >
+    > property_map;
+
+    static std::ptrdiff_t size1( Id const& t ) {
+        return t.size();
+    }
+
+};
+
+} // detail
+} // bindings
+} // numeric
+} // boost
+
+#endif
+
Modified: sandbox/numeric_bindings/boost/numeric/bindings/value_type.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/value_type.hpp	(original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/value_type.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
@@ -17,11 +17,11 @@
 
 template< typename T >
 struct value_type {
-    typedef typename detail::adaptor_access< T >::value_type type;
+    typedef typename detail::property_at< T, detail::tag::value_type >::type type;
 };
 
-} // bindings
-} // numeric
-} // boost
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
 
 #endif
Deleted: sandbox/numeric_bindings/boost/numeric/bindings/vector.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/vector.hpp	2009-11-23 13:43:23 EST (Mon, 23 Nov 2009)
+++ (empty file)
@@ -1,15 +0,0 @@
-//
-// Copyright (c) 2009 Rutger ter Borg
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_NUMERIC_BINDINGS_VECTOR_HPP
-#define BOOST_NUMERIC_BINDINGS_VECTOR_HPP
-
-#include <boost/numeric/bindings/vector_size.hpp>
-#include <boost/numeric/bindings/vector_stride.hpp>
-
-#endif