Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58767 - in sandbox/numeric_bindings/boost/numeric/bindings/ublas: . detail
From: rutger_at_[hidden]
Date: 2010-01-06 10:10:31


Author: rutger
Date: 2010-01-06 10:10:30 EST (Wed, 06 Jan 2010)
New Revision: 58767
URL: http://svn.boost.org/trac/boost/changeset/58767

Log:
More merges on ublas bindings

Added:
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/detail/basic_ublas_adaptor.hpp (contents, props changed)
Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/hermitian.hpp | 40 +++++++---------------------------------
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_expression.hpp | 19 ++++++++-----------
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_proxy.hpp | 17 +++++++----------
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/symmetric.hpp | 40 +++++++---------------------------------
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/triangular.hpp | 30 +++++-------------------------
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_expression.hpp | 17 +++++++----------
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_proxy.hpp | 16 ++++++----------
   7 files changed, 47 insertions(+), 132 deletions(-)

Added: sandbox/numeric_bindings/boost/numeric/bindings/ublas/detail/basic_ublas_adaptor.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/detail/basic_ublas_adaptor.hpp 2010-01-06 10:10:30 EST (Wed, 06 Jan 2010)
@@ -0,0 +1,59 @@
+//
+// 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_BASIC_UBLAS_ADAPTOR_HPP
+#define BOOST_NUMERIC_BINDINGS_UBLAS_DETAIL_BASIC_UBLAS_ADAPTOR_HPP
+
+#include <boost/numeric/bindings/begin.hpp>
+#include <boost/numeric/bindings/end.hpp>
+#include <boost/numeric/bindings/value.hpp>
+#include <boost/numeric/bindings/stride.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T, typename Id, typename P1, typename P2 >
+struct basic_ublas_adaptor {
+
+ typedef typename copy_const< Id, T >::type adapted_type;
+ typedef typename property_insert< adapted_type, P1, P2 >::type property_map;
+
+ static std::ptrdiff_t size1( const Id& id ) {
+ return id.size1();
+ }
+
+ static std::ptrdiff_t size2( const Id& id ) {
+ return id.size2();
+ }
+
+ static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
+ return bindings::begin_value( id.data() );
+ }
+
+ static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
+ return bindings::end_value( id.data() );
+ }
+
+ static typename result_of::stride1< adapted_type >::type stride1( const Id& id ) {
+ return bindings::stride1( id.data() );
+ }
+
+ static typename result_of::stride2< adapted_type >::type stride2( const Id& id ) {
+ return bindings::stride2( id.data() );
+ }
+
+};
+
+} // detail
+} // bindings
+} // numeric
+} // boost
+
+#endif

Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/hermitian.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/hermitian.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/hermitian.hpp 2010-01-06 10:10:30 EST (Wed, 06 Jan 2010)
@@ -12,9 +12,10 @@
 #include <boost/numeric/bindings/begin.hpp>
 #include <boost/numeric/bindings/detail/adaptor.hpp>
 #include <boost/numeric/bindings/end.hpp>
+#include <boost/numeric/bindings/ublas/detail/basic_ublas_adaptor.hpp>
 #include <boost/numeric/bindings/ublas/detail/convert_to.hpp>
-#include <boost/numeric/bindings/value.hpp>
 #include <boost/numeric/bindings/ublas/matrix_expression.hpp>
+#include <boost/numeric/bindings/value.hpp>
 #include <boost/numeric/ublas/hermitian.hpp>
 
 namespace boost {
@@ -56,40 +57,13 @@
 };
 
 template< typename T, typename F, typename Id, typename Enable >
