Boost logo

Ublas :

From: Karl Meerbergen (karl.meerbergen_at_[hidden])
Date: 2008-03-30 11:15:15


Hi Thomas,

one1 and one2 have been removed from the bindings for ublas::matrix a
while ago. The change was not done for banded_matrix (I actually forgot).

The functions stride1 and stride2 are used instead.

Indeed, row_major is the orientation you should use when you use ublas
banded_matrix in lapack or blas, otherwise the format is not correct. I
do not recall the precise details, but the ublas banded format is not
exactly the same as for blas and lapack.

Best,

Karl

Thomas Klimpel wrote:
> 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;
> + }
> };
>
> }
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
>