Ticket #4399: size-allow_expr_and_break_back_comp.patch

File size-allow_expr_and_break_back_comp.patch, 32.1 KB (added by Marco Guazzone <marco.guazzone@…>, 12 years ago)

Adds the use of uBLAS type traits, simplifies the interaction with expression types, replaces the 'size<tag>' function with the 'size_by_tag<tag>' function.

  • boost/numeric/ublas/operation/size.hpp

    old new  
    55 *
    66 * \brief The \c size operation.
    77 *
    8  * Copyright (c) 2009, Marco Guazzone
     8 * Copyright (c) 2009-2010, Marco Guazzone
    99 *
    1010 * Distributed under the Boost Software License, Version 1.0. (See
    1111 * accompanying file LICENSE_1_0.txt or copy at
     
    2222#include <boost/numeric/ublas/expression_types.hpp>
    2323#include <boost/numeric/ublas/fwd.hpp>
    2424#include <boost/numeric/ublas/tags.hpp>
     25#include <boost/numeric/ublas/traits.hpp>
    2526#include <cstddef>
    2627
    2728
    2829namespace boost { namespace numeric { namespace ublas {
    2930
     31    //@{ Declarations
     32
     33    /**
     34     * \brief Return the number of columns.
     35     * \tparam VectorExprT A type which models the matrix expression concept.
     36     * \param m A matrix expression.
     37     * \return The number of columns.
     38     */
     39    template <typename VectorExprT>
     40    typename vector_traits<VectorExprT>::size_type size(vector_expression<VectorExprT> const& ve);
     41
     42    /**
     43     * \brief Return the size of the given dimension for the given expression.
     44     * \tparam Dim The dimension number (starting from 1).
     45     * \tparam VectorExprT An expression type.
     46     * \param e An expression.
     47     * \return The number of columns.
     48     * \return The size associated to the dimension \a Dim.
     49     */
     50    template <std::size_t Dim, typename VectorExprT>
     51    typename vector_traits<VectorExprT>::size_type size(vector_expression<VectorExprT> const& ve);
     52
     53    /**
     54     * \brief Return the size of the given dimension for the given expression.
     55     * \tparam Dim The dimension number (starting from 1).
     56     * \tparam MatrixExprT An expression type.
     57     * \param e An expression.
     58     * \return The number of columns.
     59     * \return The size associated to the dimension \a Dim.
     60     */
     61    template <std::size_t Dim, typename MatrixExprT>
     62    typename matrix_traits<MatrixExprT>::size_type size(matrix_expression<MatrixExprT> const& me);
     63
     64    /**
     65     * \brief Return the size of the given dimension tag for the given expression.
     66     * \tparam TagT The dimension tag type (e.g., tag::major).
     67     * \tparam MatrixExprT An expression type.
     68     * \param e An expression.
     69     * \return The size associated to the dimension tag \a TagT.
     70     */
     71    template <typename TagT, typename MatrixExprT>
     72    typename matrix_traits<MatrixExprT>::size_type size_by_tag(matrix_expression<MatrixExprT> const& me);
     73    //typename matrix_traits<MatrixExprT>::size_type size(matrix_expression<MatrixExprT> const& me); //FIXME: don't work
     74
     75    //@} Declarations
     76
     77
     78    //@{ Definitions
     79
    3080    namespace detail {
    3181
     82    /**
     83     * \brief Auxiliary class for computing the size of the given dimension for
     84     *  a container of the given category.
     85     * \tparam Dim The dimension number (starting from 1).
     86     * \tparam CategoryT The category type (e.g., vector_tag).
     87     */
     88    template <std::size_t Dim, typename CategoryT>
     89    struct size_by_dim_impl;
     90
     91
     92    /**
     93     * \brief Auxiliary class for computing the size of the given dimension for
     94     *  a container of the given category and with the given orientation.
     95     * \tparam Dim The dimension number (starting from 1).
     96     * \tparam CategoryT The category type (e.g., vector_tag).
     97     * \tparam OrientationT The orientation category type (e.g., row_major_tag).
     98     */
     99    template <typename TagT, typename CategoryT, typename OrientationT>
     100    struct size_by_tag_impl;
     101
     102
     103    /// \brief Specialization of \c size_by_dim_impl for computing the size of a
     104    ///  vector
     105    template <>
     106    struct size_by_dim_impl<1, vector_tag>
     107    {
    32108        /**
    33          * \brief Auxiliary class for computing the size of the given dimension for
    34          *  a container of the given category..
    35          * \tparam Dim The dimension number (starting from 1).
    36          * \tparam CategoryT The category type (e.g., vector_tag).
     109         * \brief Compute the size of the given vector.
     110         * \tparam ExprT A vector expression type.
     111         * \pre ExprT must be a model of VectorExpression.
    37112         */
    38         template <size_t Dim, typename CategoryT>
    39         struct size_by_dim_impl;
     113        template <typename ExprT>
     114        BOOST_UBLAS_INLINE
     115        static typename vector_traits<ExprT>::size_type apply(vector_expression<ExprT> const& ve)
     116        {
     117            return ve().size();
     118        }
     119    };
    40120
    41121
    42         /// \brief Specialization of \c size_by_dim_impl for computing the size of a
    43         ///  vector
    44         template <>
    45         struct size_by_dim_impl<1, vector_tag>
    46         {
    47             /**
    48              * \brief Compute the size of the given vector.
    49              * \tparam ExprT A vector expression type.
    50              * \pre ExprT must be a model of VectorExpression.
    51              */
    52             template <typename ExprT>
    53             BOOST_UBLAS_INLINE
    54             static typename ExprT::size_type apply(ExprT const& e)
    55             {
    56                 return e.size();
    57             }
    58         };
    59 
    60 
    61         /// \brief Specialization of \c size_by_dim_impl for computing the number of
    62         ///  rows of a matrix
    63         template <>
    64         struct size_by_dim_impl<1, matrix_tag>
    65         {
    66             /**
    67              * \brief Compute the number of rows of the given matrix.
    68              * \tparam ExprT A matrix expression type.
    69              * \pre ExprT must be a model of MatrixExpression.
    70              */
    71             template <typename ExprT>
    72             BOOST_UBLAS_INLINE
    73             static typename ExprT::size_type apply(ExprT const& e)
    74             {
    75                 return e.size1();
    76             }
    77         };
    78 
    79 
    80         /// \brief Specialization of \c size_by_dim_impl for computing the number of
    81         ///  columns of a matrix
    82         template <>
    83         struct size_by_dim_impl<2, matrix_tag>
     122    /// \brief Specialization of \c size_by_dim_impl for computing the number of
     123    ///  rows of a matrix
     124    template <>
     125    struct size_by_dim_impl<1, matrix_tag>
     126    {
     127        /**
     128         * \brief Compute the number of rows of the given matrix.
     129         * \tparam ExprT A matrix expression type.
     130         * \pre ExprT must be a model of MatrixExpression.
     131         */
     132        template <typename ExprT>
     133        BOOST_UBLAS_INLINE
     134        static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
    84135        {
    85             /**
    86              * \brief Compute the number of columns of the given matrix.
    87              * \tparam ExprT A matrix expression type.
    88              * \pre ExprT must be a model of MatrixExpression.
    89              */
    90             template <typename ExprT>
    91             BOOST_UBLAS_INLINE
    92             static typename ExprT::size_type apply(ExprT const& e)
    93             {
    94                 return e.size2();
    95             }
    96         };
     136            return me().size1();
     137        }
     138    };
    97139
    98140
     141    /// \brief Specialization of \c size_by_dim_impl for computing the number of
     142    ///  columns of a matrix
     143    template <>
     144    struct size_by_dim_impl<2, matrix_tag>
     145    {
    99146        /**
    100          * \brief Auxiliary class for computing the size of the given dimension for
    101          *  a container of the given category and with the given orientation..
    102          * \tparam Dim The dimension number (starting from 1).
    103          * \tparam CategoryT The category type (e.g., vector_tag).
    104          * \tparam OrientationT The orientation category type (e.g., row_major_tag).
     147         * \brief Compute the number of columns of the given matrix.
     148         * \tparam ExprT A matrix expression type.
     149         * \pre ExprT must be a model of MatrixExpression.
    105150         */
    106         template <typename TagT, typename CategoryT, typename OrientationT>
    107         struct size_by_tag_impl;
     151        template <typename ExprT>
     152        BOOST_UBLAS_INLINE
     153        static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
     154        {
     155            return me().size2();
     156        }
     157    };
    108158
    109159
    110         /// \brief Specialization of \c size_by_tag_impl for computing the size of the
    111         ///  major dimension of a row-major oriented matrix.
    112         template <>
    113         struct size_by_tag_impl<tag::major, matrix_tag, row_major_tag>
     160    /// \brief Specialization of \c size_by_tag_impl for computing the size of the
     161    ///  major dimension of a row-major oriented matrix.
     162    template <>
     163    struct size_by_tag_impl<tag::major, matrix_tag, row_major_tag>
     164    {
     165        /**
     166         * \brief Compute the number of rows of the given matrix.
     167         * \tparam ExprT A matrix expression type.
     168         * \pre ExprT must be a model of MatrixExpression.
     169         */
     170        template <typename ExprT>
     171        BOOST_UBLAS_INLINE
     172        static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
    114173        {
    115             /**
    116              * \brief Compute the number of rows of the given matrix.
    117              * \tparam ExprT A matrix expression type.
    118              * \pre ExprT must be a model of MatrixExpression.
    119              */
    120             template <typename ExprT>
    121             BOOST_UBLAS_INLINE
    122             static typename ExprT::size_type apply(ExprT const& e)
    123             {
    124                 return e.size1();
    125             }
    126         };
    127 
    128 
    129         /// \brief Specialization of \c size_by_tag_impl for computing the size of the
    130         ///  minor dimension of a row-major oriented matrix.
    131         template <>
    132         struct size_by_tag_impl<tag::minor, matrix_tag, row_major_tag>
     174            return me().size1();
     175        }
     176    };
     177
     178
     179    /// \brief Specialization of \c size_by_tag_impl for computing the size of the
     180    ///  minor dimension of a row-major oriented matrix.
     181    template <>
     182    struct size_by_tag_impl<tag::minor, matrix_tag, row_major_tag>
     183    {
     184        /**
     185         * \brief Compute the number of columns of the given matrix.
     186         * \tparam ExprT A matrix expression type.
     187         * \pre ExprT must be a model of MatrixExpression.
     188         */
     189        template <typename ExprT>
     190        BOOST_UBLAS_INLINE
     191        static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
    133192        {
    134             /**
    135              * \brief Compute the number of columns of the given matrix.
    136              * \tparam ExprT A matrix expression type.
    137              * \pre ExprT must be a model of MatrixExpression.
    138              */
    139             template <typename ExprT>
    140             BOOST_UBLAS_INLINE
    141             static typename ExprT::size_type apply(ExprT const& e)
    142             {
    143                 return e.size2();
    144             }
    145         };
    146 
    147 
    148         /// \brief Specialization of \c size_by_tag_impl for computing the size of the
    149         ///  leading dimension of a row-major oriented matrix.
    150         template <>
    151         struct size_by_tag_impl<tag::leading, matrix_tag, row_major_tag>
     193            return me().size2();
     194        }
     195    };
     196
     197
     198    /// \brief Specialization of \c size_by_tag_impl for computing the size of the
     199    ///  leading dimension of a row-major oriented matrix.
     200    template <>
     201    struct size_by_tag_impl<tag::leading, matrix_tag, row_major_tag>
     202    {
     203        /**
     204         * \brief Compute the number of columns of the given matrix.
     205         * \tparam ExprT A matrix expression type.
     206         * \pre ExprT must be a model of MatrixExpression.
     207         */
     208        template <typename ExprT>
     209        BOOST_UBLAS_INLINE
     210        static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
    152211        {
    153             /**
    154              * \brief Compute the number of columns of the given matrix.
    155              * \tparam ExprT A matrix expression type.
    156              * \pre ExprT must be a model of MatrixExpression.
    157              */
    158             template <typename ExprT>
    159             BOOST_UBLAS_INLINE
    160             static typename ExprT::size_type apply(ExprT const& e)
    161             {
    162                 return e.size2();
    163             }
    164         };
    165 
    166 
    167         /// \brief Specialization of \c size_by_tag_impl for computing the size of the
    168         ///  major dimension of a column-major oriented matrix.
    169         template <>
    170         struct size_by_tag_impl<tag::major, matrix_tag, column_major_tag>
     212            return me().size2();
     213        }
     214    };
     215
     216
     217    /// \brief Specialization of \c size_by_tag_impl for computing the size of the
     218    ///  major dimension of a column-major oriented matrix.
     219    template <>
     220    struct size_by_tag_impl<tag::major, matrix_tag, column_major_tag>
     221    {
     222        /**
     223         * \brief Compute the number of columns of the given matrix.
     224         * \tparam ExprT A matrix expression type.
     225         * \pre ExprT must be a model of MatrixExpression.
     226         */
     227        template <typename ExprT>
     228        BOOST_UBLAS_INLINE
     229        static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
    171230        {
    172             /**
    173              * \brief Compute the number of columns of the given matrix.
    174              * \tparam ExprT A matrix expression type.
    175              * \pre ExprT must be a model of MatrixExpression.
    176              */
    177             template <typename ExprT>
    178             BOOST_UBLAS_INLINE
    179             static typename ExprT::size_type apply(ExprT const& e)
    180             {
    181                 return e.size2();
    182             }
    183         };
    184 
    185 
    186         /// \brief Specialization of \c size_by_tag_impl for computing the size of the
    187         ///  minor dimension of a column-major oriented matrix.
    188         template <>
    189         struct size_by_tag_impl<tag::minor, matrix_tag, column_major_tag>
     231            return me().size2();
     232        }
     233    };
     234
     235
     236    /// \brief Specialization of \c size_by_tag_impl for computing the size of the
     237    ///  minor dimension of a column-major oriented matrix.
     238    template <>
     239    struct size_by_tag_impl<tag::minor, matrix_tag, column_major_tag>
     240    {
     241        /**
     242         * \brief Compute the number of rows of the given matrix.
     243         * \tparam ExprT A matrix expression type.
     244         * \pre ExprT must be a model of MatrixExpression.
     245         */
     246        template <typename ExprT>
     247        BOOST_UBLAS_INLINE
     248        static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
    190249        {
    191             /**
    192              * \brief Compute the number of rows of the given matrix.
    193              * \tparam ExprT A matrix expression type.
    194              * \pre ExprT must be a model of MatrixExpression.
    195              */
    196             template <typename ExprT>
    197             BOOST_UBLAS_INLINE
    198             static typename ExprT::size_type apply(ExprT const& e)
    199             {
    200                 return e.size1();
    201             }
    202         };
    203 
    204 
    205         /// \brief Specialization of \c size_by_tag_impl for computing the size of the
    206         ///  leading dimension of a column-major oriented matrix.
    207         template <>
    208         struct size_by_tag_impl<tag::leading, matrix_tag, column_major_tag>
     250            return me().size1();
     251        }
     252    };
     253
     254
     255    /// \brief Specialization of \c size_by_tag_impl for computing the size of the
     256    ///  leading dimension of a column-major oriented matrix.
     257    template <>
     258    struct size_by_tag_impl<tag::leading, matrix_tag, column_major_tag>
     259    {
     260        /**
     261         * \brief Compute the number of rows of the given matrix.
     262         * \tparam ExprT A matrix expression type.
     263         * \pre ExprT must be a model of MatrixExpression.
     264         */
     265        template <typename ExprT>
     266        BOOST_UBLAS_INLINE
     267        static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
    209268        {
    210             /**
    211              * \brief Compute the number of rows of the given matrix.
    212              * \tparam ExprT A matrix expression type.
    213              * \pre ExprT must be a model of MatrixExpression.
    214              */
    215             template <typename ExprT>
    216             BOOST_UBLAS_INLINE
    217             static typename ExprT::size_type apply(ExprT const& e)
    218             {
    219                 return e.size1();
    220             }
    221         };
     269            return me().size1();
     270        }
     271    };
     272
     273
     274    /// \brief Specialization of \c size_by_tag_impl for computing the size of the
     275    ///  given dimension of a unknown oriented expression.
     276    template <typename TagT, typename CategoryT>
     277    struct size_by_tag_impl<TagT, CategoryT, unknown_orientation_tag>: size_by_tag_impl<TagT, CategoryT, row_major_tag>
     278    {
     279        // Empty
     280    };
    222281
    223282    } // Namespace detail
    224283
    225284
    226     /**
    227      * \brief Return the number of columns.
    228      * \tparam MatrixExprT A type which models the matrix expression concept.
    229      * \param m A matrix expression.
    230      * \return The number of columns.
    231      */
    232285    template <typename VectorExprT>
    233286    BOOST_UBLAS_INLINE
    234     typename VectorExprT::size_type size(VectorExprT const& v)
     287    typename vector_traits<VectorExprT>::size_type size(vector_expression<VectorExprT> const& ve)
    235288    {
    236         return v.size();
     289        return ve().size();
    237290    }
    238291
    239292
    240     /**
    241      * \brief Return the size of the given dimension for the given expression.
    242      * \tparam Dim The dimension number (starting from 1).
    243      * \tparam ExprT An expression type.
    244      * \param e An expression.
    245      * \return The number of columns.
    246      * \return The size associated to the dimension \a Dim.
    247      */
    248     template <std::size_t Dim, typename ExprT>
     293    template <std::size_t Dim, typename VectorExprT>
    249294    BOOST_UBLAS_INLINE
    250     typename ExprT::size_type size(ExprT const& e)
     295    typename vector_traits<VectorExprT>::size_type size(vector_expression<VectorExprT> const& ve)
    251296    {
    252         return detail::size_by_dim_impl<Dim, typename ExprT::type_category>::apply(e);
     297        return detail::size_by_dim_impl<Dim, vector_tag>::template apply(ve);
    253298    }
    254299
    255300
    256     /**
    257      * \brief Return the size of the given dimension tag for the given expression.
    258      * \tparam TagT The dimension tag type (e.g., tag::major).
    259      * \tparam ExprT An expression type.
    260      * \param e An expression.
    261      * \return The size associated to the dimension tag \a TagT.
    262      */
    263     template <typename TagT, typename ExprT>
     301    template <std::size_t Dim, typename MatrixExprT>
    264302    BOOST_UBLAS_INLINE
    265     typename ExprT::size_type size(ExprT const& e)
     303    typename matrix_traits<MatrixExprT>::size_type size(matrix_expression<MatrixExprT> const& me)
    266304    {
    267         return detail::size_by_tag_impl<TagT, typename ExprT::type_category, typename ExprT::orientation_category>::apply(e);
     305        return detail::size_by_dim_impl<Dim, matrix_tag>::template apply(me);
    268306    }
    269307
     308
     309    //[FIXME]: don't work
     310    ///**
     311    // * \brief Return the size of the given dimension tag for the given expression.
     312    // * \tparam TagT The dimension tag type (e.g., tag::major).
     313    // * \tparam MatrixExprT An expression type.
     314    // * \param e An expression.
     315    // * \return The size associated to the dimension tag \a TagT.
     316    // */
     317    //template <typename TagT, typename MatrixExprT>
     318    //BOOST_UBLAS_INLINE
     319    //typename matrix_traits<MatrixExprT>::size_type size(matrix_expression<MatrixExprT> const& me, TagT tag=TagT())
     320    //{
     321    //  return detail::size_by_tag_impl<TagT, matrix_tag, typename matrix_traits<MatrixExprT>::orientation_category>::template apply(me);
     322    //}
     323    //[/FIXME]
     324
     325
     326    template <typename TagT, typename MatrixExprT>
     327    BOOST_UBLAS_INLINE
     328    typename matrix_traits<MatrixExprT>::size_type size_by_tag(matrix_expression<MatrixExprT> const& me)
     329    {
     330        return detail::size_by_tag_impl<TagT, matrix_tag, typename matrix_traits<MatrixExprT>::orientation_category>::template apply(me);
     331    }
     332
     333    //@} Definitions
     334
    270335}}} // Namespace boost::numeric::ublas
    271336
    272337
  • libs/numeric/ublas/test/size.cpp

    old new  
    1 /** -*- c++ -*- \file size.hpp \brief Test the \c size operation. */
     1/**
     2 * \file size.cpp
     3 *
     4 * \brief Test the \c size operation.
     5 *
     6 * Copyright (c) 2010, Marco Guazzone
     7 *
     8 * Distributed under the Boost Software License, Version 1.0. (See
     9 * accompwhiching file LICENSE_1_0.txt or copy at
     10 * http://www.boost.org/LICENSE_1_0.txt)
     11 *
     12 * \author Marco Guazzone, marco.guazzone@gmail.com
     13 */
    214
    315#include <boost/numeric/ublas/fwd.hpp>
    416#include <boost/numeric/ublas/matrix.hpp>
     
    127139    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<2>(A) == A.size2()) );
    128140
    129141    // size<major>(A)
    130     BOOST_UBLAS_DEBUG_TRACE( "size<major>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(A)) << " ==> " << A.size1() );
    131     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(A) == A.size1()) );
     142    //BOOST_UBLAS_DEBUG_TRACE( "size<major>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(A)) << " ==> " << A.size1() );
     143    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(A) == A.size1()) );
     144    BOOST_UBLAS_DEBUG_TRACE( "size<major>(A) = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::major>(A)) << " ==> " << A.size1() );
     145    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::major>(A) == A.size1()) );
    132146
    133147    // size<minor>(A)
    134     BOOST_UBLAS_DEBUG_TRACE( "size<minor>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(A)) << " ==> " << A.size2() );
    135     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(A) == A.size2()) );
     148    //BOOST_UBLAS_DEBUG_TRACE( "size<minor>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(A)) << " ==> " << A.size2() );
     149    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(A) == A.size2()) );
     150    BOOST_UBLAS_DEBUG_TRACE( "size<minor>(A) = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::minor>(A)) << " ==> " << A.size2() );
     151    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::minor>(A) == A.size2()) );
    136152
    137153    // size<leading>(A)
    138     BOOST_UBLAS_DEBUG_TRACE( "size<leading>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(A)) << " ==> " << A.size2() );
    139     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(A) == A.size2()) );
     154    //BOOST_UBLAS_DEBUG_TRACE( "size<leading>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(A)) << " ==> " << A.size2() );
     155    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(A) == A.size2()) );
     156    BOOST_UBLAS_DEBUG_TRACE( "size<leading>(A) = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::leading>(A)) << " ==> " << A.size2() );
     157    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::leading>(A) == A.size2()) );
    140158}
    141159
    142160
     
    165183    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<2>(A) == A.size2()) );
    166184
    167185    // size<major>(A)
    168     BOOST_UBLAS_DEBUG_TRACE( "size<major>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(A)) << " ==> " << A.size2() );
    169     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(A) == A.size2()) );
     186    //BOOST_UBLAS_DEBUG_TRACE( "size<major>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(A)) << " ==> " << A.size2() );
     187    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(A) == A.size2()) );
     188    BOOST_UBLAS_DEBUG_TRACE( "size<major>(A) = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::major>(A)) << " ==> " << A.size2() );
     189    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::major>(A) == A.size2()) );
    170190
    171191    // size<minor>(A)
    172     BOOST_UBLAS_DEBUG_TRACE( "size<minor>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(A)) << " ==> " << A.size1() );
    173     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(A) == A.size1()) );
     192    //BOOST_UBLAS_DEBUG_TRACE( "size<minor>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(A)) << " ==> " << A.size1() );
     193    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(A) == A.size1()) );
     194    BOOST_UBLAS_DEBUG_TRACE( "size<minor>(A) = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::minor>(A)) << " ==> " << A.size1() );
     195    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::minor>(A) == A.size1()) );
    174196
    175197    // size<leading>(A)
    176     BOOST_UBLAS_DEBUG_TRACE( "size<leading>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(A)) << " ==> " << A.size1() );
    177     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(A) == A.size1()) );
     198    //BOOST_UBLAS_DEBUG_TRACE( "size<leading>(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(A)) << " ==> " << A.size1() );
     199    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(A) == A.size1()) );
     200    BOOST_UBLAS_DEBUG_TRACE( "size<leading>(A) = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::leading>(A)) << " ==> " << A.size1() );
     201    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::leading>(A) == A.size1()) );
    178202}
    179203
    180204
     
    203227    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<2>(boost::numeric::ublas::trans(A)) == A.size1()) );
    204228
    205229    // size<major>(A') [A is row-major => A' column-major, and viceversa]
    206     BOOST_UBLAS_DEBUG_TRACE( "size<major>(A') = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(boost::numeric::ublas::trans(A))) << " ==> " << A.size1() );
    207     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(boost::numeric::ublas::trans(A)) == A.size1()) );
     230    //BOOST_UBLAS_DEBUG_TRACE( "size<major>(A') = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(boost::numeric::ublas::trans(A))) << " ==> " << A.size1() );
     231    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(boost::numeric::ublas::trans(A)) == A.size1()) );
     232    BOOST_UBLAS_DEBUG_TRACE( "size<major>(A') = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::major>(boost::numeric::ublas::trans(A))) << " ==> " << A.size1() );
     233    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::major>(boost::numeric::ublas::trans(A)) == A.size1()) );
    208234
    209235    // size<minor>(A')  [A is row-major => A' column-major, and viceversa]
    210     BOOST_UBLAS_DEBUG_TRACE( "size<minor>(A') = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(boost::numeric::ublas::trans(A))) << " ==> " << A.size2() );
    211     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(boost::numeric::ublas::trans(A)) == A.size2()) );
     236    //BOOST_UBLAS_DEBUG_TRACE( "size<minor>(A') = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(boost::numeric::ublas::trans(A))) << " ==> " << A.size2() );
     237    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(boost::numeric::ublas::trans(A)) == A.size2()) );
     238    BOOST_UBLAS_DEBUG_TRACE( "size<minor>(A') = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::minor>(boost::numeric::ublas::trans(A))) << " ==> " << A.size2() );
     239    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::minor>(boost::numeric::ublas::trans(A)) == A.size2()) );
    212240
    213241    // size<leading>(A')  [A row-major => A' column-major, and viceversa]
    214     BOOST_UBLAS_DEBUG_TRACE( "size<leading>(A') = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(boost::numeric::ublas::trans(A))) << " ==> " << A.size2() );
    215     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(boost::numeric::ublas::trans(A)) == A.size2()) );
     242    //BOOST_UBLAS_DEBUG_TRACE( "size<leading>(A') = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(boost::numeric::ublas::trans(A))) << " ==> " << A.size2() );
     243    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(boost::numeric::ublas::trans(A)) == A.size2()) );
     244    BOOST_UBLAS_DEBUG_TRACE( "size<leading>(A') = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::leading>(boost::numeric::ublas::trans(A))) << " ==> " << A.size2() );
     245    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::leading>(boost::numeric::ublas::trans(A)) == A.size2()) );
    216246}
    217247
    218248
     
    242272    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<2>(matrix_reference_type(A)) == matrix_reference_type(A).size2()) );
    243273
    244274    // size<major>(reference(A))
    245     BOOST_UBLAS_DEBUG_TRACE( "size<major>(reference(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(matrix_reference_type(A))) << " ==> " << matrix_reference_type(A).size1() );
    246     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(matrix_reference_type(A)) == matrix_reference_type(A).size1()) );
     275    //BOOST_UBLAS_DEBUG_TRACE( "size<major>(reference(A) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(matrix_reference_type(A))) << " ==> " << matrix_reference_type(A).size1() );
     276    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::major>(matrix_reference_type(A)) == matrix_reference_type(A).size1()) );
     277    BOOST_UBLAS_DEBUG_TRACE( "size<major>(reference(A) = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::major>(matrix_reference_type(A))) << " ==> " << matrix_reference_type(A).size1() );
     278    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::major>(matrix_reference_type(A)) == matrix_reference_type(A).size1()) );
    247279
    248280    // size<minor>(reference(A))
    249     BOOST_UBLAS_DEBUG_TRACE( "size<minor>(reference(A)) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(matrix_reference_type(A))) << " ==> " << matrix_reference_type(A).size2() );
    250     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(matrix_reference_type(A)) == matrix_reference_type(A).size2()) );
     281    //BOOST_UBLAS_DEBUG_TRACE( "size<minor>(reference(A)) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(matrix_reference_type(A))) << " ==> " << matrix_reference_type(A).size2() );
     282    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::minor>(matrix_reference_type(A)) == matrix_reference_type(A).size2()) );
     283    BOOST_UBLAS_DEBUG_TRACE( "size<minor>(reference(A)) = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::minor>(matrix_reference_type(A))) << " ==> " << matrix_reference_type(A).size2() );
     284    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::minor>(matrix_reference_type(A)) == matrix_reference_type(A).size2()) );
    251285
    252286    // size<leading>(reference(A))
    253     BOOST_UBLAS_DEBUG_TRACE( "size<leading>(reference(A)) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(matrix_reference_type(A))) << " ==> " << matrix_reference_type(A).size2() );
    254     BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(matrix_reference_type(A)) == matrix_reference_type(A).size2()) );
     287    //BOOST_UBLAS_DEBUG_TRACE( "size<leading>(reference(A)) = " << (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(matrix_reference_type(A))) << " ==> " << matrix_reference_type(A).size2() );
     288    //BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size<boost::numeric::ublas::tag::leading>(matrix_reference_type(A)) == matrix_reference_type(A).size2()) );
     289    BOOST_UBLAS_DEBUG_TRACE( "size<leading>(reference(A)) = " << (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::leading>(matrix_reference_type(A))) << " ==> " << matrix_reference_type(A).size2() );
     290    BOOST_UBLAS_TEST_CHECK( (boost::numeric::ublas::size_by_tag<boost::numeric::ublas::tag::leading>(matrix_reference_type(A)) == matrix_reference_type(A).size2()) );
    255291}
    256292
    257293