Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58510 - in sandbox/numeric_bindings/boost/numeric/bindings: . ublas
From: rutger_at_[hidden]
Date: 2009-12-23 04:53:55


Author: rutger
Date: 2009-12-23 04:53:54 EST (Wed, 23 Dec 2009)
New Revision: 58510
URL: http://svn.boost.org/trac/boost/changeset/58510

Log:
added trans_tag and data_order functions

Added:
   sandbox/numeric_bindings/boost/numeric/bindings/data_order.hpp (contents, props changed)
   sandbox/numeric_bindings/boost/numeric/bindings/trans_tag.hpp (contents, props changed)
Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/unbounded_array.hpp | 4 ++--
   1 files changed, 2 insertions(+), 2 deletions(-)

Added: sandbox/numeric_bindings/boost/numeric/bindings/data_order.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/data_order.hpp 2009-12-23 04:53:54 EST (Wed, 23 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_DATA_ORDER_HPP
+#define BOOST_NUMERIC_BINDINGS_DATA_ORDER_HPP
+
+#include <boost/numeric/bindings/detail/property_map.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+
+template< typename T >
+struct data_order {
+ typedef typename detail::property_at< T, tag::data_order >::type type;
+};
+
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif

Added: sandbox/numeric_bindings/boost/numeric/bindings/trans_tag.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/trans_tag.hpp 2009-12-23 04:53:54 EST (Wed, 23 Dec 2009)
@@ -0,0 +1,88 @@
+//
+// 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_TRANS_TAG_HPP
+#define BOOST_NUMERIC_BINDINGS_TRANS_TAG_HPP
+
+#include <boost/numeric/bindings/tag.hpp>
+#include <boost/numeric/bindings/detail/property_map.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename LibraryOrder, typename DataOrder, typename ValueTransform >
+struct trans_tag_impl {
+ // If your program complains about this part, this probably
+ // means that you are trying to use row_major matrices where you
+ // should use column_major matrices. E.g., for ublas, use
+ // matrix< double, column_major > instead of matrix< double >
+ // to fix this.
+};
+
+template<>
+struct trans_tag_impl< tag::column_major, tag::column_major, mpl::void_ > {
+ typedef tag::no_transpose type;
+};
+
+template<>
+struct trans_tag_impl< tag::column_major, tag::row_major, mpl::void_ > {
+ typedef tag::transpose type;
+};
+
+template<>
+struct trans_tag_impl< tag::column_major, tag::row_major, tag::conjugate > {
+ typedef tag::conjugate type;
+};
+
+template<>
+struct trans_tag_impl< tag::row_major, tag::row_major, mpl::void_ > {
+ typedef tag::no_transpose type;
+};
+
+template<>
+struct trans_tag_impl< tag::row_major, tag::column_major, mpl::void_ > {
+ typedef tag::transpose type;
+};
+
+template<>
+struct trans_tag_impl< tag::row_major, tag::column_major, tag::conjugate > {
+ typedef tag::conjugate type;
+};
+
+} // namespace detail
+
+namespace result_of {
+
+template< typename Order, typename T >
+struct trans_tag {
+ typedef typename detail::trans_tag_impl< Order,
+ typename detail::property_at< T, tag::data_order >::type,
+ typename detail::property_at< T, tag::value_transform >::type >::type type;
+};
+
+} // namespace result_of
+
+//
+// trans_tag will output tags that are compatible with BLAS and LAPACK, either one
+// of tag::transpose, tag::no_transpose, or tag::conjugate.
+// It needs an library-orientation (Order) before it can make a decision about whether
+// a tranpose is in order. Consult the various cases above to see what kind of
+// tag is being generated in what kind of situation.
+//
+template< typename T, typename Order >
+typename result_of::trans_tag< Order, T >::type trans_tag( const T& t, Order ) {
+ return result_of::trans_tag< Order, T >::type();
+}
+
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif

Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/unbounded_array.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/unbounded_array.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/unbounded_array.hpp 2009-12-23 04:53:54 EST (Wed, 23 Dec 2009)
@@ -6,8 +6,8 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 //
 
-#ifndef BOOST_NUMERIC_BINDINGS_UNBOUNDED_ARRAY_HPP
-#define BOOST_NUMERIC_BINDINGS_UNBOUNDED_ARRAY_HPP
+#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_UNBOUNDED_ARRAY_HPP
+#define BOOST_NUMERIC_BINDINGS_UBLAS_UNBOUNDED_ARRAY_HPP
 
 #include <boost/numeric/bindings/detail/adaptor.hpp>
 #include <boost/numeric/ublas/storage.hpp>


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