Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66085 - in branches/release: boost/numeric/ublas boost/numeric/ublas/detail boost/numeric/ublas/operation libs/numeric/ublas libs/numeric/ublas/doc libs/numeric/ublas/test
From: david.bellot_at_[hidden]
Date: 2010-10-19 03:01:40


Author: david.bellot
Date: 2010-10-19 03:01:35 EDT (Tue, 19 Oct 2010)
New Revision: 66085
URL: http://svn.boost.org/trac/boost/changeset/66085

Log:
beta ublas for 1.45

Properties modified:
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/numeric/ublas/functional.hpp (contents, props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
Text files modified:
   branches/release/boost/numeric/ublas/detail/matrix_assign.hpp | 61 ++--
   branches/release/boost/numeric/ublas/expression_types.hpp | 9
   branches/release/boost/numeric/ublas/functional.hpp | 2
   branches/release/boost/numeric/ublas/matrix.hpp | 47 +++
   branches/release/boost/numeric/ublas/operation/size.hpp | 517 ++++++++++++++++++++++-----------------
   branches/release/libs/numeric/ublas/doc/index.htm | 5
   branches/release/libs/numeric/ublas/doc/index.html | 33 +-
   branches/release/libs/numeric/ublas/test/comp_mat_erase.cpp | 2
   branches/release/libs/numeric/ublas/test/test11.cpp | 7
   9 files changed, 407 insertions(+), 276 deletions(-)

Modified: branches/release/boost/numeric/ublas/detail/matrix_assign.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/detail/matrix_assign.hpp (original)
+++ branches/release/boost/numeric/ublas/detail/matrix_assign.hpp 2010-10-19 03:01:35 EDT (Tue, 19 Oct 2010)
@@ -13,6 +13,7 @@
 #ifndef _BOOST_UBLAS_MATRIX_ASSIGN_
 #define _BOOST_UBLAS_MATRIX_ASSIGN_
 
+#include <boost/numeric/ublas/traits.hpp>
 // Required for make_conformant storage
 #include <vector>
 
@@ -90,7 +91,7 @@
                                 break;
                         } else if (compare > 0) {
                             if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
- if (*it2e != value_type/*zero*/())
+ if (static_cast<value_type>(*it2e) != value_type/*zero*/())
                                     index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
                             ++ it2e;
                             if (it2e != it2e_end)
@@ -102,7 +103,7 @@
                 }
                 while (it2e != it2e_end) {
                     if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
- if (*it2e != value_type/*zero*/())
+ if (static_cast<value_type>(*it2e) != value_type/*zero*/())
                             index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
                     ++ it2e;
                 }
@@ -119,7 +120,7 @@
 #endif
                 while (it2e != it2e_end) {
                     if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
- if (*it2e != value_type/*zero*/())
+ if (static_cast<value_type>(*it2e) != value_type/*zero*/())
                             index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
                     ++ it2e;
                 }
@@ -136,7 +137,7 @@
 #endif
             while (it2e != it2e_end) {
                 if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ()))
- if (*it2e != value_type/*zero*/())
+ if (static_cast<value_type>(*it2e) != value_type/*zero*/())
                         index.push_back (std::pair<size_type, size_type> (it2e.index1 (), it2e.index2 ()));
                 ++ it2e;
             }
@@ -193,7 +194,7 @@
                                 break;
                         } else if (compare > 0) {
                             if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
- if (*it1e != value_type/*zero*/())
+ if (static_cast<value_type>(*it1e) != value_type/*zero*/())
                                     index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
                             ++ it1e;
                             if (it1e != it1e_end)
@@ -205,7 +206,7 @@
                 }
                 while (it1e != it1e_end) {
                     if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
- if (*it1e != value_type/*zero*/())
+ if (static_cast<value_type>(*it1e) != value_type/*zero*/())
                             index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
                     ++ it1e;
                 }
@@ -222,7 +223,7 @@
 #endif
                 while (it1e != it1e_end) {
                     if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
- if (*it1e != value_type/*zero*/())
+ if (static_cast<value_type>(*it1e) != value_type/*zero*/())
                             index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
                     ++ it1e;
                 }
@@ -239,7 +240,7 @@
 #endif
             while (it1e != it1e_end) {
                 if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ()))
- if (*it1e != value_type/*zero*/())
+ if (static_cast<value_type>(*it1e) != value_type/*zero*/())
                         index.push_back (std::pair<size_type, size_type> (it1e.index1 (), it1e.index2 ()));
                 ++ it1e;
             }