-struct adaptor< ublas::hermitian_adaptor< T, F >, Id, Enable > {
-
- typedef typename copy_const< Id, typename value< T >::type >::type value_type;
- typedef typename property_insert< T,
- mpl::pair< tag::value_type, value_type >,
+struct adaptor< ublas::hermitian_adaptor< T, F >, Id, Enable >:
+ basic_ublas_adaptor<
+ T,
+ Id,
         mpl::pair< tag::matrix_type, tag::hermitian >,
         mpl::pair< tag::data_side, typename convert_to< tag::data_side, F >::type >
- >::type property_map;
-
- static std::ptrdiff_t size1( const Id& id ) {
- return bindings::size1( id.data() );
- }
-
- static std::ptrdiff_t size2( const Id& id ) {
- return bindings::size2( id.data() );
- }
-
- static value_type* begin_value( Id& id ) {
- return bindings::begin_value( id.data() );
- }
-
- static value_type* end_value( Id& id ) {
- return bindings::end_value( id.data() );
- }
-
- static std::ptrdiff_t stride1( const Id& id ) {
- return bindings::stride1( id.data() );
- }
-
- static std::ptrdiff_t stride2( const Id& id ) {
- return bindings::stride2( id.data() );
- }
-
-};
+ > {};
 
 } // namespace detail
 } // namespace bindings

Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_expression.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_expression.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_expression.hpp 2010-01-06 10:10:30 EST (Wed, 06 Jan 2010)
@@ -24,33 +24,30 @@
 template< typename T, typename Id, typename Enable >
 struct adaptor< boost::numeric::ublas::matrix_reference< T >, Id, Enable > {
 
- typedef typename copy_const< Id, typename value<T>::type >::type value_type;
- typedef typename property_insert<
- T,
- mpl::pair< tag::value_type, value_type >
- >::type property_map;
+ typedef typename copy_const< Id, T >::type adapted_type;
+ typedef typename property_map_of< adapted_type >::type property_map;
 
     static std::ptrdiff_t size1( const Id& id ) {
- return bindings::size1( id.expression() );
+ return id.size1();
     }
 
     static std::ptrdiff_t size2( const Id& id ) {
- return bindings::size2( id.expression() );
+ return id.size2();
     }
 
- static value_type* begin_value( Id& id ) {
+ static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
         return bindings::begin_value( id.expression() );
     }
 
- static value_type* end_value( Id& id ) {
+ static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
         return bindings::end_value( id.expression() );
     }
 
- static std::ptrdiff_t stride1( const Id& id ) {
+ static typename result_of::stride1< adapted_type >::type stride1( const Id& id ) {
         return bindings::stride1( id.expression() );
     }
 
- static std::ptrdiff_t stride2( const Id& id ) {
+ static typename result_of::stride2< adapted_type >::type stride2( const Id& id ) {
         return bindings::stride2( id.expression() );
     }
 

Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_proxy.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_proxy.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_proxy.hpp 2010-01-06 10:10:30 EST (Wed, 06 Jan 2010)
@@ -23,13 +23,10 @@
 namespace detail {
 
 template< typename T, typename Id, typename Enable >
-struct adaptor< ublas::matrix_range< T >, Id, Enable > {
+struct adaptor< ublas::matrix_range< M >, Id, Enable > {
 
- typedef typename copy_const< Id, typename value<T>::type >::type value_type;
- typedef typename property_insert<
- T,
- mpl::pair< tag::value_type, value_type >
- >::type property_map;
+ typedef typename copy_const< Id, T >::type adapted_type;
+ typedef typename property_map_of< adapted_type >::type property_map;
 
     static std::ptrdiff_t size1( const Id& id ) {
         return id.size1();
@@ -39,21 +36,21 @@
         return id.size2();
     }
 
- static value_type* begin_value( Id& id ) {
+ static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
         return bindings::begin_value( id.data() ) +
                id.start1() * stride1( id ) +
                id.start2() * stride2( id );
     }
 
- static value_type* end_value( Id& id ) {
+ static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
         return bindings::end_value( id.data() );
     }
 
- static std::ptrdiff_t stride1( const Id& id ) {
+ static typename result_of::stride1< adapted_type >::type stride1( const Id& id ) {
         return bindings::stride1( id.data() );
     }
 
- static std::ptrdiff_t stride2( const Id& id ) {
+ static typename result_of::stride2< adapted_type >::type stride2( const Id& id ) {
         return bindings::stride2( id.data() );
     }
 

Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/symmetric.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/symmetric.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/symmetric.hpp 2010-01-06 10:10:30 EST (Wed, 06 Jan 2010)
@@ -13,8 +13,9 @@
 #include <boost/numeric/bindings/detail/adaptor.hpp>
 #include <boost/numeric/bindings/end.hpp>
 #include <boost/numeric/bindings/ublas/detail/convert_to.hpp>
-#include <boost/numeric/bindings/value.hpp>
+#include <boost/numeric/bindings/ublas/detail/basic_ublas_adaptor.hpp>
 #include <boost/numeric/bindings/ublas/matrix_expression.hpp>
+#include <boost/numeric/bindings/value.hpp>
 #include <boost/numeric/ublas/symmetric.hpp>
 
 namespace boost {
@@ -56,40 +57,13 @@
 };
 
 template< typename T, typename F, typename Id, typename Enable >
-struct adaptor< ublas::symmetric_adaptor< T, F >, Id, Enable > {
-
- typedef typename copy_const< Id, typename value< T >::type >::type value_type;
- typedef typename property_insert< T,
- mpl::pair< tag::value_type, value_type >,
+struct adaptor< ublas::symmetric_adaptor< T, F >, Id, Enable >:
+ basic_ublas_adaptor<
+ T,
+ Id,
         mpl::pair< tag::matrix_type, tag::symmetric >,
         mpl::pair< tag::data_side, typename convert_to< tag::data_side, F >::type >
- >::type property_map;
-
- static std::ptrdiff_t size1( const Id& id ) {
- return bindings::size1( id.data() );
- }
-
- static std::ptrdiff_t size2( const Id& id ) {
- return bindings::size2( id.data() );
- }
-
- static value_type* begin_value( Id& id ) {
- return bindings::begin_value( id.data() );
- }
-
- static value_type* end_value( Id& id ) {
- return bindings::end_value( id.data() );
- }
-
- static std::ptrdiff_t stride1( const Id& id ) {
- return bindings::stride1( id.data() );
- }
-
- static std::ptrdiff_t stride2( const Id& id ) {
- return bindings::stride2( id.data() );
- }
-
-};
+ > {};
 
 } // namespace detail
 } // namespace bindings

Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/triangular.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/triangular.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/triangular.hpp 2010-01-06 10:10:30 EST (Wed, 06 Jan 2010)
@@ -55,34 +55,14 @@
 
 };
 
-
 template< typename T, typename F, typename Id, typename Enable >
-struct adaptor< ublas::triangular_adaptor< T, F >, Id, Enable > {
-
- typedef typename copy_const< Id, typename value< T >::type >::type value_type;
- typedef typename property_insert< T,
- mpl::pair< tag::value_type, value_type >,
+struct adaptor< ublas::triangular_adaptor< T, F >, Id, Enable >:
+ basic_ublas_adaptor<
+ T,
+ Id,
         mpl::pair< tag::matrix_type, typename convert_to< tag::matrix_type, F >::type >,
         mpl::pair< tag::data_side, typename convert_to< tag::data_side, F >::type >
- >::type property_map;
-
- static std::ptrdiff_t size1( const Id& t ) {
- return t.size1();
- }
-
- static std::ptrdiff_t size2( const Id& t ) {
- return t.size2();
- }
-
- static value_type* begin_value( Id& t ) {
- return bindings::begin_value( t.data() );
- }
-
- static value_type* end_value( Id& t ) {
- return bindings::end_value( t.data() );
- }
-
-};
+ > {};
 
 } // detail
 } // bindings

Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_expression.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_expression.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_expression.hpp 2010-01-06 10:10:30 EST (Wed, 06 Jan 2010)
@@ -23,27 +23,24 @@
 namespace detail {
 
 template< typename T, typename Id, typename Enable >
-struct adaptor< ublas::vector_reference< T >, Id, Enable > {
+struct adaptor< ublas::vector_reference< V >, Id, Enable > {
 
- typedef typename copy_const< Id, typename value<T>::type >::type value_type;
- typedef typename property_insert<
- T,
- mpl::pair< tag::value_type, value_type >
- >::type property_map;
+ typedef typename copy_const< Id, T >::type adapted_type;
+ typedef typename property_map_of< adapted_type >::type property_map;
 
     static std::ptrdiff_t size1( const Id& id ) {
- return bindings::size1( id.expression() );
+ return id.size();
     }
 
- static value_type* begin_value( Id& id ) {
+ static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
         return bindings::begin_value( id.expression() );
     }
 
- static value_type* end_value( Id& id ) {
+ static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
         return bindings::end_value( id.expression() );
     }
 
- static std::ptrdiff_t stride1( const Id& id ) {
+ static typename result_of::stride1< adapted_type >::type stride1( const Id& id ) {
         return bindings::stride1( id.expression() );
     }
 

Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_proxy.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_proxy.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_proxy.hpp 2010-01-06 10:10:30 EST (Wed, 06 Jan 2010)
@@ -25,26 +25,22 @@
 template< typename T, typename Id, typename Enable >
 struct adaptor< ublas::vector_range< T >, Id, Enable > {
 
- typedef typename copy_const< Id, typename value<T>::type >::type value_type;
- typedef typename property_insert<
- T,
- mpl::pair< tag::value_type, value_type >
- >::type property_map;
+ typedef typename copy_const< Id, T >::type adapted_type;
+ typedef typename property_map_of< adapted_type >::type property_map;
 
     static std::ptrdiff_t size1( const Id& id ) {
         return id.size();
     }
 
- static value_type* begin_value( Id& id ) {
- return bindings::begin_value( id.data() ) +
- id.start() * stride1( id );
+ static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
+ return bindings::begin_value( id.data() ) + id.start() * stride1( id );
     }
 
- static value_type* end_value( Id& id ) {
+ static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
         return bindings::end_value( id.data() );
     }
 
- static std::ptrdiff_t stride1( const Id& id ) {
+ static typename result_of::stride1< adapted_type >::type stride1( const Id& id ) {
         return bindings::stride1( id.data() );
     }
 


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