Boost logo

Ublas :

From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2008-03-30 09:36:09


The methods basic_row_major::one1 and basic_row_major::one2 have been removed from ublas/functional.hpp in boost 1.35, but bindings/traits/ublas_banded.hpp still uses them.

The simplest fix was to copy the missing methods to bindings/traits/detail/ublas_ordering.hpp, and change bindings/traits/ublas_banded.hpp to use these methods instead of the methods from ublas/functional.hpp.

I have only tested this patch for orientation_category = boost::numeric::ublas::row_major_tag, since the following code in ublas_banded.hpp:50

#ifdef BOOST_NUMERIC_BINDINGS_FORTRAN
    BOOST_STATIC_ASSERT((boost::is_same<
      typename F::orientation_category,
      boost::numeric::ublas::row_major_tag
>::value));
#endif

prevents me from testing it for orientation_category = boost::numeric::ublas::column_major_tag.

Any comments?

Regards,
Thomas

Index: bindings/traits/ublas_banded.hpp
===================================================================
--- bindings/traits/ublas_banded.hpp (Revision 43794)
+++ bindings/traits/ublas_banded.hpp (Arbeitskopie)
@@ -82,14 +82,16 @@
     // stride1 == distance (m (i, j), m (i+1, j))
     static int stride1 (matrix_type& m) {
       typedef typename identifier_type::orientation_category orientation_category;
- typedef typename detail::ublas_ordering<orientation_category>::functor_type functor_t ;
- return functor_t::one2 ( std::max(m.size1(), m.size2()), leading_dimension(m)-1 ) ;
+ //typedef typename detail::ublas_ordering<orientation_category>::functor_type functor_t ;
+ //return functor_t::one2 ( std::max(m.size1(), m.size2()), leading_dimension(m)-1 ) ;
+ return detail::ublas_ordering<orientation_category>::one2 ( std::max(m.size1(), m.size2()), leading_dimension(m)-1 ) ;
     }
     // stride2 == distance (m (i, j), m (i, j+1))
     static int stride2 (matrix_type& m) {
       typedef typename identifier_type::orientation_category orientation_category;
- typedef typename detail::ublas_ordering<orientation_category>::functor_type functor_t ;
- return functor_t::one1 ( std::max(m.size1(), m.size2()), leading_dimension(m)-1 ) ;
+ //typedef typename detail::ublas_ordering<orientation_category>::functor_type functor_t ;
+ //return functor_t::one1 ( std::max(m.size1(), m.size2()), leading_dimension(m)-1 ) ;
+ return detail::ublas_ordering<orientation_category>::one1 ( std::max(m.size1(), m.size2()), leading_dimension(m)-1 ) ;
     }
   };
 
Index: bindings/traits/detail/ublas_ordering.hpp
===================================================================
--- bindings/traits/detail/ublas_ordering.hpp (Revision 43794)
+++ bindings/traits/detail/ublas_ordering.hpp (Arbeitskopie)
@@ -45,6 +45,14 @@
       static int stride2( M const& m ) {
         return 1 ;
       }
+
+ static int one1( int /* size1 */, int size2 ) {
+ return size2;
+ }
+
+ static int one2( int /* size1 */, int /* size2 */ ) {
+ return 1;
+ }
     };
     
     template<>
@@ -66,6 +74,14 @@
       static int stride2( M const& m ) {
         return m.size1() ;
       }
+
+ static int one1( int /* size1 */, int /* size2 */ ) {
+ return 1;
+ }
+
+ static int one2( int size1, int /* size2 */ ) {
+ return size1;
+ }
     };
 
   }