@@ -636,7 +637,8 @@
     template<template <class T1, class T2> class F, class R, class M, class E>
     // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
     void matrix_assign (M &m, const matrix_expression<E> &e, packed_proxy_tag, row_major_tag) {
- typedef F<typename M::iterator2::reference, typename E::value_type> functor_type;
+ typedef typename matrix_traits<E>::value_type expr_value_type;
+ typedef F<typename M::iterator2::reference, expr_value_type> functor_type;
         // R unnecessary, make_conformant not required
         typedef typename M::difference_type difference_type;
         typedef typename M::value_type value_type;
@@ -677,7 +679,7 @@
 #endif
                         difference_type size2 (it2_end - it2);
                         while (-- size2 >= 0)
- functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
+ functor_type::apply (*it2, expr_value_type/*zero*/()), ++ it2;
                         ++ it1;
                     }
                 } else {
@@ -717,7 +719,7 @@
                     it2_size -= size2;
                     if (!functor_type::computed) {
                         while (-- size2 >= 0) // zeroing
- functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
+ functor_type::apply (*it2, expr_value_type/*zero*/()), ++ it2;
                     } else {
                         it2 += size2;
                     }
@@ -732,7 +734,7 @@
             size2 = it2_size;
             if (!functor_type::computed) {
                 while (-- size2 >= 0) // zeroing
- functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
+ functor_type::apply (*it2, expr_value_type/*zero*/()), ++ it2;
             } else {
                 it2 += size2;
             }
@@ -750,7 +752,7 @@
 #endif
                 difference_type size2 (it2_end - it2);
                 while (-- size2 >= 0)
- functor_type::apply (*it2, value_type/*zero*/()), ++ it2;
+ functor_type::apply (*it2, expr_value_type/*zero*/()), ++ it2;
                 ++ it1;
             }
         } else {
@@ -765,7 +767,8 @@
     template<template <class T1, class T2> class F, class R, class M, class E>
     // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
     void matrix_assign (M &m, const matrix_expression<E> &e, packed_proxy_tag, column_major_tag) {
- typedef F<typename M::iterator1::reference, typename E::value_type> functor_type;
+ typedef typename matrix_traits<E>::value_type expr_value_type;
+ typedef F<typename M::iterator1::reference, expr_value_type> functor_type;
         // R unnecessary, make_conformant not required
         typedef typename M::difference_type difference_type;
         typedef typename M::value_type value_type;
@@ -806,7 +809,7 @@
 #endif
                         difference_type size1 (it1_end - it1);
                         while (-- size1 >= 0)
- functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
+ functor_type::apply (*it1, expr_value_type/*zero*/()), ++ it1;
                         ++ it2;
                     }
                 } else {
@@ -846,7 +849,7 @@
                     it1_size -= size1;
                     if (!functor_type::computed) {
                         while (-- size1 >= 0) // zeroing
- functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
+ functor_type::apply (*it1, expr_value_type/*zero*/()), ++ it1;
                     } else {
                         it1 += size1;
                     }
@@ -861,7 +864,7 @@
             size1 = it1_size;
             if (!functor_type::computed) {
                 while (-- size1 >= 0) // zeroing
- functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
+ functor_type::apply (*it1, expr_value_type/*zero*/()), ++ it1;
             } else {
                 it1 += size1;
             }
@@ -879,7 +882,7 @@
 #endif
                 difference_type size1 (it1_end - it1);
                 while (-- size1 >= 0)
- functor_type::apply (*it1, value_type/*zero*/()), ++ it1;
+ functor_type::apply (*it1, expr_value_type/*zero*/()), ++ it1;
                 ++ it2;
             }
         } else {
@@ -958,7 +961,8 @@
     template<template <class T1, class T2> class F, class R, class M, class E>
     // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
     void matrix_assign (M &m, const matrix_expression<E> &e, sparse_proxy_tag, row_major_tag) {
- typedef F<typename M::iterator2::reference, typename E::value_type> functor_type;
+ typedef typename matrix_traits<E>::value_type expr_value_type;
+ typedef F<typename M::iterator2::reference, expr_value_type> functor_type;
         typedef R conformant_restrict_type;
         typedef typename M::size_type size_type;
         typedef typename M::difference_type difference_type;
@@ -1004,7 +1008,7 @@
                                 break;
                         } else if (compare < 0) {
                             if (!functor_type::computed) {
- functor_type::apply (*it2, value_type/*zero*/());
+ functor_type::apply (*it2, expr_value_type/*zero*/());
                                 ++ it2;
                             } else
                                 increment (it2, it2_end, - compare);
@@ -1023,7 +1027,7 @@
                 }
                 if (!functor_type::computed) {
                     while (it2 != it2_end) { // zeroing
- functor_type::apply (*it2, value_type/*zero*/());
+ functor_type::apply (*it2, expr_value_type/*zero*/());
                         ++ it2;
                     }
                 } else {
@@ -1040,7 +1044,7 @@
                     typename M::iterator2 it2_end (end (it1, iterator1_tag ()));
 #endif
                     while (it2 != it2_end) { // zeroing
- functor_type::apply (*it2, value_type/*zero*/());
+ functor_type::apply (*it2, expr_value_type/*zero*/());
                         ++ it2;
                     }
                     ++ it1;
@@ -1061,7 +1065,7 @@
                 typename M::iterator2 it2_end (end (it1, iterator1_tag ()));
 #endif
                 while (it2 != it2_end) { // zeroing
- functor_type::apply (*it2, value_type/*zero*/());
+ functor_type::apply (*it2, expr_value_type/*zero*/());
                     ++ it2;
                 }
                 ++ it1;
@@ -1078,7 +1082,8 @@
     template<template <class T1, class T2> class F, class R, class M, class E>
     // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
     void matrix_assign (M &m, const matrix_expression<E> &e, sparse_proxy_tag, column_major_tag) {
- typedef F<typename M::iterator1::reference, typename E::value_type> functor_type;
+ typedef typename matrix_traits<E>::value_type expr_value_type;
+ typedef F<typename M::iterator1::reference, expr_value_type> functor_type;
         typedef R conformant_restrict_type;
         typedef typename M::size_type size_type;
         typedef typename M::difference_type difference_type;
@@ -1124,7 +1129,7 @@
                                 break;
                         } else if (compare < 0) {
                             if (!functor_type::computed) {
- functor_type::apply (*it1, value_type/*zero*/()); // zeroing
+ functor_type::apply (*it1, expr_value_type/*zero*/()); // zeroing
                                 ++ it1;
                             } else
                                 increment (it1, it1_end, - compare);
@@ -1143,7 +1148,7 @@
                 }
                 if (!functor_type::computed) {
                     while (it1 != it1_end) { // zeroing
- functor_type::apply (*it1, value_type/*zero*/());
+ functor_type::apply (*it1, expr_value_type/*zero*/());
                         ++ it1;
                     }
                 } else {
@@ -1160,7 +1165,7 @@
                     typename M::iterator1 it1_end (end (it2, iterator2_tag ()));
 #endif
                     while (it1 != it1_end) { // zeroing
- functor_type::apply (*it1, value_type/*zero*/());
+ functor_type::apply (*it1, expr_value_type/*zero*/());
                         ++ it1;
                     }
                     ++ it2;
@@ -1181,7 +1186,7 @@
                 typename M::iterator1 it1_end (end (it2, iterator2_tag ()));
 #endif
                 while (it1 != it1_end) { // zeroing
- functor_type::apply (*it1, value_type/*zero*/());
+ functor_type::apply (*it1, expr_value_type/*zero*/());
                     ++ it1;
                 }
                 ++ it2;

Modified: branches/release/boost/numeric/ublas/expression_types.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/expression_types.hpp (original)
+++ branches/release/boost/numeric/ublas/expression_types.hpp 2010-10-19 03:01:35 EDT (Tue, 19 Oct 2010)
@@ -1,6 +1,6 @@
 //
-// Copyright (c) 2000-2002
-// Joerg Walter, Mathias Koch
+// Copyright (c) 2000-2010
+// Joerg Walter, Mathias Koch. David Bellot
 //
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
@@ -22,10 +22,10 @@
 
 namespace boost { namespace numeric { namespace ublas {
 
- /** \brief Base class for uBLAS staticaly derived expressions using the the Barton Nackman trick
+ /** \brief Base class for uBLAS statically derived expressions using the the Barton Nackman trick
      *
- * This class provides the numeric properties for linear algebra.
      * This is a NonAssignable class
+ * Directly implement nonassignable - simplifes debugging call trace!
      *
      * \tparam E an expression type
      */
@@ -38,7 +38,6 @@
         typedef typename E::value_type value_type;
         */
         
- // Directly implement nonassignable - simplifes debugging call trace!
     protected:
         ublas_expression () {}
         ~ublas_expression () {}

Modified: branches/release/boost/numeric/ublas/functional.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/functional.hpp (original)
+++ branches/release/boost/numeric/ublas/functional.hpp 2010-10-19 03:01:35 EDT (Tue, 19 Oct 2010)
@@ -1865,7 +1865,7 @@
         // return nearest valid index in column j
         static
         BOOST_UBLAS_INLINE
- size_type restrict1 (size_type i, size_type j, size_type size1, size_type size2) {
+ size_type restrict1 (size_type i, size_type j, size_type size1, size_type /* size2 */) {
             return (std::max)(j, (std::min) (size1, i));
         }
         // return nearest valid index in row i

Modified: branches/release/boost/numeric/ublas/matrix.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/matrix.hpp (original)
+++ branches/release/boost/numeric/ublas/matrix.hpp 2010-10-19 03:01:35 EDT (Tue, 19 Oct 2010)
@@ -114,27 +114,54 @@
         typedef typename L::orientation_category orientation_category;
 
         // Construction and destruction
+
+ /// Default dense matrix constructor. Make a dense matrix of size (0,0)
         BOOST_UBLAS_INLINE
         matrix ():
             matrix_container<self_type> (),
             size1_ (0), size2_ (0), data_ () {}
+
+ /** Dense matrix constructor with defined size
+ * \param size1 number of rows
+ * \param size2 number of columns
+ */
         BOOST_UBLAS_INLINE
         matrix (size_type size1, size_type size2):
             matrix_container<self_type> (),
             size1_ (size1), size2_ (size2), data_ (layout_type::storage_size (size1, size2)) {
         }
+
+ /** Dense matrix constructor with defined size a initial value for all the matrix elements
+ * \param size1 number of rows
+ * \param size2 number of columns
+ * \param init initial value assigned to all elements
+ */
         matrix (size_type size1, size_type size2, const value_type &init):
             matrix_container<self_type> (),
             size1_ (size1), size2_ (size2), data_ (layout_type::storage_size (size1, size2), init) {
         }
+
+ /** Dense matrix constructor with defined size and an initial data array
+ * \param size1 number of rows
+ * \param size2 number of columns
+ * \param data array to copy into the matrix. Must have the same dimension as the matrix
+ */
         BOOST_UBLAS_INLINE
         matrix (size_type size1, size_type size2, const array_type &data):
             matrix_container<self_type> (),
             size1_ (size1), size2_ (size2), data_ (data) {}
+
+ /** Copy-constructor of a dense matrix
+ * \param m is a dense matrix
+ */
         BOOST_UBLAS_INLINE
         matrix (const matrix &m):
             matrix_container<self_type> (),
             size1_ (m.size1_), size2_ (m.size2_), data_ (m.data_) {}
+
+ /** Copy-constructor of a dense matrix from a matrix expression
+ * \param ae is a matrix expression
+ */
         template<class AE>
         BOOST_UBLAS_INLINE
         matrix (const matrix_expression<AE> &ae):
@@ -144,26 +171,46 @@
         }
 
         // Accessors
+ /** Return the number of rows of the matrix
+ * You can also use the free size<>() function in operation/size.hpp as size<1>(m) where m is a matrix
+ */
         BOOST_UBLAS_INLINE
         size_type size1 () const {
             return size1_;
         }
+
+ /** Return the number of colums of the matrix
+ * You can also use the free size<>() function in operation/size.hpp as size<2>(m) where m is a matrix
+ */
         BOOST_UBLAS_INLINE
         size_type size2 () const {
             return size2_;
         }
 
         // Storage accessors
+ /** Return a constant reference to the internal storage of a dense matrix, i.e. the raw data
+ * It's type depends on the type used by the matrix to store its data
+ */
         BOOST_UBLAS_INLINE
         const array_type &data () const {
             return data_;
         }
+ /** Return a reference to the internal storage of a dense matrix, i.e. the raw data
+ * It's type depends on the type used by the matrix to store its data
+ */
         BOOST_UBLAS_INLINE
         array_type &data () {
             return data_;
         }
 
         // Resizing
+ /** Resize a matrix to new dimensions
+ * If data are preserved, then if the size if bigger at least on one dimension, extra values are filled with zeros.
+ * If data are not preserved, then nothing has to be assumed regarding the content of the matrix after resizing.
+ * \param size1 the new number of rows
+ * \param size2 the new number of colums
+ * \param preserve a boolean to say if one wants the data to be preserved during the resizing. Default is true.
+ */
         BOOST_UBLAS_INLINE
         void resize (size_type size1, size_type size2, bool preserve = true) {
             if (preserve) {

Modified: branches/release/boost/numeric/ublas/operation/size.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/operation/size.hpp (original)
+++ branches/release/boost/numeric/ublas/operation/size.hpp 2010-10-19 03:01:35 EDT (Tue, 19 Oct 2010)
@@ -1,11 +1,9 @@
 /**
- * -*- c++ -*-
- *
  * \file size.hpp
  *
- * \brief The \c size operation.
+ * \brief The family of \c size operations.
  *
- * Copyright (c) 2009, Marco Guazzone
+ * Copyright (c) 2009-2010, Marco Guazzone
  *
  * Distributed under the Boost Software License, Version 1.0. (See
  * accompanying file LICENSE_1_0.txt or copy at
@@ -18,254 +16,333 @@
 #define BOOST_NUMERIC_UBLAS_OPERATION_SIZE_HPP
 
 
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/if.hpp>
 #include <boost/numeric/ublas/detail/config.hpp>
 #include <boost/numeric/ublas/expression_types.hpp>
 #include <boost/numeric/ublas/fwd.hpp>
 #include <boost/numeric/ublas/tags.hpp>
+#include <boost/numeric/ublas/traits.hpp>
+#include <boost/utility/enable_if.hpp>
 #include <cstddef>
 
 
 namespace boost { namespace numeric { namespace ublas {
 
- namespace detail {
+namespace detail { namespace /*<unnamed>*/ {
+
+/// Define a \c has_size_type trait class.
+BOOST_MPL_HAS_XXX_TRAIT_DEF(size_type)
+
+
+/**
+ * \brief Wrapper type-traits used in \c boost::lazy_enabled_if for getting the
+ * size type (see below).
+ * \tparam VectorT A vector type.
+ */
+template <typename VectorT>
+struct vector_size_type
+{
+ /// The size type.
+ typedef typename vector_traits<VectorT>::size_type type;
+};
+
+/**
+ * \brief Wrapper type-traits used in \c boost::lazy_enabled_if for getting the
+ * size type (see below).
+ * \tparam MatrixT A matrix type.
+ */
+template <typename MatrixT>
+struct matrix_size_type
+{
+ /// The size type.
+ typedef typename matrix_traits<MatrixT>::size_type type;
+};
+
+
+/**
+ * \brief Auxiliary class for computing the size of the given dimension for
+ * a container of the given category.
+ * \tparam Dim The dimension number (starting from 1).
+ * \tparam CategoryT The category type (e.g., vector_tag).
+ */
+template <std::size_t Dim, typename CategoryT>
+struct size_by_dim_impl;
+
+
+/**
+ * \brief Auxiliary class for computing the size of the given dimension for
+ * a container of the given category and with the given orientation.
+ * \tparam Dim The dimension number (starting from 1).
+ * \tparam CategoryT The category type (e.g., vector_tag).
+ * \tparam OrientationT The orientation category type (e.g., row_major_tag).
+ */
+template <typename TagT, typename CategoryT, typename OrientationT>
+struct size_by_tag_impl;
+
+
+/**
+ * \brief Specialization of \c size_by_dim_impl for computing the size of a
+ * vector.
+ */
+template <>
+struct size_by_dim_impl<1, vector_tag>
+{
+ /**
+ * \brief Compute the size of the given vector.
+ * \tparam ExprT A vector expression type.
+ * \pre ExprT must be a model of VectorExpression.
+ */
+ template <typename ExprT>
+ BOOST_UBLAS_INLINE
+ static typename vector_traits<ExprT>::size_type apply(vector_expression<ExprT> const& ve)
+ {
+ return ve().size();
+ }
+};
+
+
+/**
+ * \brief Specialization of \c size_by_dim_impl for computing the number of
+ * rows of a matrix
+ */
+template <>
+struct size_by_dim_impl<1, matrix_tag>
+{
+ /**
+ * \brief Compute the number of rows of the given matrix.
+ * \tparam ExprT A matrix expression type.
+ * \pre ExprT must be a model of MatrixExpression.
+ */
+ template <typename ExprT>
+ BOOST_UBLAS_INLINE
+ static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
+ {
+ return me().size1();
+ }
+};
+
+
+/**
+ * \brief Specialization of \c size_by_dim_impl for computing the number of
+ * columns of a matrix
+ */
+template <>
+struct size_by_dim_impl<2, matrix_tag>
+{
+ /**
+ * \brief Compute the number of columns of the given matrix.
+ * \tparam ExprT A matrix expression type.
+ * \pre ExprT must be a model of MatrixExpression.
+ */
+ template <typename ExprT>
+ BOOST_UBLAS_INLINE
+ static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
+ {
+ return me().size2();
+ }
+};
+
+
+/**
+ * \brief Specialization of \c size_by_tag_impl for computing the size of the
+ * major dimension of a row-major oriented matrix.
+ */
+template <>
+struct size_by_tag_impl<tag::major, matrix_tag, row_major_tag>
+{
+ /**
+ * \brief Compute the number of rows of the given matrix.
+ * \tparam ExprT A matrix expression type.
+ * \pre ExprT must be a model of MatrixExpression.
+ */
+ template <typename ExprT>
+ BOOST_UBLAS_INLINE
+ static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
+ {
+ return me().size1();
+ }
+};
+
+
+/**
+ * \brief Specialization of \c size_by_tag_impl for computing the size of the
+ * minor dimension of a row-major oriented matrix.
+ */
+template <>
+struct size_by_tag_impl<tag::minor, matrix_tag, row_major_tag>
+{
+ /**
+ * \brief Compute the number of columns of the given matrix.
+ * \tparam ExprT A matrix expression type.
+ * \pre ExprT must be a model of MatrixExpression.
+ */
+ template <typename ExprT>
+ BOOST_UBLAS_INLINE
+ static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
+ {
+ return me().size2();
+ }
+};
 
- /**
- * \brief Auxiliary class for computing the size of the given dimension for
- * a container of the given category..
- * \tparam Dim The dimension number (starting from 1).
- * \tparam CategoryT The category type (e.g., vector_tag).
- */
- template <size_t Dim, typename CategoryT>
- struct size_by_dim_impl;
-
-
- /// \brief Specialization of \c size_by_dim_impl for computing the size of a
- /// vector
- template <>
- struct size_by_dim_impl<1, vector_tag>
- {
- /**
- * \brief Compute the size of the given vector.
- * \tparam ExprT A vector expression type.
- * \pre ExprT must be a model of VectorExpression.
- */
- template <typename ExprT>
- BOOST_UBLAS_INLINE
- static typename ExprT::size_type apply(ExprT const& e)
- {
- return e.size();
- }
- };
-
-
- /// \brief Specialization of \c size_by_dim_impl for computing the number of
- /// rows of a matrix
- template <>
- struct size_by_dim_impl<1, matrix_tag>
- {
- /**
- * \brief Compute the number of rows of the given matrix.
- * \tparam ExprT A matrix expression type.
- * \pre ExprT must be a model of MatrixExpression.
- */
- template <typename ExprT>
- BOOST_UBLAS_INLINE
- static typename ExprT::size_type apply(ExprT const& e)
- {
- return e.size1();
- }
- };
-
-
- /// \brief Specialization of \c size_by_dim_impl for computing the number of
- /// columns of a matrix
- template <>
- struct size_by_dim_impl<2, matrix_tag>
- {
- /**
- * \brief Compute the number of columns of the given matrix.
- * \tparam ExprT A matrix expression type.
- * \pre ExprT must be a model of MatrixExpression.
- */
- template <typename ExprT>
- BOOST_UBLAS_INLINE
- static typename ExprT::size_type apply(ExprT const& e)
- {
- return e.size2();
- }
- };
-
-
- /**
- * \brief Auxiliary class for computing the size of the given dimension for
- * a container of the given category and with the given orientation..
- * \tparam Dim The dimension number (starting from 1).
- * \tparam CategoryT The category type (e.g., vector_tag).
- * \tparam OrientationT The orientation category type (e.g., row_major_tag).
- */
- template <typename TagT, typename CategoryT, typename OrientationT>
- struct size_by_tag_impl;
-
-
- /// \brief Specialization of \c size_by_tag_impl for computing the size of the
- /// major dimension of a row-major oriented matrix.
- template <>
- struct size_by_tag_impl<tag::major, matrix_tag, row_major_tag>
- {
- /**
- * \brief Compute the number of rows of the given matrix.
- * \tparam ExprT A matrix expression type.
- * \pre ExprT must be a model of MatrixExpression.
- */
- template <typename ExprT>
- BOOST_UBLAS_INLINE
- static typename ExprT::size_type apply(ExprT const& e)
- {
- return e.size1();
- }
- };
-
-
- /// \brief Specialization of \c size_by_tag_impl for computing the size of the
- /// minor dimension of a row-major oriented matrix.
- template <>
- struct size_by_tag_impl<tag::minor, matrix_tag, row_major_tag>
- {
- /**
- * \brief Compute the number of columns of the given matrix.
- * \tparam ExprT A matrix expression type.
- * \pre ExprT must be a model of MatrixExpression.
- */
- template <typename ExprT>
- BOOST_UBLAS_INLINE
- static typename ExprT::size_type apply(ExprT const& e)
- {
- return e.size2();
- }
- };
-
-
- /// \brief Specialization of \c size_by_tag_impl for computing the size of the
- /// leading dimension of a row-major oriented matrix.
- template <>
- struct size_by_tag_impl<tag::leading, matrix_tag, row_major_tag>
- {
- /**
- * \brief Compute the number of columns of the given matrix.
- * \tparam ExprT A matrix expression type.
- * \pre ExprT must be a model of MatrixExpression.
- */
- template <typename ExprT>
- BOOST_UBLAS_INLINE
- static typename ExprT::size_type apply(ExprT const& e)
- {
- return e.size2();
- }
- };
-
-
- /// \brief Specialization of \c size_by_tag_impl for computing the size of the
- /// major dimension of a column-major oriented matrix.
- template <>
- struct size_by_tag_impl<tag::major, matrix_tag, column_major_tag>
- {
- /**
- * \brief Compute the number of columns of the given matrix.
- * \tparam ExprT A matrix expression type.
- * \pre ExprT must be a model of MatrixExpression.
- */
- template <typename ExprT>
- BOOST_UBLAS_INLINE
- static typename ExprT::size_type apply(ExprT const& e)
- {
- return e.size2();
- }
- };
-
-
- /// \brief Specialization of \c size_by_tag_impl for computing the size of the
- /// minor dimension of a column-major oriented matrix.
- template <>
- struct size_by_tag_impl<tag::minor, matrix_tag, column_major_tag>
- {
- /**
- * \brief Compute the number of rows of the given matrix.
- * \tparam ExprT A matrix expression type.
- * \pre ExprT must be a model of MatrixExpression.
- */
- template <typename ExprT>
- BOOST_UBLAS_INLINE
- static typename ExprT::size_type apply(ExprT const& e)
- {
- return e.size1();
- }
- };
-
-
- /// \brief Specialization of \c size_by_tag_impl for computing the size of the
- /// leading dimension of a column-major oriented matrix.
- template <>
- struct size_by_tag_impl<tag::leading, matrix_tag, column_major_tag>
- {
- /**
- * \brief Compute the number of rows of the given matrix.
- * \tparam ExprT A matrix expression type.
- * \pre ExprT must be a model of MatrixExpression.
- */
- template <typename ExprT>
- BOOST_UBLAS_INLINE
- static typename ExprT::size_type apply(ExprT const& e)
- {
- return e.size1();
- }
- };
 
- } // Namespace detail
+/**
+ * \brief Specialization of \c size_by_tag_impl for computing the size of the
+ * leading dimension of a row-major oriented matrix.
+ */
+template <>
+struct size_by_tag_impl<tag::leading, matrix_tag, row_major_tag>
+{
+ /**
+ * \brief Compute the number of columns of the given matrix.
+ * \tparam ExprT A matrix expression type.
+ * \pre ExprT must be a model of MatrixExpression.
+ */
+ template <typename ExprT>
+ BOOST_UBLAS_INLINE
+ static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
+ {
+ return me().size2();
+ }
+};
 
 
+/// \brief Specialization of \c size_by_tag_impl for computing the size of the
+/// major dimension of a column-major oriented matrix.
+template <>
+struct size_by_tag_impl<tag::major, matrix_tag, column_major_tag>
+{
     /**
- * \brief Return the number of columns.
- * \tparam MatrixExprT A type which models the matrix expression concept.
- * \param m A matrix expression.
- * \return The number of columns.
+ * \brief Compute the number of columns of the given matrix.
+ * \tparam ExprT A matrix expression type.
+ * \pre ExprT must be a model of MatrixExpression.
      */
- template <typename VectorExprT>
+ template <typename ExprT>
     BOOST_UBLAS_INLINE
- typename VectorExprT::size_type size(VectorExprT const& v)
+ static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
     {
- return v.size();
+ return me().size2();
     }
+};
 
 
+/// \brief Specialization of \c size_by_tag_impl for computing the size of the
+/// minor dimension of a column-major oriented matrix.
+template <>
+struct size_by_tag_impl<tag::minor, matrix_tag, column_major_tag>
+{
     /**
- * \brief Return the size of the given dimension for the given expression.
- * \tparam Dim The dimension number (starting from 1).
- * \tparam ExprT An expression type.
- * \param e An expression.
- * \return The number of columns.
- * \return The size associated to the dimension \a Dim.
+ * \brief Compute the number of rows of the given matrix.
+ * \tparam ExprT A matrix expression type.
+ * \pre ExprT must be a model of MatrixExpression.
      */
- template <std::size_t Dim, typename ExprT>
+ template <typename ExprT>
     BOOST_UBLAS_INLINE
- typename ExprT::size_type size(ExprT const& e)
+ static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
     {
- return detail::size_by_dim_impl<Dim, typename ExprT::type_category>::apply(e);
+ return me().size1();
     }
+};
 
 
+/// \brief Specialization of \c size_by_tag_impl for computing the size of the
+/// leading dimension of a column-major oriented matrix.
+template <>
+struct size_by_tag_impl<tag::leading, matrix_tag, column_major_tag>
+{
     /**
- * \brief Return the size of the given dimension tag for the given expression.
- * \tparam TagT The dimension tag type (e.g., tag::major).
- * \tparam ExprT An expression type.
- * \param e An expression.
- * \return The size associated to the dimension tag \a TagT.
+ * \brief Compute the number of rows of the given matrix.
+ * \tparam ExprT A matrix expression type.
+ * \pre ExprT must be a model of MatrixExpression.
      */
- template <typename TagT, typename ExprT>
+ template <typename ExprT>
     BOOST_UBLAS_INLINE
- typename ExprT::size_type size(ExprT const& e)
+ static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
     {
- return detail::size_by_tag_impl<TagT, typename ExprT::type_category, typename ExprT::orientation_category>::apply(e);
+ return me().size1();
     }
+};
+
+
+/// \brief Specialization of \c size_by_tag_impl for computing the size of the
+/// given dimension of a unknown oriented expression.
+template <typename TagT, typename CategoryT>
+struct size_by_tag_impl<TagT, CategoryT, unknown_orientation_tag>: size_by_tag_impl<TagT, CategoryT, row_major_tag>
+{
+ // Empty
+};
+
+}} // Namespace detail::<unnamed>
+
+
+/**
+ * \brief Return the number of columns.
+ * \tparam VectorExprT A type which models the vector expression concept.
+ * \param ve A vector expression.
+ * \return The length of the input vector expression.
+ */
+template <typename VectorExprT>
+BOOST_UBLAS_INLINE
+typename ::boost::lazy_enable_if_c<
+ detail::has_size_type<VectorExprT>::value,
+ detail::vector_size_type<VectorExprT>
+>::type size(vector_expression<VectorExprT> const& ve)
+{
+ return ve().size();
+}
+
+
+/**
+ * \brief Return the size of the given dimension for the given vector
+ * expression.
+ * \tparam Dim The dimension number (starting from 1).
+ * \tparam VectorExprT A vector expression type.
+ * \param ve A vector expression.
+ * \return The length of the input vector expression.
+ */
+template <std::size_t Dim, typename VectorExprT>
+BOOST_UBLAS_INLINE
+typename vector_traits<VectorExprT>::size_type size(vector_expression<VectorExprT> const& ve)
+{
+ return detail::size_by_dim_impl<Dim, vector_tag>::template apply(ve);
+}
+
+
+/**
+ * \brief Return the size of the given dimension for the given matrix
+ * expression.
+ * \tparam Dim The dimension number (starting from 1).
+ * \tparam MatrixExprT A matrix expression type.
+ * \param e A matrix expression.
+ * \return The size of the input matrix expression associated to the dimension
+ * \a Dim.
+ */
+template <std::size_t Dim, typename MatrixExprT>
+BOOST_UBLAS_INLINE
+typename matrix_traits<MatrixExprT>::size_type size(matrix_expression<MatrixExprT> const& me)
+{
+ return detail::size_by_dim_impl<Dim, matrix_tag>::template apply(me);
+}
+
+
+/**
+ * \brief Return the size of the given dimension tag for the given matrix
+ * expression.
+ * \tparam TagT The dimension tag type (e.g., tag::major).
+ * \tparam MatrixExprT A matrix expression type.
+ * \param e A matrix expression.
+ * \return The size of the input matrix expression associated to the dimension
+ * tag \a TagT.
+ */
+template <typename TagT, typename MatrixExprT>
+BOOST_UBLAS_INLINE
+typename ::boost::lazy_enable_if_c<
+ detail::has_size_type<MatrixExprT>::value,
+ detail::matrix_size_type<MatrixExprT>
+>::type size(matrix_expression<MatrixExprT> const& me)
+{
+ return detail::size_by_tag_impl<TagT, matrix_tag, typename matrix_traits<MatrixExprT>::orientation_category>::template apply(me);
+}
 
 }}} // Namespace boost::numeric::ublas
 

Modified: branches/release/libs/numeric/ublas/doc/index.htm
==============================================================================
--- branches/release/libs/numeric/ublas/doc/index.htm (original)
+++ branches/release/libs/numeric/ublas/doc/index.htm 2010-10-19 03:01:35 EDT (Tue, 19 Oct 2010)
@@ -373,8 +373,7 @@
 contributed to the development of this library: David Abrahams, Ed Brey, Fernando Cacciola, Juan Jose Gomez Cadenas,
 Beman Dawes, Matt Davies, Bob Fletcher, Kresimir Fresl, Joachim Kessel, Patrick Kowalzick, Toon Knapen, Hendrik Kueck,
 John Maddock, Jens Maurer, Alexei Novakov, Gary Powell, Joachim Pyras, Peter Schmitteckert, Jeremy Siek, Markus Steffl,
-Michael Stevens, Benedikt Weber, Martin Weiser, Gunter Winkler, Marc Zimmermann and the members of <a href=
-"http://www.boost.org">Boost</a></p>
+Michael Stevens, Benedikt Weber, Martin Weiser, Gunter Winkler, Marc Zimmermann, David Bellot, Marco Guazzone, Nasos Iliopoulus, the members of Boost and all others contributors around the world. I promise I will try to add their names to this list.</p>
 
 <h2>Frequently Asked Questions</h2>
 
@@ -402,7 +401,7 @@
 
 <hr />
 
-<p>Copyright (&copy;) 2000-2009 Joerg Walter, Mathias Koch, Gunter Winkler<br />
+<p>Copyright (&copy;) 2000-2010 Joerg Walter, Mathias Koch, Gunter Winkler, David Bellot<br />
 Use, modification and distribution are subject to 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
 ).</p>

Modified: branches/release/libs/numeric/ublas/doc/index.html
==============================================================================
--- branches/release/libs/numeric/ublas/doc/index.html (original)
+++ branches/release/libs/numeric/ublas/doc/index.html 2010-10-19 03:01:35 EDT (Tue, 19 Oct 2010)
@@ -1,22 +1,19 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta name="generator" content="HTML Tidy for Linux (vers 1 September 2005), see www.w3.org" />
-<meta http-equiv="refresh" content="0;URL=index.htm" />
-<title>index.html not found</title>
-</head>
+ <head>
+ <meta http-equiv="refresh" content="0;URL=index.htm" />
+ <title>Boost::ublas : index.html not found</title>
+ </head>
 <body>
-<p>Please update your bookmarks to point to index.htm. You will be redirected in a second.</p>
- <p>
- Copyright (&copy;) 2000-2004 Michael Stevens, Mathias Koch,
- Joerg Walter, Gunter Winkler<br />
- Use, modification and distribution are subject to the
- Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt
- or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
- http://www.boost.org/LICENSE_1_0.txt
- </a>).
- </p>
+ <p>Please update your bookmarks to index.htm.
+ You will be redirected in a second. If not, please click on the previous link.</p>
+ <p>
+ <blockquote>
+ <i> Copyright (&copy;) 2000-2010 Michael Stevens, Mathias Koch, Joerg Walter, Gunter Winkler, David Bellot<br/>
+ Use, modification and distribution are subject to the Boost Software License, Version 1.0.<br/>
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt ).
+ </blockquote>
+ </p>
 </body>
 </html>

