Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58729 - sandbox/numeric_bindings/boost/numeric/bindings/ublas
From: rutger_at_[hidden]
Date: 2010-01-05 15:41:21


Author: rutger
Date: 2010-01-05 15:41:20 EST (Tue, 05 Jan 2010)
New Revision: 58729
URL: http://svn.boost.org/trac/boost/changeset/58729

Log:
Added ublas vector proxy, matrix proxy, vector expression traits (partly)

Added:
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_proxy.hpp (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_expression.hpp (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_proxy.hpp (contents, props changed)

Added: sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_proxy.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_proxy.hpp 2010-01-05 15:41:20 EST (Tue, 05 Jan 2010)
@@ -0,0 +1,65 @@
+//
+// 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_MATRIX_PROXY_HPP
+#define BOOST_NUMERIC_BINDINGS_UBLAS_MATRIX_PROXY_HPP
+
+#include <boost/numeric/bindings/begin.hpp>
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+#include <boost/numeric/bindings/detail/property_map.hpp>
+#include <boost/numeric/bindings/end.hpp>
+#include <boost/numeric/bindings/size.hpp>
+#include <boost/numeric/bindings/stride.hpp>
+#include <boost/numeric/ublas/matrix_proxy.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T, typename Id, typename Enable >
+struct adaptor< ublas::matrix_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;
+
+ 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
+} // namespace numeric
+} // namespace boost
+
+#endif

Added: sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_expression.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_expression.hpp 2010-01-05 15:41:20 EST (Tue, 05 Jan 2010)
@@ -0,0 +1,57 @@
+//
+// 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_EXPRESSION_HPP
+#define BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_EXPRESSION_HPP
+
+#include <boost/numeric/bindings/begin.hpp>
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+#include <boost/numeric/bindings/detail/property_map.hpp>
+#include <boost/numeric/bindings/end.hpp>
+#include <boost/numeric/bindings/size.hpp>
+#include <boost/numeric/bindings/stride.hpp>
+#include <boost/numeric/ublas/vector_expression.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T, typename Id, typename Enable >
+struct adaptor< ublas::vector_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;
+
+ static std::ptrdiff_t size1( const Id& id ) {
+ return bindings::size1( id.expression() );
+ }
+
+ static value_type* begin_value( Id& id ) {
+ return bindings::begin_value( id.expression() );
+ }
+
+ static value_type* end_value( Id& id ) {
+ return bindings::end_value( id.expression() );
+ }
+
+ static std::ptrdiff_t stride1( const Id& id ) {
+ return bindings::stride1( id.expression() );
+ }
+
+};
+
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif

Added: sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_proxy.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_proxy.hpp 2010-01-05 15:41:20 EST (Tue, 05 Jan 2010)
@@ -0,0 +1,57 @@
+//
+// 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_PROXY_HPP
+#define BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_PROXY_HPP
+
+#include <boost/numeric/bindings/begin.hpp>
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+#include <boost/numeric/bindings/detail/property_map.hpp>
+#include <boost/numeric/bindings/end.hpp>
+#include <boost/numeric/bindings/size.hpp>
+#include <boost/numeric/bindings/stride.hpp>
+#include <boost/numeric/ublas/vector_proxy.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+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;
+
+ static std::ptrdiff_t size1( const Id& id ) {
+ return bindings::size1( 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() );
+ }
+
+};
+
+} // namespace detail
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif


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