Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58450 - in sandbox/numeric_bindings/boost/numeric/bindings: . ublas
From: rutger_at_[hidden]
Date: 2009-12-18 04:09:02


Author: rutger
Date: 2009-12-18 04:08:59 EST (Fri, 18 Dec 2009)
New Revision: 58450
URL: http://svn.boost.org/trac/boost/changeset/58450

Log:
Added is_row_major, is_column_major meta-funcs, initial binding to a ublas scalar_vector

Added:
   sandbox/numeric_bindings/boost/numeric/bindings/is_column_major.hpp (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/is_row_major.hpp (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/scalar_vector.hpp (contents, props changed)

Added: sandbox/numeric_bindings/boost/numeric/bindings/is_column_major.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/is_column_major.hpp 2009-12-18 04:08:59 EST (Fri, 18 Dec 2009)
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2009 by 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_IS_COLUMN_MAJOR_HPP
+#define BOOST_NUMERIC_BINDINGS_IS_COLUMN_MAJOR_HPP
+
+#include <boost/numeric/bindings/detail/property_map.hpp>
+#include <boost/numeric/bindings/tag.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+
+template< typename T >
+struct is_column_major:
+ detail::is_same_at< T, tag::data_order, tag::column_major > {};
+
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif

Added: sandbox/numeric_bindings/boost/numeric/bindings/is_row_major.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/is_row_major.hpp 2009-12-18 04:08:59 EST (Fri, 18 Dec 2009)
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2009 by 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_IS_ROW_MAJOR_HPP
+#define BOOST_NUMERIC_BINDINGS_IS_ROW_MAJOR_HPP
+
+#include <boost/numeric/bindings/detail/property_map.hpp>
+#include <boost/numeric/bindings/tag.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+
+template< typename T >
+struct is_row_major:
+ detail::is_same_at< T, tag::data_order, tag::row_major > {};
+
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif

Added: sandbox/numeric_bindings/boost/numeric/bindings/ublas/scalar_vector.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/scalar_vector.hpp 2009-12-18 04:08:59 EST (Fri, 18 Dec 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_SCALAR_VECTOR_HPP
+#define BOOST_NUMERIC_BINDINGS_UBLAS_SCALAR_VECTOR_HPP
+
+#include <boost/numeric/bindings/detail/adaptor.hpp>
+#include <boost/numeric/ublas/vector.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T, typename Alloc, typename Id, typename Enable >
+struct adaptor< ublas::scalar_vector< T, Alloc >, Id, Enable > {
+
+ typedef typename add_const< T >::type value_type;
+ typedef mpl::map<
+ mpl::pair< tag::value_type, value_type >,
+ mpl::pair< tag::entity, tag::vector >,
+ mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
+ mpl::pair< tag::data_structure, tag::linear_array >,
+ mpl::pair< tag::stride_type<1>, mpl::int_<0> >
+ > property_map;
+
+ static std::ptrdiff_t size1( const Id& t ) {
+ return t.size();
+ }
+
+ static value_type* begin_value( Id& t ) {
+ return t.find_element( 0 );
+ }
+
+ static value_type* end_value( Id& t ) {
+ return t.find_element( 0 ) + 1;
+ }
+
+};
+
+} // 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