Modified: branches/release/libs/numeric/ublas/test/comp_mat_erase.cpp
==============================================================================
--- branches/release/libs/numeric/ublas/test/comp_mat_erase.cpp (original)
+++ branches/release/libs/numeric/ublas/test/comp_mat_erase.cpp 2010-10-19 03:01:35 EDT (Tue, 19 Oct 2010)
@@ -8,7 +8,7 @@
 {
     boost::numeric::ublas::compressed_matrix<int, boost::numeric::ublas::row_major > A(2, 2);
 
- BOOST_CHECK_EQUAL( A.filled1(), 1 );
+ BOOST_CHECK_EQUAL( A.filled1(), (int) 1 );
     BOOST_CHECK_EQUAL( A.index1_data()[0], 0 );
 
     A(0,0) = 1;

Modified: branches/release/libs/numeric/ublas/test/test11.cpp
==============================================================================
--- branches/release/libs/numeric/ublas/test/test11.cpp (original)
+++ branches/release/libs/numeric/ublas/test/test11.cpp 2010-10-19 03:01:35 EDT (Tue, 19 Oct 2010)
@@ -92,6 +92,10 @@
         v2 = v1 * value_type (1.);
         std::cout << "v1 * 1. = " << v2 << std::endl;
         v2 = v1 * t;
+ std::cout << "v1 * value_type(N) = " << v2 << std::endl;
+ // test interop with integer
+ v2 = v1 * N;
+
         std::cout << "v1 * N = " << v2 << std::endl;
 
         // Some assignments
@@ -108,6 +112,9 @@
         v1 *= value_type (1.);
         std::cout << "v1 *= 1. = " << v1 << std::endl;
         v1 *= t;
+ std::cout << "v1 *= value_type(N) = " << v1 << std::endl;
+ // test interop with integer
+ v1 *= N;
         std::cout << "v1 *= N = " << v1 << std::endl;
 
         // Unary vector operations resulting in a scalar


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