Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84594 - in branches/release/boost/numeric/ublas: . detail
From: david.bellot_at_[hidden]
Date: 2013-06-01 07:17:12


Author: david.bellot
Date: 2013-06-01 07:17:11 EDT (Sat, 01 Jun 2013)
New Revision: 84594
URL: http://svn.boost.org/trac/boost/changeset/84594

Log:
merged changes with the trunk after patch on assignment (only cosmetic changes)

Properties modified:
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/numeric/ublas/functional.hpp (props changed)
Text files modified:
   branches/release/boost/numeric/ublas/assignment.hpp | 20
   branches/release/boost/numeric/ublas/blas.hpp | 547 +++---
   branches/release/boost/numeric/ublas/detail/config.hpp | 4
   branches/release/boost/numeric/ublas/doxydoc.hpp | 93
   branches/release/boost/numeric/ublas/exception.hpp | 10
   branches/release/boost/numeric/ublas/expression_types.hpp | 3
   branches/release/boost/numeric/ublas/matrix.hpp | 68
   branches/release/boost/numeric/ublas/storage.hpp | 5
   branches/release/boost/numeric/ublas/vector.hpp | 3416 ++++++++++++++++++++--------------------
   9 files changed, 2098 insertions(+), 2068 deletions(-)

Modified: branches/release/boost/numeric/ublas/assignment.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/assignment.hpp (original)
+++ branches/release/boost/numeric/ublas/assignment.hpp 2013-06-01 07:17:11 EDT (Sat, 01 Jun 2013)
@@ -451,7 +451,7 @@
 * \endcode
 * \sa begin2()
 */
-BOOST_UBLAS_INLINE begin1_manip begin1() {
+inline begin1_manip begin1() {
     return begin1_manip();
 }
 
@@ -495,7 +495,7 @@
 * \endcode
 * \sa begin1() begin2_manip
 */
-BOOST_UBLAS_INLINE begin2_manip begin2() {
+inline begin2_manip begin2() {
     return begin2_manip();
 }
 
@@ -540,7 +540,7 @@
 * \endcode
 * \sa next_column()
 */
-BOOST_UBLAS_INLINE next_row_manip next_row() {
+inline next_row_manip next_row() {
     return next_row_manip();
 }
 
@@ -584,7 +584,7 @@
 * \endcode
 *
 */
-BOOST_UBLAS_INLINE next_column_manip next_column() {
+inline next_column_manip next_column() {
     return next_column_manip();
 }
 
@@ -885,27 +885,27 @@
  // Traverse policy namespace
 namespace traverse_policy {
 
- by_row_policy<DEFAULT_WRAP_POLICY> by_row() {
+ inline by_row_policy<DEFAULT_WRAP_POLICY> by_row() {
     return by_row_policy<DEFAULT_WRAP_POLICY>();
     }
 
- by_row_policy<wrap> by_row_wrap() {
+ inline by_row_policy<wrap> by_row_wrap() {
         return by_row_policy<wrap>();
     }
 
- by_row_policy<no_wrap> by_row_no_wrap() {
+ inline by_row_policy<no_wrap> by_row_no_wrap() {
         return by_row_policy<no_wrap>();
     }
 
- by_column_policy<DEFAULT_WRAP_POLICY> by_column() {
+ inline by_column_policy<DEFAULT_WRAP_POLICY> by_column() {
         return by_column_policy<DEFAULT_WRAP_POLICY>();
     }
 
- by_column_policy<wrap> by_column_wrap() {
+ inline by_column_policy<wrap> by_column_wrap() {
         return by_column_policy<wrap>();
     }
 
- by_column_policy<no_wrap> by_column_no_wrap() {
+ inline by_column_policy<no_wrap> by_column_no_wrap() {
         return by_column_policy<no_wrap>();
     }
 

Modified: branches/release/boost/numeric/ublas/blas.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/blas.hpp (original)
+++ branches/release/boost/numeric/ublas/blas.hpp 2013-06-01 07:17:11 EDT (Sat, 01 Jun 2013)
@@ -1,6 +1,4 @@
-//
-// Copyright (c) 2000-2002
-// Joerg Walter, Mathias Koch
+// Copyright (c) 2000-2011 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
@@ -8,7 +6,6 @@
 //
 // The authors gratefully acknowledge the support of
 // GeNeSys mbH & Co. KG in producing this work.
-//
 
 #ifndef _BOOST_UBLAS_BLAS_
 #define _BOOST_UBLAS_BLAS_
@@ -16,7 +13,7 @@
 #include <boost/numeric/ublas/traits.hpp>
 
 namespace boost { namespace numeric { namespace ublas {
-
+
 
     /** Interface and implementation of BLAS level 1
      * This includes functions which perform \b vector-vector operations.
@@ -26,12 +23,12 @@
     namespace blas_1 {
 
         /** 1-Norm: \f$\sum_i |x_i|\f$ (also called \f$\mathcal{L}_1\f$ or Manhattan norm)
- *
- * \param v a vector or vector expression
- * \return the 1-Norm with type of the vector's type
- *
- * \tparam V type of the vector (not needed by default)
- */
+ *
+ * \param v a vector or vector expression
+ * \return the 1-Norm with type of the vector's type
+ *
+ * \tparam V type of the vector (not needed by default)
+ */
         template<class V>
         typename type_traits<typename V::value_type>::real_type
         asum (const V &v) {
@@ -39,12 +36,12 @@
         }
 
         /** 2-Norm: \f$\sum_i |x_i|^2\f$ (also called \f$\mathcal{L}_2\f$ or Euclidean norm)
- *
- * \param v a vector or vector expression
- * \return the 2-Norm with type of the vector's type
- *
- * \tparam V type of the vector (not needed by default)
- */
+ *
+ * \param v a vector or vector expression
+ * \return the 2-Norm with type of the vector's type
+ *
+ * \tparam V type of the vector (not needed by default)
+ */
         template<class V>
         typename type_traits<typename V::value_type>::real_type
         nrm2 (const V &v) {
@@ -52,12 +49,12 @@
         }
 
         /** Infinite-norm: \f$\max_i |x_i|\f$ (also called \f$\mathcal{L}_\infty\f$ norm)
- *
- * \param v a vector or vector expression
- * \return the Infinite-Norm with type of the vector's type
- *
- * \tparam V type of the vector (not needed by default)
- */
+ *
+ * \param v a vector or vector expression
+ * \return the Infinite-Norm with type of the vector's type
+ *
+ * \tparam V type of the vector (not needed by default)
+ */
         template<class V>
         typename type_traits<typename V::value_type>::real_type
         amax (const V &v) {
@@ -65,14 +62,14 @@
         }
 
         /** Inner product of vectors \f$v_1\f$ and \f$v_2\f$
- *
- * \param v1 first vector of the inner product
- * \param v2 second vector of the inner product
- * \return the inner product of the type of the most generic type of the 2 vectors
- *
- * \tparam V1 type of first vector (not needed by default)
- * \tparam V2 type of second vector (not needed by default)
- */
+ *
+ * \param v1 first vector of the inner product
+ * \param v2 second vector of the inner product
+ * \return the inner product of the type of the most generic type of the 2 vectors
+ *
+ * \tparam V1 type of first vector (not needed by default)
+ * \tparam V2 type of second vector (not needed by default)
+ */
         template<class V1, class V2>
         typename promote_traits<typename V1::value_type, typename V2::value_type>::promote_type
         dot (const V1 &v1, const V2 &v2) {
@@ -80,86 +77,86 @@
         }
 
         /** Copy vector \f$v_2\f$ to \f$v_1\f$
- *
- * \param v1 target vector
- * \param v2 source vector
- * \return a reference to the target vector
- *
- * \tparam V1 type of first vector (not needed by default)
- * \tparam V2 type of second vector (not needed by default)
- */
+ *
+ * \param v1 target vector
+ * \param v2 source vector
+ * \return a reference to the target vector
+ *
+ * \tparam V1 type of first vector (not needed by default)
+ * \tparam V2 type of second vector (not needed by default)
+ */
         template<class V1, class V2>
         V1 & copy (V1 &v1, const V2 &v2)
- {
+ {
             return v1.assign (v2);
         }
 
         /** Swap vectors \f$v_1\f$ and \f$v_2\f$
- *
- * \param v1 first vector
- * \param v2 second vector
- *
+ *
+ * \param v1 first vector
+ * \param v2 second vector
+ *
          * \tparam V1 type of first vector (not needed by default)
- * \tparam V2 type of second vector (not needed by default)
- */
- template<class V1, class V2>
+ * \tparam V2 type of second vector (not needed by default)
+ */
+ template<class V1, class V2>
         void swap (V1 &v1, V2 &v2)
- {
+ {
             v1.swap (v2);
         }
 
         /** scale vector \f$v\f$ with scalar \f$t\f$
- *
- * \param v vector to be scaled
- * \param t the scalar
- * \return \c t*v
- *
- * \tparam V type of the vector (not needed by default)
- * \tparam T type of the scalar (not needed by default)
- */
+ *
+ * \param v vector to be scaled
+ * \param t the scalar
+ * \return \c t*v
+ *
+ * \tparam V type of the vector (not needed by default)
+ * \tparam T type of the scalar (not needed by default)
+ */
         template<class V, class T>
         V & scal (V &v, const T &t)
- {
+ {
             return v *= t;
         }
 
         /** Compute \f$v_1= v_1 + t.v_2\f$
- *
- * \param v1 target and first vector
- * \param t the scalar
- * \param v2 second vector
- * \return a reference to the first and target vector
- *
- * \tparam V1 type of the first vector (not needed by default)
- * \tparam T type of the scalar (not needed by default)
- * \tparam V2 type of the second vector (not needed by default)
- */
+ *
+ * \param v1 target and first vector
+ * \param t the scalar
+ * \param v2 second vector
+ * \return a reference to the first and target vector
+ *
+ * \tparam V1 type of the first vector (not needed by default)
+ * \tparam T type of the scalar (not needed by default)
+ * \tparam V2 type of the second vector (not needed by default)
+ */
         template<class V1, class T, class V2>
         V1 & axpy (V1 &v1, const T &t, const V2 &v2)
- {
+ {
             return v1.plus_assign (t * v2);
         }
 
- /** Performs rotation of points in the plane and assign the result to the first vector
- *
- * Each point is defined as a pair \c v1(i) and \c v2(i), being respectively
- * the \f$x\f$ and \f$y\f$ coordinates. The parameters \c t1 and \t2 are respectively
- * the cosine and sine of the angle of the rotation.
- * Results are not returned but directly written into \c v1.
- *
- * \param t1 cosine of the rotation
- * \param v1 vector of \f$x\f$ values
- * \param t2 sine of the rotation
- * \param v2 vector of \f$y\f$ values
- *
- * \tparam T1 type of the cosine value (not needed by default)
- * \tparam V1 type of the \f$x\f$ vector (not needed by default)
- * \tparam T2 type of the sine value (not needed by default)
- * \tparam V2 type of the \f$y\f$ vector (not needed by default)
- */
+ /** Performs rotation of points in the plane and assign the result to the first vector
+ *
+ * Each point is defined as a pair \c v1(i) and \c v2(i), being respectively
+ * the \f$x\f$ and \f$y\f$ coordinates. The parameters \c t1 and \t2 are respectively
+ * the cosine and sine of the angle of the rotation.
+ * Results are not returned but directly written into \c v1.
+ *
+ * \param t1 cosine of the rotation
+ * \param v1 vector of \f$x\f$ values
+ * \param t2 sine of the rotation
+ * \param v2 vector of \f$y\f$ values
+ *
+ * \tparam T1 type of the cosine value (not needed by default)
+ * \tparam V1 type of the \f$x\f$ vector (not needed by default)
+ * \tparam T2 type of the sine value (not needed by default)
+ * \tparam V2 type of the \f$y\f$ vector (not needed by default)
+ */
         template<class T1, class V1, class T2, class V2>
         void rot (const T1 &t1, V1 &v1, const T2 &t2, V2 &v2)
- {
+ {
             typedef typename promote_traits<typename V1::value_type, typename V2::value_type>::promote_type promote_type;
             vector<promote_type> vt (t1 * v1 + t2 * v2);
             v2.assign (- t2 * v1 + t1 * v2);
@@ -176,74 +173,74 @@
     namespace blas_2 {
 
        /** \brief multiply vector \c v with triangular matrix \c m
- *
- * \param v a vector
- * \param m a triangular matrix
- * \return the result of the product
- *
- * \tparam V type of the vector (not needed by default)
- * \tparam M type of the matrix (not needed by default)
+ *
+ * \param v a vector
+ * \param m a triangular matrix
+ * \return the result of the product
+ *
+ * \tparam V type of the vector (not needed by default)
+ * \tparam M type of the matrix (not needed by default)
         */
         template<class V, class M>
         V & tmv (V &v, const M &m)
- {
+ {
             return v = prod (m, v);
         }
 
         /** \brief solve \f$m.x = v\f$ in place, where \c m is a triangular matrix
- *
- * \param v a vector
- * \param m a matrix
- * \param C (this parameter is not needed)
- * \return a result vector from the above operation
- *
- * \tparam V type of the vector (not needed by default)
- * \tparam M type of the matrix (not needed by default)
- * \tparam C n/a
+ *
+ * \param v a vector
+ * \param m a matrix
+ * \param C (this parameter is not needed)
+ * \return a result vector from the above operation
+ *
+ * \tparam V type of the vector (not needed by default)
+ * \tparam M type of the matrix (not needed by default)
+ * \tparam C n/a
          */
         template<class V, class M, class C>
         V & tsv (V &v, const M &m, C)
- {
+ {
             return v = solve (m, v, C ());
         }
 
         /** \brief compute \f$ v_1 = t_1.v_1 + t_2.(m.v_2)\f$, a general matrix-vector product
- *
- * \param v1 a vector
- * \param t1 a scalar
- * \param t2 another scalar
- * \param m a matrix
- * \param v2 another vector
- * \return the vector \c v1 with the result from the above operation
- *
- * \tparam V1 type of first vector (not needed by default)
- * \tparam T1 type of first scalar (not needed by default)
- * \tparam T2 type of second scalar (not needed by default)
- * \tparam M type of matrix (not needed by default)
- * \tparam V2 type of second vector (not needed by default)
+ *
+ * \param v1 a vector
+ * \param t1 a scalar
+ * \param t2 another scalar
+ * \param m a matrix
+ * \param v2 another vector
+ * \return the vector \c v1 with the result from the above operation
+ *
+ * \tparam V1 type of first vector (not needed by default)
+ * \tparam T1 type of first scalar (not needed by default)
+ * \tparam T2 type of second scalar (not needed by default)
+ * \tparam M type of matrix (not needed by default)
+ * \tparam V2 type of second vector (not needed by default)
          */
         template<class V1, class T1, class T2, class M, class V2>
         V1 & gmv (V1 &v1, const T1 &t1, const T2 &t2, const M &m, const V2 &v2)
- {
+ {
             return v1 = t1 * v1 + t2 * prod (m, v2);
         }
 
         /** \brief Rank 1 update: \f$ m = m + t.(v_1.v_2^T)\f$
- *
- * \param m a matrix
- * \param t a scalar
- * \param v1 a vector
- * \param v2 another vector
- * \return a matrix with the result from the above operation
- *
- * \tparam M type of matrix (not needed by default)
- * \tparam T type of scalar (not needed by default)
- * \tparam V1 type of first vector (not needed by default)
- * \tparam V2type of second vector (not needed by default)
- */
+ *
+ * \param m a matrix
+ * \param t a scalar
+ * \param v1 a vector
+ * \param v2 another vector
+ * \return a matrix with the result from the above operation
+ *
+ * \tparam M type of matrix (not needed by default)
+ * \tparam T type of scalar (not needed by default)
+ * \tparam V1 type of first vector (not needed by default)
+ * \tparam V2type of second vector (not needed by default)
+ */
         template<class M, class T, class V1, class V2>
         M & gr (M &m, const T &t, const V1 &v1, const V2 &v2)
- {
+ {
 #ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
             return m += t * outer_prod (v1, v2);
 #else
@@ -252,19 +249,19 @@
         }
 
         /** \brief symmetric rank 1 update: \f$m = m + t.(v.v^T)\f$
- *
- * \param m a matrix
- * \param t a scalar
- * \param v a vector
- * \return a matrix with the result from the above operation
- *
- * \tparam M type of matrix (not needed by default)
- * \tparam T type of scalar (not needed by default)
- * \tparam V type of vector (not needed by default)
- */
+ *
+ * \param m a matrix
+ * \param t a scalar
+ * \param v a vector
+ * \return a matrix with the result from the above operation
+ *
+ * \tparam M type of matrix (not needed by default)
+ * \tparam T type of scalar (not needed by default)
+ * \tparam V type of vector (not needed by default)
+ */
         template<class M, class T, class V>
         M & sr (M &m, const T &t, const V &v)
- {
+ {
 #ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
             return m += t * outer_prod (v, v);
 #else
@@ -273,19 +270,19 @@
         }
 
         /** \brief hermitian rank 1 update: \f$m = m + t.(v.v^H)\f$
- *
- * \param m a matrix
- * \param t a scalar
- * \param v a vector
- * \return a matrix with the result from the above operation
- *
- * \tparam M type of matrix (not needed by default)
- * \tparam T type of scalar (not needed by default)
- * \tparam V type of vector (not needed by default)
- */
+ *
+ * \param m a matrix
+ * \param t a scalar
+ * \param v a vector
+ * \return a matrix with the result from the above operation
+ *
+ * \tparam M type of matrix (not needed by default)
+ * \tparam T type of scalar (not needed by default)
+ * \tparam V type of vector (not needed by default)
+ */
         template<class M, class T, class V>
         M & hr (M &m, const T &t, const V &v)
- {
+ {
 #ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
             return m += t * outer_prod (v, conj (v));
 #else
@@ -294,21 +291,21 @@
         }
 
          /** \brief symmetric rank 2 update: \f$ m=m+ t.(v_1.v_2^T + v_2.v_1^T)\f$
- *
- * \param m a matrix
- * \param t a scalar
- * \param v1 a vector
- * \param v2 another vector
- * \return a matrix with the result from the above operation
- *
- * \tparam M type of matrix (not needed by default)
- * \tparam T type of scalar (not needed by default)
- * \tparam V1 type of first vector (not needed by default)
- * \tparam V2type of second vector (not needed by default)
+ *
+ * \param m a matrix
+ * \param t a scalar
+ * \param v1 a vector
+ * \param v2 another vector
+ * \return a matrix with the result from the above operation
+ *
+ * \tparam M type of matrix (not needed by default)
+ * \tparam T type of scalar (not needed by default)
+ * \tparam V1 type of first vector (not needed by default)
+ * \tparam V2type of second vector (not needed by default)
           */
         template<class M, class T, class V1, class V2>
         M & sr2 (M &m, const T &t, const V1 &v1, const V2 &v2)
- {
+ {
 #ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
             return m += t * (outer_prod (v1, v2) + outer_prod (v2, v1));
 #else
@@ -317,21 +314,21 @@
         }
 
         /** \brief hermitian rank 2 update: \f$m=m+t.(v_1.v_2^H) + v_2.(t.v_1)^H)\f$
- *
- * \param m a matrix
- * \param t a scalar
- * \param v1 a vector
- * \param v2 another vector
- * \return a matrix with the result from the above operation
- *
- * \tparam M type of matrix (not needed by default)
- * \tparam T type of scalar (not needed by default)
- * \tparam V1 type of first vector (not needed by default)
- * \tparam V2type of second vector (not needed by default)
+ *
+ * \param m a matrix
+ * \param t a scalar
+ * \param v1 a vector
+ * \param v2 another vector
+ * \return a matrix with the result from the above operation
+ *
+ * \tparam M type of matrix (not needed by default)
+ * \tparam T type of scalar (not needed by default)
+ * \tparam V1 type of first vector (not needed by default)
+ * \tparam V2type of second vector (not needed by default)
          */
         template<class M, class T, class V1, class V2>
         M & hr2 (M &m, const T &t, const V1 &v1, const V2 &v2)
- {
+ {
 #ifndef BOOST_UBLAS_SIMPLE_ET_DEBUG
             return m += t * outer_prod (v1, conj (v2)) + type_traits<T>::conj (t) * outer_prod (v2, conj (v1));
 #else
@@ -349,150 +346,150 @@
     namespace blas_3 {
 
         /** \brief triangular matrix multiplication \f$m_1=t.m_2.m_3\f$ where \f$m_2\f$ and \f$m_3\f$ are triangular
- *
- * \param m1 a matrix for storing result
- * \param t a scalar
- * \param m2 a triangular matrix
- * \param m3 a triangular matrix
- * \return the matrix \c m1
- *
- * \tparam M1 type of the result matrix (not needed by default)
- * \tparam T type of the scalar (not needed by default)
- * \tparam M2 type of the first triangular matrix (not needed by default)
- * \tparam M3 type of the second triangular matrix (not needed by default)
- *
+ *
+ * \param m1 a matrix for storing result
+ * \param t a scalar
+ * \param m2 a triangular matrix
+ * \param m3 a triangular matrix
+ * \return the matrix \c m1
+ *
+ * \tparam M1 type of the result matrix (not needed by default)
+ * \tparam T type of the scalar (not needed by default)
+ * \tparam M2 type of the first triangular matrix (not needed by default)
+ * \tparam M3 type of the second triangular matrix (not needed by default)
+ *
         */
         template<class M1, class T, class M2, class M3>
         M1 & tmm (M1 &m1, const T &t, const M2 &m2, const M3 &m3)
- {
+ {
             return m1 = t * prod (m2, m3);
         }
 
         /** \brief triangular solve \f$ m_2.x = t.m_1\f$ in place, \f$m_2\f$ is a triangular matrix
- *
- * \param m1 a matrix
- * \param t a scalar
- * \param m2 a triangular matrix
- * \param C (not used)
- * \return the \f$m_1\f$ matrix
- *
- * \tparam M1 type of the first matrix (not needed by default)
- * \tparam T type of the scalar (not needed by default)
- * \tparam M2 type of the triangular matrix (not needed by default)
- * \tparam C (n/a)
+ *
+ * \param m1 a matrix
+ * \param t a scalar
+ * \param m2 a triangular matrix
+ * \param C (not used)
+ * \return the \f$m_1\f$ matrix
+ *
+ * \tparam M1 type of the first matrix (not needed by default)
+ * \tparam T type of the scalar (not needed by default)
+ * \tparam M2 type of the triangular matrix (not needed by default)
+ * \tparam C (n/a)
          */
         template<class M1, class T, class M2, class C>
         M1 & tsm (M1 &m1, const T &t, const M2 &m2, C)
- {
+ {
             return m1 = solve (m2, t * m1, C ());
         }
 
         /** \brief general matrix multiplication \f$m_1=t_1.m_1 + t_2.m_2.m_3\f$
- *
- * \param m1 first matrix
- * \param t1 first scalar
- * \param t2 second scalar
- * \param m2 second matrix
- * \param m3 third matrix
- * \return the matrix \c m1
- *
- * \tparam M1 type of the first matrix (not needed by default)
- * \tparam T1 type of the first scalar (not needed by default)
- * \tparam T2 type of the second scalar (not needed by default)
- * \tparam M2 type of the second matrix (not needed by default)
- * \tparam M3 type of the third matrix (not needed by default)
+ *
+ * \param m1 first matrix
+ * \param t1 first scalar
+ * \param t2 second scalar
+ * \param m2 second matrix
+ * \param m3 third matrix
+ * \return the matrix \c m1
+ *
+ * \tparam M1 type of the first matrix (not needed by default)
+ * \tparam T1 type of the first scalar (not needed by default)
+ * \tparam T2 type of the second scalar (not needed by default)
+ * \tparam M2 type of the second matrix (not needed by default)
+ * \tparam M3 type of the third matrix (not needed by default)
          */
         template<class M1, class T1, class T2, class M2, class M3>
         M1 & gmm (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)
- {
+ {
             return m1 = t1 * m1 + t2 * prod (m2, m3);
         }
 
         /** \brief symmetric rank \a k update: \f$m_1=t.m_1+t_2.(m_2.m_2^T)\f$
- *
- * \param m1 first matrix
- * \param t1 first scalar
- * \param t2 second scalar
- * \param m2 second matrix
- * \return matrix \c m1
- *
- * \tparam M1 type of the first matrix (not needed by default)
- * \tparam T1 type of the first scalar (not needed by default)
- * \tparam T2 type of the second scalar (not needed by default)
- * \tparam M2 type of the second matrix (not needed by default)
- * \todo use opb_prod()
+ *
+ * \param m1 first matrix
+ * \param t1 first scalar
+ * \param t2 second scalar
+ * \param m2 second matrix
+ * \return matrix \c m1
+ *
+ * \tparam M1 type of the first matrix (not needed by default)
+ * \tparam T1 type of the first scalar (not needed by default)
+ * \tparam T2 type of the second scalar (not needed by default)
+ * \tparam M2 type of the second matrix (not needed by default)
+ * \todo use opb_prod()
          */
         template<class M1, class T1, class T2, class M2>
         M1 & srk (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2)
- {
+ {
             return m1 = t1 * m1 + t2 * prod (m2, trans (m2));
         }
 
         /** \brief hermitian rank \a k update: \f$m_1=t.m_1+t_2.(m_2.m2^H)\f$
- *
- * \param m1 first matrix
- * \param t1 first scalar
- * \param t2 second scalar
- * \param m2 second matrix
- * \return matrix \c m1
- *
- * \tparam M1 type of the first matrix (not needed by default)
- * \tparam T1 type of the first scalar (not needed by default)
- * \tparam T2 type of the second scalar (not needed by default)
- * \tparam M2 type of the second matrix (not needed by default)
- * \todo use opb_prod()
+ *
+ * \param m1 first matrix
+ * \param t1 first scalar
+ * \param t2 second scalar
+ * \param m2 second matrix
+ * \return matrix \c m1
+ *
+ * \tparam M1 type of the first matrix (not needed by default)
+ * \tparam T1 type of the first scalar (not needed by default)
+ * \tparam T2 type of the second scalar (not needed by default)
+ * \tparam M2 type of the second matrix (not needed by default)
+ * \todo use opb_prod()
          */
         template<class M1, class T1, class T2, class M2>
         M1 & hrk (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2)
- {
+ {
             return m1 = t1 * m1 + t2 * prod (m2, herm (m2));
         }
 
         /** \brief generalized symmetric rank \a k update: \f$m_1=t_1.m_1+t_2.(m_2.m3^T)+t_2.(m_3.m2^T)\f$
- *
- * \param m1 first matrix
- * \param t1 first scalar
- * \param t2 second scalar
- * \param m2 second matrix
- * \param m3 third matrix
- * \return matrix \c m1
- *
- * \tparam M1 type of the first matrix (not needed by default)
- * \tparam T1 type of the first scalar (not needed by default)
- * \tparam T2 type of the second scalar (not needed by default)
- * \tparam M2 type of the second matrix (not needed by default)
- * \tparam M3 type of the third matrix (not needed by default)
- * \todo use opb_prod()
+ *
+ * \param m1 first matrix
+ * \param t1 first scalar
+ * \param t2 second scalar
+ * \param m2 second matrix
+ * \param m3 third matrix
+ * \return matrix \c m1
+ *
+ * \tparam M1 type of the first matrix (not needed by default)
+ * \tparam T1 type of the first scalar (not needed by default)
+ * \tparam T2 type of the second scalar (not needed by default)
+ * \tparam M2 type of the second matrix (not needed by default)
+ * \tparam M3 type of the third matrix (not needed by default)
+ * \todo use opb_prod()
          */
         template<class M1, class T1, class T2, class M2, class M3>
         M1 & sr2k (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)
- {
+ {
             return m1 = t1 * m1 + t2 * (prod (m2, trans (m3)) + prod (m3, trans (m2)));
         }
 
         /** \brief generalized hermitian rank \a k update: * \f$m_1=t_1.m_1+t_2.(m_2.m_3^H)+(m_3.(t_2.m_2)^H)\f$
- *
- * \param m1 first matrix
- * \param t1 first scalar
- * \param t2 second scalar
- * \param m2 second matrix
- * \param m3 third matrix
- * \return matrix \c m1
- *
- * \tparam M1 type of the first matrix (not needed by default)
- * \tparam T1 type of the first scalar (not needed by default)
- * \tparam T2 type of the second scalar (not needed by default)
- * \tparam M2 type of the second matrix (not needed by default)
- * \tparam M3 type of the third matrix (not needed by default)
- * \todo use opb_prod()
+ *
+ * \param m1 first matrix
+ * \param t1 first scalar
+ * \param t2 second scalar
+ * \param m2 second matrix
+ * \param m3 third matrix
+ * \return matrix \c m1
+ *
+ * \tparam M1 type of the first matrix (not needed by default)
+ * \tparam T1 type of the first scalar (not needed by default)
+ * \tparam T2 type of the second scalar (not needed by default)
+ * \tparam M2 type of the second matrix (not needed by default)
+ * \tparam M3 type of the third matrix (not needed by default)
+ * \todo use opb_prod()
          */
         template<class M1, class T1, class T2, class M2, class M3>
         M1 & hr2k (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)
- {
+ {
             return m1 =
- t1 * m1
- + t2 * prod (m2, herm (m3))
- + type_traits<T2>::conj (t2) * prod (m3, herm (m2));
+ t1 * m1
+ + t2 * prod (m2, herm (m3))
+ + type_traits<T2>::conj (t2) * prod (m3, herm (m2));
         }
 
     }

Modified: branches/release/boost/numeric/ublas/detail/config.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/detail/config.hpp (original)
+++ branches/release/boost/numeric/ublas/detail/config.hpp 2013-06-01 07:17:11 EDT (Sat, 01 Jun 2013)
@@ -123,6 +123,10 @@
 
 #endif
 
+// PGI compiler
+#ifdef __PGIC__
+#define BOOST_UBLAS_UNSUPPORTED_COMPILER 0
+#endif
 
 // HP aCC C++ compiler
 #if defined (__HP_aCC) && ! defined (BOOST_STRICT_CONFIG)

Modified: branches/release/boost/numeric/ublas/doxydoc.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/doxydoc.hpp (original)
+++ branches/release/boost/numeric/ublas/doxydoc.hpp 2013-06-01 07:17:11 EDT (Sat, 01 Jun 2013)
@@ -1,65 +1,58 @@
-//
-// Copyright (c) 2010
-// David Bellot
+// Copyright (c) 2010-2011 David Bellot
 //
 // 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)
-//
-// And we acknowledge the support from all contributors.
 
 /** \mainpage BOOST uBLAS: a Linear Algebra Library
  *
  * This is the API Reference Documentation.
  *
- * For introduction, documentations and tutorial, please refer
- * to http://www.boost.org/doc/libs/1_44_0/libs/numeric/ublas/doc/index.htm
- *
  * \section main_classes Main classes
  *
  * \subsection listvector Vectors
- * - \link #boost::numeric::ublas::vector vector \endlink
- * - \link #boost::numeric::ublas::bounded_vector bounded_vector \endlink
- * - \link #boost::numeric::ublas::zero_vector zero_vector \endlink
- * - \link #boost::numeric::ublas::unit_vector unit_vector \endlink
- * - \link #boost::numeric::ublas::scalar_vector scalar_vector \endlink
- * - \link #boost::numeric::ublas::c_vector c_vector \endlink
- * - \link #boost::numeric::ublas::vector_slice vector_slice \endlink
- * - \link #boost::numeric::ublas::vector_range vector_range \endlink
- * - \link #boost::numeric::ublas::vector_indirect vector_indirect \endlink
- * - \link #boost::numeric::ublas::mapped_vector mapped_vector \endlink
- * - \link #boost::numeric::ublas::compressed_vector compressed_vector \endlink
- * - \link #boost::numeric::ublas::coordinate_vector coordinate_vector \endlink
- * - \link #boost::numeric::ublas::matrix_row matrix_row \endlink
- * - \link #boost::numeric::ublas::matrix_column matrix_column \endlink
+ * - \link #boost::numeric::ublas::vector vector \endlink
+ * - \link #boost::numeric::ublas::bounded_vector bounded_vector \endlink
+ * - \link #boost::numeric::ublas::zero_vector zero_vector \endlink
+ * - \link #boost::numeric::ublas::unit_vector unit_vector \endlink
+ * - \link #boost::numeric::ublas::scalar_vector scalar_vector \endlink
+ * - \link #boost::numeric::ublas::c_vector c_vector \endlink
+ * - \link #boost::numeric::ublas::vector_slice vector_slice \endlink
+ * - \link #boost::numeric::ublas::vector_range vector_range \endlink
+ * - \link #boost::numeric::ublas::vector_indirect vector_indirect \endlink
+ * - \link #boost::numeric::ublas::mapped_vector mapped_vector \endlink
+ * - \link #boost::numeric::ublas::compressed_vector compressed_vector \endlink
+ * - \link #boost::numeric::ublas::coordinate_vector coordinate_vector \endlink
+ * - \link #boost::numeric::ublas::matrix_row matrix_row \endlink
+ * - \link #boost::numeric::ublas::matrix_column matrix_column \endlink
  *
  * \subsection listmatrix Matrices
- * - \link #boost::numeric::ublas::matrix matrix \endlink
- * - \link #boost::numeric::ublas::banded_matrix banded_matrix \endlink
- * - \link #boost::numeric::ublas::diagonal_matrix diagonal_matrix \endlink
- * - \link #boost::numeric::ublas::banded_adaptor banded_adaptor \endlink
- * - \link #boost::numeric::ublas::diagonal_adaptor diagonal_adaptor \endlink
- * - \link #boost::numeric::ublas::hermitian_matrix hermitian_matrix \endlink
- * - \link #boost::numeric::ublas::hermitian_adaptor hermitian_adaptor \endlink
- * - \link #boost::numeric::ublas::symmetric_matrix symmetric_matrix \endlink
- * - \link #boost::numeric::ublas::symmetric_adaptor symmetric_adaptor \endlink
- * - \link #boost::numeric::ublas::triangular_matrix triangular_matrix \endlink
- * - \link #boost::numeric::ublas::triangular_adaptor triangular_adaptor \endlink
- * - \link #boost::numeric::ublas::vector_of_vector vector_of_vector \endlink
- * - \link #boost::numeric::ublas::bounded_matrix bounded_matrix \endlink
- * - \link #boost::numeric::ublas::zero_matrix zero_matrix \endlink
- * - \link #boost::numeric::ublas::identity_matrix identity_matrix \endlink
- * - \link #boost::numeric::ublas::scalar_matrix scalar_matrix \endlink
- * - \link #boost::numeric::ublas::c_matrix c_matrix \endlink
- * - \link #boost::numeric::ublas::matrix_vector_range matrix_vector_range \endlink
- * - \link #boost::numeric::ublas::matrix_vector_slice matrix_vector_slice \endlink
- * - \link #boost::numeric::ublas::matrix_vector_indirect matrix_vector_indirect \endlink
- * - \link #boost::numeric::ublas::matrix_range matrix_range \endlink
- * - \link #boost::numeric::ublas::matrix_slice matrix_slice \endlink
- * - \link #boost::numeric::ublas::matrix_indirect matrix_indirect \endlink
- * - \link #boost::numeric::ublas::mapped_matrix mapped_matrix \endlink
- * - \link #boost::numeric::ublas::mapped_vector_of_mapped_vector mapped_vector_of_mapped_vector \endlink
- * - \link #boost::numeric::ublas::compressed_matrix compressed_matrix \endlink
- * - \link #boost::numeric::ublas::coordinate_matrix coordinate_matrix \endlink
- * - \link #boost::numeric::ublas::generalized_vector_of_vector generalized_vector_of_vector \endlink
+ * - \link #boost::numeric::ublas::matrix matrix \endlink
+ * - \link #boost::numeric::ublas::banded_matrix banded_matrix \endlink
+ * - \link #boost::numeric::ublas::diagonal_matrix diagonal_matrix \endlink
+ * - \link #boost::numeric::ublas::banded_adaptor banded_adaptor \endlink
+ * - \link #boost::numeric::ublas::diagonal_adaptor diagonal_adaptor \endlink
+ * - \link #boost::numeric::ublas::hermitian_matrix hermitian_matrix \endlink
+ * - \link #boost::numeric::ublas::hermitian_adaptor hermitian_adaptor \endlink
+ * - \link #boost::numeric::ublas::symmetric_matrix symmetric_matrix \endlink
+ * - \link #boost::numeric::ublas::symmetric_adaptor symmetric_adaptor \endlink
+ * - \link #boost::numeric::ublas::triangular_matrix triangular_matrix \endlink
+ * - \link #boost::numeric::ublas::triangular_adaptor triangular_adaptor \endlink
+ * - \link #boost::numeric::ublas::vector_of_vector vector_of_vector \endlink
+ * - \link #boost::numeric::ublas::bounded_matrix bounded_matrix \endlink
+ * - \link #boost::numeric::ublas::zero_matrix zero_matrix \endlink
+ * - \link #boost::numeric::ublas::identity_matrix identity_matrix \endlink
+ * - \link #boost::numeric::ublas::scalar_matrix scalar_matrix \endlink
+ * - \link #boost::numeric::ublas::c_matrix c_matrix \endlink
+ * - \link #boost::numeric::ublas::matrix_vector_range matrix_vector_range \endlink
+ * - \link #boost::numeric::ublas::matrix_vector_slice matrix_vector_slice \endlink
+ * - \link #boost::numeric::ublas::matrix_vector_indirect matrix_vector_indirect \endlink
+ * - \link #boost::numeric::ublas::matrix_range matrix_range \endlink
+ * - \link #boost::numeric::ublas::matrix_slice matrix_slice \endlink
+ * - \link #boost::numeric::ublas::matrix_indirect matrix_indirect \endlink
+ * - \link #boost::numeric::ublas::mapped_matrix mapped_matrix \endlink
+ * - \link #boost::numeric::ublas::mapped_vector_of_mapped_vector mapped_vector_of_mapped_vector \endlink
+ * - \link #boost::numeric::ublas::compressed_matrix compressed_matrix \endlink
+ * - \link #boost::numeric::ublas::coordinate_matrix coordinate_matrix \endlink
+ * - \link #boost::numeric::ublas::generalized_vector_of_vector generalized_vector_of_vector \endlink
  */

Modified: branches/release/boost/numeric/ublas/exception.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/exception.hpp (original)
+++ branches/release/boost/numeric/ublas/exception.hpp 2013-06-01 07:17:11 EDT (Sat, 01 Jun 2013)
@@ -1,14 +1,8 @@
-//
-// Copyright (c) 2000-2002
-// Joerg Walter, Mathias Koch
+// Copyright (c) 2000-2011 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
 // http://www.boost.org/LICENSE_1_0.txt)
-//
-// The authors gratefully acknowledge the support of
-// GeNeSys mbH & Co. KG in producing this work.
-//
 
 #ifndef _BOOST_UBLAS_EXCEPTION_
 #define _BOOST_UBLAS_EXCEPTION_
@@ -32,7 +26,7 @@
 #if ! defined (BOOST_NO_EXCEPTIONS) && ! defined (BOOST_UBLAS_NO_EXCEPTIONS)
         // Inherit from standard exceptions as requested during review.
         : public std::runtime_error
- {
+ {
         explicit divide_by_zero (const char *s = "divide by zero") :
             std::runtime_error (s) {}
         void raise () {

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 2013-06-01 07:17:11 EDT (Sat, 01 Jun 2013)
@@ -1,5 +1,4 @@
-//
-// Copyright (c) 2000-2010
+// Copyright (c) 2000-2013
 // Joerg Walter, Mathias Koch. David Bellot
 //
 // Distributed under the Boost Software License, Version 1.0. (See

Modified: branches/release/boost/numeric/ublas/matrix.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/matrix.hpp (original)
+++ branches/release/boost/numeric/ublas/matrix.hpp 2013-06-01 07:17:11 EDT (Sat, 01 Jun 2013)
@@ -116,30 +116,30 @@
         // 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_ () {}
-
+ 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)) {
- }
-
+ 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) {
- }
+ 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
@@ -225,29 +225,67 @@
         }
 
         // Element access
+
+ /** Access a matrix element. Here we return a const reference
+ * \param i the first coordinate of the element. By default it's the row
+ * \param j the second coordinate of the element. By default it's the column
+ * \return a const reference to the element
+ */
         BOOST_UBLAS_INLINE
         const_reference operator () (size_type i, size_type j) const {
             return data () [layout_type::element (i, size1_, j, size2_)];
         }
+
+ /** Access a matrix element. Here we return a reference
+ * \param i the first coordinate of the element. By default it's the row
+ * \param j the second coordinate of the element. By default it's the column
+ * \return a reference to the element
+ */
         BOOST_UBLAS_INLINE
         reference at_element (size_type i, size_type j) {
             return data () [layout_type::element (i, size1_, j, size2_)];
         }
+
+ /** Access a matrix element. Here we return a reference
+ * \param i the first coordinate of the element. By default it's the row
+ * \param j the second coordinate of the element. By default it's the column
+ * \return a reference to the element
+ */
         BOOST_UBLAS_INLINE
         reference operator () (size_type i, size_type j) {
             return at_element (i, j);
         }
 
         // Element assignment
+
+ /** Change the value of a matrix element. Return back a reference to it
+ * \param i the first coordinate of the element. By default it's the row
+ * \param j the second coordinate of the element. By default it's the column
+ * \param t the new value of the element
+ * \return a reference to the newly changed element
+ */
         BOOST_UBLAS_INLINE
         reference insert_element (size_type i, size_type j, const_reference t) {
             return (at_element (i, j) = t);
         }
+
+ /** Erase the element
+ * For most types (int, double, etc...) it means setting 0 (zero) the element at zero in fact.
+ * For user-defined types, it could be another value if you decided it. Your type in that case must
+ * contain a default null value.
+ * \param i the first coordinate of the element. By default it's the row
+ * \param j the second coordinate of the element. By default it's the column
+ */
         void erase_element (size_type i, size_type j) {
             at_element (i, j) = value_type/*zero*/();
         }
 
         // Zeroing
+ /** Erase all elements in the matrix
+ * For most types (int, double, etc...) it means writing 0 (zero) everywhere.
+ * For user-defined types, it could be another value if you decided it. Your type in that case must
+ * contain a default null value.
+ */
         BOOST_UBLAS_INLINE
         void clear () {
             std::fill (data ().begin (), data ().end (), value_type/*zero*/());

Modified: branches/release/boost/numeric/ublas/storage.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/storage.hpp (original)
+++ branches/release/boost/numeric/ublas/storage.hpp 2013-06-01 07:17:11 EDT (Sat, 01 Jun 2013)
@@ -464,7 +464,12 @@
 
     private:
         size_type size_;
+// MSVC does not like arrays of size 0 in base classes. Hence, this conditionally changes the size to 1
+#ifdef _MSC_VER
+ BOOST_UBLAS_BOUNDED_ARRAY_ALIGN value_type data_ [(N>0)?N:1];
+#else
         BOOST_UBLAS_BOUNDED_ARRAY_ALIGN value_type data_ [N];
+#endif
     };
 
 

Modified: branches/release/boost/numeric/ublas/vector.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/vector.hpp (original)
+++ branches/release/boost/numeric/ublas/vector.hpp 2013-06-01 07:17:11 EDT (Sat, 01 Jun 2013)
@@ -27,315 +27,315 @@
 
 namespace boost { namespace numeric { namespace ublas {
 
- /** \brief A dense vector of values of type \c T.
- *
- * For a \f$n\f$-dimensional vector \f$v\f$ and \f$0\leq i < n\f$ every element \f$v_i\f$ is mapped
- * to the \f$i\f$-th element of the container. A storage type \c A can be specified which defaults to \c unbounded_array.
- * Elements are constructed by \c A, which need not initialise their value.
- *
- * \tparam T type of the objects stored in the vector (like int, double, complex,...)
- * \tparam A The type of the storage array of the vector. Default is \c unbounded_array<T>. \c <bounded_array<T> and \c std::vector<T> can also be used
- */
- template<class T, class A>
- class vector:
- public vector_container<vector<T, A> > {
+ /** \brief A dense vector of values of type \c T.
+ *
+ * For a \f$n\f$-dimensional vector \f$v\f$ and \f$0\leq i < n\f$ every element \f$v_i\f$ is mapped
+ * to the \f$i\f$-th element of the container. A storage type \c A can be specified which defaults to \c unbounded_array.
+ * Elements are constructed by \c A, which need not initialise their value.
+ *
+ * \tparam T type of the objects stored in the vector (like int, double, complex,...)
+ * \tparam A The type of the storage array of the vector. Default is \c unbounded_array<T>. \c <bounded_array<T> and \c std::vector<T> can also be used
+ */
+ template<class T, class A>
+ class vector:
+ public vector_container<vector<T, A> > {
 
- typedef vector<T, A> self_type;
- public:
+ typedef vector<T, A> self_type;
+ public:
 #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS
- using vector_container<self_type>::operator ();
+ using vector_container<self_type>::operator ();
 #endif
 
         typedef typename A::size_type size_type;
- typedef typename A::difference_type difference_type;
- typedef T value_type;
- typedef typename type_traits<T>::const_reference const_reference;
- typedef T &reference;
- typedef T *pointer;
- typedef const T *const_pointer;
- typedef A array_type;
- typedef const vector_reference<const self_type> const_closure_type;
- typedef vector_reference<self_type> closure_type;
- typedef self_type vector_temporary_type;
- typedef dense_tag storage_category;
+ typedef typename A::difference_type difference_type;
+ typedef T value_type;
+ typedef typename type_traits<T>::const_reference const_reference;
+ typedef T &reference;
+ typedef T *pointer;
+ typedef const T *const_pointer;
+ typedef A array_type;
+ typedef const vector_reference<const self_type> const_closure_type;
+ typedef vector_reference<self_type> closure_type;
+ typedef self_type vector_temporary_type;
+ typedef dense_tag storage_category;
 
- // Construction and destruction
+ // Construction and destruction
         
         /// \brief Constructor of a vector
         /// By default it is empty, i.e. \c size()==0.
- BOOST_UBLAS_INLINE
- vector ():
- vector_container<self_type> (),
- data_ () {}
+ BOOST_UBLAS_INLINE
+ vector ():
+ vector_container<self_type> (),
+ data_ () {}
 
         /// \brief Constructor of a vector with a predefined size
         /// By default, its elements are initialized to 0.
         /// \param size initial size of the vector
- explicit BOOST_UBLAS_INLINE
- vector (size_type size):
- vector_container<self_type> (),
- data_ (size) {
- }
+ explicit BOOST_UBLAS_INLINE
+ vector (size_type size):
+ vector_container<self_type> (),
+ data_ (size) {
+ }
 
         /// \brief Constructor of a vector by copying from another container
         /// This type has the generic name \c array_typ within the vector definition.
         /// \param size initial size of the vector \bug this value is not used
         /// \param data container of type \c A
         /// \todo remove this definition because \c size is not used
- BOOST_UBLAS_INLINE
- vector (size_type size, const array_type &data):
- vector_container<self_type> (),
- data_ (data) {}
+ BOOST_UBLAS_INLINE
+ vector (size_type size, const array_type &data):
+ vector_container<self_type> (),
+ data_ (data) {}
 
         /// \brief Constructor of a vector by copying from another container
         /// This type has the generic name \c array_typ within the vector definition.
         /// \param data container of type \c A
- BOOST_UBLAS_INLINE
- vector (const array_type &data):
- vector_container<self_type> (),
- data_ (data) {}
+ BOOST_UBLAS_INLINE
+ vector (const array_type &data):
+ vector_container<self_type> (),
+ data_ (data) {}
 
         /// \brief Constructor of a vector with a predefined size and a unique initial value
         /// \param size of the vector
         /// \param init value to assign to each element of the vector
- BOOST_UBLAS_INLINE
- vector (size_type size, const value_type &init):
- vector_container<self_type> (),
- data_ (size, init) {}
+ BOOST_UBLAS_INLINE
+ vector (size_type size, const value_type &init):
+ vector_container<self_type> (),
+ data_ (size, init) {}
 
         /// \brief Copy-constructor of a vector
         /// \param v is the vector to be duplicated
- BOOST_UBLAS_INLINE
- vector (const vector &v):
- vector_container<self_type> (),
- data_ (v.data_) {}
+ BOOST_UBLAS_INLINE
+ vector (const vector &v):
+ vector_container<self_type> (),
+ data_ (v.data_) {}
 
         /// \brief Copy-constructor of a vector from a vector_expression
         /// Depending on the vector_expression, this constructor can have the cost of the computations
         /// of the expression (trivial to say it, but it is to take into account in your complexity calculations).
         /// \param ae the vector_expression which values will be duplicated into the vector
- template<class AE>
- BOOST_UBLAS_INLINE
- vector (const vector_expression<AE> &ae):
- vector_container<self_type> (),
- data_ (ae ().size ()) {
- vector_assign<scalar_assign> (*this, ae);
- }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ vector (const vector_expression<AE> &ae):
+ vector_container<self_type> (),
+ data_ (ae ().size ()) {
+ vector_assign<scalar_assign> (*this, ae);
+ }
 
         // -----------------------
- // Random Access Container
+ // Random Access Container
         // -----------------------
         
         /// \brief Return the maximum size of the data container.
         /// Return the upper bound (maximum size) on the data container. Depending on the container, it can be bigger than the current size of the vector.
- BOOST_UBLAS_INLINE
- size_type max_size () const {
- return data_.max_size ();
- }
-
+ BOOST_UBLAS_INLINE
+ size_type max_size () const {
+ return data_.max_size ();
+ }
+
         /// \brief Return true if the vector is empty (\c size==0)
         /// \return \c true if empty, \c false otherwise
- BOOST_UBLAS_INLINE
- bool empty () const {
- return data_.size () == 0;
- }
+ BOOST_UBLAS_INLINE
+ bool empty () const {
+ return data_.size () == 0;
+ }
 
         // ---------
- // Accessors
+ // Accessors
         // ---------
         
         /// \brief Return the size of the vector
- BOOST_UBLAS_INLINE
- size_type size () const {
- return data_.size ();
- }
+ BOOST_UBLAS_INLINE
+ size_type size () const {
+ return data_.size ();
+ }
 
         // -----------------
- // Storage accessors
+ // Storage accessors
         // -----------------
         
         /// \brief Return a \c const reference to the container. Useful to access data directly for specific type of container.
- BOOST_UBLAS_INLINE
- const array_type &data () const {
- return data_;
- }
+ BOOST_UBLAS_INLINE
+ const array_type &data () const {
+ return data_;
+ }
 
         /// \brief Return a reference to the container. Useful to speed-up write operations to the data in very specific case.
- BOOST_UBLAS_INLINE
- array_type &data () {
- return data_;
- }
+ BOOST_UBLAS_INLINE
+ array_type &data () {
+ return data_;
+ }
 
         // --------
- // Resizing
+ // Resizing
         // --------
         
         /// \brief Resize the vector
         /// Resize the vector to a new size. If \c preserve is true, data are copied otherwise data are lost. If the new size is bigger, the remaining values are filled in with the initial value (0 by default) in the case of \c unbounded_array, which is the container by default. If the new size is smaller, last values are lost. This behaviour can be different if you explicitely specify another type of container.
         /// \param size new size of the vector
         /// \param preserve if true, keep values
- BOOST_UBLAS_INLINE
- void resize (size_type size, bool preserve = true) {
- if (preserve)
- data ().resize (size, typename A::value_type ());
- else
- data ().resize (size);
- }
+ BOOST_UBLAS_INLINE
+ void resize (size_type size, bool preserve = true) {
+ if (preserve)
+ data ().resize (size, typename A::value_type ());
+ else
+ data ().resize (size);
+ }
 
         // ---------------
- // Element support
+ // Element support
         // ---------------
         
         /// \brief Return a pointer to the element \f$i\f$
         /// \param i index of the element
         // XXX this semantic is not the one expected by the name of this method
- BOOST_UBLAS_INLINE
- pointer find_element (size_type i) {
- return const_cast<pointer> (const_cast<const self_type&>(*this).find_element (i));
- }
+ BOOST_UBLAS_INLINE
+ pointer find_element (size_type i) {
+ return const_cast<pointer> (const_cast<const self_type&>(*this).find_element (i));
+ }
 
         /// \brief Return a const pointer to the element \f$i\f$
         /// \param i index of the element
         // XXX this semantic is not the one expected by the name of this method
- BOOST_UBLAS_INLINE
- const_pointer find_element (size_type i) const {
- return & (data () [i]);
- }
+ BOOST_UBLAS_INLINE
+ const_pointer find_element (size_type i) const {
+ return & (data () [i]);
+ }
 
         // --------------
- // Element access
+ // Element access
         // --------------
 
         /// \brief Return a const reference to the element \f$i\f$
         /// Return a const reference to the element \f$i\f$. With some compilers, this notation will be faster than \c[i]
         /// \param i index of the element
- BOOST_UBLAS_INLINE
- const_reference operator () (size_type i) const {
- return data () [i];
- }
+ BOOST_UBLAS_INLINE
+ const_reference operator () (size_type i) const {
+ return data () [i];
+ }
         
         /// \brief Return a reference to the element \f$i\f$
         /// Return a reference to the element \f$i\f$. With some compilers, this notation will be faster than \c[i]
         /// \param i index of the element
- BOOST_UBLAS_INLINE
- reference operator () (size_type i) {
- return data () [i];
- }
+ BOOST_UBLAS_INLINE
+ reference operator () (size_type i) {
+ return data () [i];
+ }
 
         /// \brief Return a const reference to the element \f$i\f$
         /// \param i index of the element
- BOOST_UBLAS_INLINE
- const_reference operator [] (size_type i) const {
- return (*this) (i);
- }
+ BOOST_UBLAS_INLINE
+ const_reference operator [] (size_type i) const {
+ return (*this) (i);
+ }
         
         /// \brief Return a reference to the element \f$i\f$
         /// \param i index of the element
- BOOST_UBLAS_INLINE
- reference operator [] (size_type i) {
- return (*this) (i);
- }
+ BOOST_UBLAS_INLINE
+ reference operator [] (size_type i) {
+ return (*this) (i);
+ }
 
         // ------------------
- // Element assignment
+ // Element assignment
         // ------------------
         
         /// \brief Set element \f$i\f$ to the value \c t
         /// \param i index of the element
         /// \param t reference to the value to be set
         // XXX semantic of this is to insert a new element and therefore size=size+1 ?
- BOOST_UBLAS_INLINE
- reference insert_element (size_type i, const_reference t) {
- return (data () [i] = t);
- }
+ BOOST_UBLAS_INLINE
+ reference insert_element (size_type i, const_reference t) {
+ return (data () [i] = t);
+ }
 
         /// \brief Set element \f$i\f$ to the \e zero value
         /// \param i index of the element
- BOOST_UBLAS_INLINE
- void erase_element (size_type i) {
- data () [i] = value_type/*zero*/();
- }
-
+ BOOST_UBLAS_INLINE
+ void erase_element (size_type i) {
+ data () [i] = value_type/*zero*/();
+ }
+
         // -------
- // Zeroing
+ // Zeroing
         // -------
         
         /// \brief Clear the vector, i.e. set all values to the \c zero value.
- BOOST_UBLAS_INLINE
- void clear () {
- std::fill (data ().begin (), data ().end (), value_type/*zero*/());
- }
+ BOOST_UBLAS_INLINE
+ void clear () {
+ std::fill (data ().begin (), data ().end (), value_type/*zero*/());
+ }
 
- // Assignment
+ // Assignment
 #ifdef BOOST_UBLAS_MOVE_SEMANTICS
 
         /// \brief Assign a full vector (\e RHS-vector) to the current vector (\e LHS-vector)
         /// \param v is the source vector
         /// \return a reference to a vector (i.e. the destination vector)
- /*! @note "pass by value" the key idea to enable move semantics */
- BOOST_UBLAS_INLINE
- vector &operator = (vector v) {
- assign_temporary(v);
- return *this;
- }
+ /*! @note "pass by value" the key idea to enable move semantics */
+ BOOST_UBLAS_INLINE
+ vector &operator = (vector v) {
+ assign_temporary(v);
+ return *this;
+ }
 #else
         /// \brief Assign a full vector (\e RHS-vector) to the current vector (\e LHS-vector)
         /// \param v is the source vector
         /// \return a reference to a vector (i.e. the destination vector)
- BOOST_UBLAS_INLINE
- vector &operator = (const vector &v) {
- data () = v.data ();
- return *this;
- }
+ BOOST_UBLAS_INLINE
+ vector &operator = (const vector &v) {
+ data () = v.data ();
+ return *this;
+ }
 #endif
 
         /// \brief Assign a full vector (\e RHS-vector) to the current vector (\e LHS-vector)
         /// Assign a full vector (\e RHS-vector) to the current vector (\e LHS-vector). This method does not create any temporary.
         /// \param v is the source vector container
         /// \return a reference to a vector (i.e. the destination vector)
- template<class C> // Container assignment without temporary
- BOOST_UBLAS_INLINE
- vector &operator = (const vector_container<C> &v) {
- resize (v ().size (), false);
- assign (v);
- return *this;
- }
+ template<class C> // Container assignment without temporary
+ BOOST_UBLAS_INLINE
+ vector &operator = (const vector_container<C> &v) {
+ resize (v ().size (), false);
+ assign (v);
+ return *this;
+ }
 
         /// \brief Assign a full vector (\e RHS-vector) to the current vector (\e LHS-vector)
         /// \param v is the source vector
         /// \return a reference to a vector (i.e. the destination vector)
- BOOST_UBLAS_INLINE
- vector &assign_temporary (vector &v) {
- swap (v);
- return *this;
- }
+ BOOST_UBLAS_INLINE
+ vector &assign_temporary (vector &v) {
+ swap (v);
+ return *this;
+ }
 
         /// \brief Assign the result of a vector_expression to the vector
         /// Assign the result of a vector_expression to the vector. This is lazy-compiled and will be optimized out by the compiler on any type of expression.
         /// \tparam AE is the type of the vector_expression
         /// \param ae is a const reference to the vector_expression
         /// \return a reference to the resulting vector
- template<class AE>
- BOOST_UBLAS_INLINE
- vector &operator = (const vector_expression<AE> &ae) {
- self_type temporary (ae);
- return assign_temporary (temporary);
- }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ vector &operator = (const vector_expression<AE> &ae) {
+ self_type temporary (ae);
+ return assign_temporary (temporary);
+ }
 
         /// \brief Assign the result of a vector_expression to the vector
         /// Assign the result of a vector_expression to the vector. This is lazy-compiled and will be optimized out by the compiler on any type of expression.
         /// \tparam AE is the type of the vector_expression
         /// \param ae is a const reference to the vector_expression
         /// \return a reference to the resulting vector
- template<class AE>
- BOOST_UBLAS_INLINE
- vector &assign (const vector_expression<AE> &ae) {
- vector_assign<scalar_assign> (*this, ae);
- return *this;
- }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ vector &assign (const vector_expression<AE> &ae) {
+ vector_assign<scalar_assign> (*this, ae);
+ return *this;
+ }
 
         // -------------------
- // Computed assignment
+ // Computed assignment
         // -------------------
         
         /// \brief Assign the sum of the vector and a vector_expression to the vector
@@ -344,12 +344,12 @@
         /// \tparam AE is the type of the vector_expression
         /// \param ae is a const reference to the vector_expression
         /// \return a reference to the resulting vector
- template<class AE>
- BOOST_UBLAS_INLINE
- vector &operator += (const vector_expression<AE> &ae) {
- self_type temporary (*this + ae);
- return assign_temporary (temporary);
- }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ vector &operator += (const vector_expression<AE> &ae) {
+ self_type temporary (*this + ae);
+ return assign_temporary (temporary);
+ }
 
         /// \brief Assign the sum of the vector and a vector_expression to the vector
         /// Assign the sum of the vector and a vector_expression to the vector. This is lazy-compiled and will be optimized out by the compiler on any type of expression.
@@ -357,12 +357,12 @@
         /// \tparam AE is the type of the vector_expression
         /// \param ae is a const reference to the vector_expression
         /// \return a reference to the resulting vector
- template<class C> // Container assignment without temporary
- BOOST_UBLAS_INLINE
- vector &operator += (const vector_container<C> &v) {
- plus_assign (v);
- return *this;
- }
+ template<class C> // Container assignment without temporary
+ BOOST_UBLAS_INLINE
+ vector &operator += (const vector_container<C> &v) {
+ plus_assign (v);
+ return *this;
+ }
 
         /// \brief Assign the sum of the vector and a vector_expression to the vector
         /// Assign the sum of the vector and a vector_expression to the vector. This is lazy-compiled and will be optimized out by the compiler on any type of expression.
@@ -370,24 +370,24 @@
         /// \tparam AE is the type of the vector_expression
         /// \param ae is a const reference to the vector_expression
         /// \return a reference to the resulting vector
- template<class AE>
- BOOST_UBLAS_INLINE
- vector &plus_assign (const vector_expression<AE> &ae) {
- vector_assign<scalar_plus_assign> (*this, ae);
- return *this;
- }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ vector &plus_assign (const vector_expression<AE> &ae) {
+ vector_assign<scalar_plus_assign> (*this, ae);
+ return *this;
+ }
         
         /// \brief Assign the difference of the vector and a vector_expression to the vector
         /// Assign the difference of the vector and a vector_expression to the vector. This is lazy-compiled and will be optimized out by the compiler on any type of expression.
         /// A temporary is created for the computations.
         /// \tparam AE is the type of the vector_expression
         /// \param ae is a const reference to the vector_expression
- template<class AE>
- BOOST_UBLAS_INLINE
- vector &operator -= (const vector_expression<AE> &ae) {
- self_type temporary (*this - ae);
- return assign_temporary (temporary);
- }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ vector &operator -= (const vector_expression<AE> &ae) {
+ self_type temporary (*this - ae);
+ return assign_temporary (temporary);
+ }
 
         /// \brief Assign the difference of the vector and a vector_expression to the vector
         /// Assign the difference of the vector and a vector_expression to the vector. This is lazy-compiled and will be optimized out by the compiler on any type of expression.
@@ -395,12 +395,12 @@
         /// \tparam AE is the type of the vector_expression
         /// \param ae is a const reference to the vector_expression
         /// \return a reference to the resulting vector
- template<class C> // Container assignment without temporary
- BOOST_UBLAS_INLINE
- vector &operator -= (const vector_container<C> &v) {
- minus_assign (v);
- return *this;
- }
+ template<class C> // Container assignment without temporary
+ BOOST_UBLAS_INLINE
+ vector &operator -= (const vector_container<C> &v) {
+ minus_assign (v);
+ return *this;
+ }
 
         /// \brief Assign the difference of the vector and a vector_expression to the vector
         /// Assign the difference of the vector and a vector_expression to the vector. This is lazy-compiled and will be optimized out by the compiler on any type of expression.
@@ -408,12 +408,12 @@
         /// \tparam AE is the type of the vector_expression
         /// \param ae is a const reference to the vector_expression
         /// \return a reference to the resulting vector
- template<class AE>
- BOOST_UBLAS_INLINE
- vector &minus_assign (const vector_expression<AE> &ae) {
- vector_assign<scalar_minus_assign> (*this, ae);
- return *this;
- }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ vector &minus_assign (const vector_expression<AE> &ae) {
+ vector_assign<scalar_minus_assign> (*this, ae);
+ return *this;
+ }
 
         /// \brief Assign the product of the vector and a scalar to the vector
         /// Assign the product of the vector and a scalar to the vector. This is lazy-compiled and will be optimized out by the compiler on any type of expression.
@@ -421,12 +421,12 @@
         /// \tparam AE is the type of the vector_expression
         /// \param at is a const reference to the scalar
         /// \return a reference to the resulting vector
- template<class AT>
- BOOST_UBLAS_INLINE
- vector &operator *= (const AT &at) {
- vector_assign_scalar<scalar_multiplies_assign> (*this, at);
- return *this;
- }
+ template<class AT>
+ BOOST_UBLAS_INLINE
+ vector &operator *= (const AT &at) {
+ vector_assign_scalar<scalar_multiplies_assign> (*this, at);
+ return *this;
+ }
 
         /// \brief Assign the division of the vector by a scalar to the vector
         /// Assign the division of the vector by a scalar to the vector. This is lazy-compiled and will be optimized out by the compiler on any type of expression.
@@ -434,1643 +434,1643 @@
         /// \tparam AE is the type of the vector_expression
         /// \param at is a const reference to the scalar
         /// \return a reference to the resulting vector
- template<class AT>
- BOOST_UBLAS_INLINE
- vector &operator /= (const AT &at) {
- vector_assign_scalar<scalar_divides_assign> (*this, at);
- return *this;
- }
-
+ template<class AT>
+ BOOST_UBLAS_INLINE
+ vector &operator /= (const AT &at) {
+ vector_assign_scalar<scalar_divides_assign> (*this, at);
+ return *this;
+ }
+
         // --------
- // Swapping
+ // Swapping
         // --------
-
+
         /// \brief Swap the content of the vector with another vector
         /// \param v is the vector to be swapped with
- BOOST_UBLAS_INLINE
- void swap (vector &v) {
- if (this != &v) {
- data ().swap (v.data ());
- }
- }
+ BOOST_UBLAS_INLINE
+ void swap (vector &v) {
+ if (this != &v) {
+ data ().swap (v.data ());
+ }
+ }
 
         /// \brief Swap the content of two vectors
         /// \param v1 is the first vector. It takes values from v2
         /// \param v2 is the second vector It takes values from v1
- BOOST_UBLAS_INLINE
- friend void swap (vector &v1, vector &v2) {
- v1.swap (v2);
- }
-
- // Iterator types
- private:
- // Use the storage array iterator
- typedef typename A::const_iterator const_subiterator_type;
- typedef typename A::iterator subiterator_type;
+ BOOST_UBLAS_INLINE
+ friend void swap (vector &v1, vector &v2) {
+ v1.swap (v2);
+ }
+
+ // Iterator types
+ private:
+ // Use the storage array iterator
+ typedef typename A::const_iterator const_subiterator_type;
+ typedef typename A::iterator subiterator_type;
 
- public:
+ public:
 #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR
- typedef indexed_iterator<self_type, dense_random_access_iterator_tag> iterator;
- typedef indexed_const_iterator<self_type, dense_random_access_iterator_tag> const_iterator;
+ typedef indexed_iterator<self_type, dense_random_access_iterator_tag> iterator;
+ typedef indexed_const_iterator<self_type, dense_random_access_iterator_tag> const_iterator;
 #else
- class const_iterator;
- class iterator;
+ class const_iterator;
+ class iterator;
 #endif
 
         // --------------
- // Element lookup
+ // Element lookup
         // --------------
         
         /// \brief Return a const iterator to the element \e i
         /// \param i index of the element
- BOOST_UBLAS_INLINE
- const_iterator find (size_type i) const {
+ BOOST_UBLAS_INLINE
+ const_iterator find (size_type i) const {
 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
- return const_iterator (*this, data ().begin () + i);
+ return const_iterator (*this, data ().begin () + i);
 #else
- return const_iterator (*this, i);
+ return const_iterator (*this, i);
 #endif
- }
+ }
 
         /// \brief Return an iterator to the element \e i
         /// \param i index of the element
- BOOST_UBLAS_INLINE
- iterator find (size_type i) {
+ BOOST_UBLAS_INLINE
+ iterator find (size_type i) {
 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
- return iterator (*this, data ().begin () + i);
+ return iterator (*this, data ().begin () + i);
 #else
- return iterator (*this, i);
+ return iterator (*this, i);
 #endif
- }
+ }
 
 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
- class const_iterator:
- public container_const_reference<vector>,
- public random_access_iterator_base<dense_random_access_iterator_tag,
- const_iterator, value_type, difference_type> {
- public:
- typedef typename vector::difference_type difference_type;
- typedef typename vector::value_type value_type;
- typedef typename vector::const_reference reference;
- typedef const typename vector::pointer pointer;
+ class const_iterator:
+ public container_const_reference<vector>,
+ public random_access_iterator_base<dense_random_access_iterator_tag,
+ const_iterator, value_type, difference_type> {
+ public:
+ typedef typename vector::difference_type difference_type;
+ typedef typename vector::value_type value_type;
+ typedef typename vector::const_reference reference;
+ typedef const typename vector::pointer pointer;
 
             // ----------------------------
- // Construction and destruction
+ // Construction and destruction
             // ----------------------------
-
-
- BOOST_UBLAS_INLINE
- const_iterator ():
- container_const_reference<self_type> (), it_ () {}
- BOOST_UBLAS_INLINE
- const_iterator (const self_type &v, const const_subiterator_type &it):
- container_const_reference<self_type> (v), it_ (it) {}
- BOOST_UBLAS_INLINE
- const_iterator (const typename self_type::iterator &it): // ISSUE vector:: stops VC8 using std::iterator here
- container_const_reference<self_type> (it ()), it_ (it.it_) {}
-
+
+
+ BOOST_UBLAS_INLINE
+ const_iterator ():
+ container_const_reference<self_type> (), it_ () {}
+ BOOST_UBLAS_INLINE
+ const_iterator (const self_type &v, const const_subiterator_type &it):
+ container_const_reference<self_type> (v), it_ (it) {}
+ BOOST_UBLAS_INLINE
+ const_iterator (const typename self_type::iterator &it): // ISSUE vector:: stops VC8 using std::iterator here
+ container_const_reference<self_type> (it ()), it_ (it.it_) {}
+
             // ----------
- // Arithmetic
+ // Arithmetic
             // ----------
-
+
             /// \brief Increment by 1 the position of the iterator
             /// \return a reference to the const iterator
- BOOST_UBLAS_INLINE
- const_iterator &operator ++ () {
- ++ it_;
- return *this;
- }
+ BOOST_UBLAS_INLINE
+ const_iterator &operator ++ () {
+ ++ it_;
+ return *this;
+ }
 
             /// \brief Decrement by 1 the position of the iterator
             /// \return a reference to the const iterator
- BOOST_UBLAS_INLINE
- const_iterator &operator -- () {
- -- it_;
- return *this;
- }
+ BOOST_UBLAS_INLINE
+ const_iterator &operator -- () {
+ -- it_;
+ return *this;
+ }
           
             /// \brief Increment by \e n the position of the iterator
             /// \return a reference to the const iterator
- BOOST_UBLAS_INLINE
- const_iterator &operator += (difference_type n) {
- it_ += n;
- return *this;
- }
-
+ BOOST_UBLAS_INLINE
+ const_iterator &operator += (difference_type n) {
+ it_ += n;
+ return *this;
+ }
+
             /// \brief Decrement by \e n the position of the iterator
             /// \return a reference to the const iterator
- BOOST_UBLAS_INLINE
- const_iterator &operator -= (difference_type n) {
- it_ -= n;
- return *this;
- }
-
+ BOOST_UBLAS_INLINE
+ const_iterator &operator -= (difference_type n) {
+ it_ -= n;
+ return *this;
+ }
+
             /// \brief Return the different in number of positions between 2 iterators
- BOOST_UBLAS_INLINE
- difference_type operator - (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ - it.it_;
- }
-
- /// \brief Dereference an iterator
- /// Dereference an iterator: a bounds' check is done before returning the value. A bad_index() expection is returned if out of bounds.
+ BOOST_UBLAS_INLINE
+ difference_type operator - (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ - it.it_;
+ }
+
+ /// \brief Dereference an iterator
+ /// Dereference an iterator: a bounds' check is done before returning the value. A bad_index() expection is returned if out of bounds.
             /// \return a const reference to the value pointed by the iterator
- BOOST_UBLAS_INLINE
- const_reference operator * () const {
- BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
- return *it_;
- }
-
+ BOOST_UBLAS_INLINE
+ const_reference operator * () const {
+ BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
+ return *it_;
+ }
+
             /// \brief Dereference an iterator at the n-th forward value
             /// Dereference an iterator at the n-th forward value, that is the value pointed by iterator+n.
- /// A bounds' check is done before returning the value. A bad_index() expection is returned if out of bounds.
+ /// A bounds' check is done before returning the value. A bad_index() expection is returned if out of bounds.
             /// \return a const reference
- BOOST_UBLAS_INLINE
- const_reference operator [] (difference_type n) const {
- return *(it_ + n);
- }
-
- // Index
+ BOOST_UBLAS_INLINE
+ const_reference operator [] (difference_type n) const {
+ return *(it_ + n);
+ }
+
+ // Index
             /// \brief return the index of the element referenced by the iterator
- BOOST_UBLAS_INLINE
- size_type index () const {
- BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
- return it_ - (*this) ().begin ().it_;
- }
+ BOOST_UBLAS_INLINE
+ size_type index () const {
+ BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
+ return it_ - (*this) ().begin ().it_;
+ }
 
- // Assignment
- BOOST_UBLAS_INLINE
+ // Assignment
+ BOOST_UBLAS_INLINE
             /// \brief assign the value of an iterator to the iterator
- const_iterator &operator = (const const_iterator &it) {
- container_const_reference<self_type>::assign (&it ());
- it_ = it.it_;
- return *this;
- }
+ const_iterator &operator = (const const_iterator &it) {
+ container_const_reference<self_type>::assign (&it ());
+ it_ = it.it_;
+ return *this;
+ }
 
- // Comparison
+ // Comparison
             /// \brief compare the value of two itetarors
             /// \return true if they reference the same element
- BOOST_UBLAS_INLINE
- bool operator == (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ == it.it_;
- }
+ BOOST_UBLAS_INLINE
+ bool operator == (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ == it.it_;
+ }
 
         
             /// \brief compare the value of two iterators
             /// \return return true if the left-hand-side iterator refers to a value placed before the right-hand-side iterator
- BOOST_UBLAS_INLINE
- bool operator < (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ < it.it_;
- }
+ BOOST_UBLAS_INLINE
+ bool operator < (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ < it.it_;
+ }
 
- private:
- const_subiterator_type it_;
+ private:
+ const_subiterator_type it_;
 
- friend class iterator;
- };
+ friend class iterator;
+ };
 #endif
 
         /// \brief return an iterator on the first element of the vector
- BOOST_UBLAS_INLINE
- const_iterator begin () const {
- return find (0);
- }
+ BOOST_UBLAS_INLINE
+ const_iterator begin () const {
+ return find (0);
+ }
 
         /// \brief return an iterator after the last element of the vector
- BOOST_UBLAS_INLINE
- const_iterator end () const {
- return find (data_.size ());
- }
+ BOOST_UBLAS_INLINE
+ const_iterator end () const {
+ return find (data_.size ());
+ }
 
 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
- class iterator:
- public container_reference<vector>,
- public random_access_iterator_base<dense_random_access_iterator_tag,
- iterator, value_type, difference_type> {
- public:
- typedef typename vector::difference_type difference_type;
- typedef typename vector::value_type value_type;
- typedef typename vector::reference reference;
- typedef typename vector::pointer pointer;
-
-
- // Construction and destruction
- BOOST_UBLAS_INLINE
- iterator ():
- container_reference<self_type> (), it_ () {}
- BOOST_UBLAS_INLINE
- iterator (self_type &v, const subiterator_type &it):
- container_reference<self_type> (v), it_ (it) {}
-
- // Arithmetic
- BOOST_UBLAS_INLINE
- iterator &operator ++ () {
- ++ it_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- iterator &operator -- () {
- -- it_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- iterator &operator += (difference_type n) {
- it_ += n;
- return *this;
- }
- BOOST_UBLAS_INLINE
- iterator &operator -= (difference_type n) {
- it_ -= n;
- return *this;
- }
- BOOST_UBLAS_INLINE
- difference_type operator - (const iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ - it.it_;
- }
-
- // Dereference
- BOOST_UBLAS_INLINE
- reference operator * () const {
- BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_ , bad_index ());
- return *it_;
- }
- BOOST_UBLAS_INLINE
- reference operator [] (difference_type n) const {
- return *(it_ + n);
- }
-
- // Index
- BOOST_UBLAS_INLINE
- size_type index () const {
- BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_ , bad_index ());
- return it_ - (*this) ().begin ().it_;
- }
-
- // Assignment
- BOOST_UBLAS_INLINE
- iterator &operator = (const iterator &it) {
- container_reference<self_type>::assign (&it ());
- it_ = it.it_;
- return *this;
- }
-
- // Comparison
- BOOST_UBLAS_INLINE
- bool operator == (const iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ == it.it_;
- }
- BOOST_UBLAS_INLINE
- bool operator < (const iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ < it.it_;
- }
+ class iterator:
+ public container_reference<vector>,
+ public random_access_iterator_base<dense_random_access_iterator_tag,
+ iterator, value_type, difference_type> {
+ public:
+ typedef typename vector::difference_type difference_type;
+ typedef typename vector::value_type value_type;
+ typedef typename vector::reference reference;
+ typedef typename vector::pointer pointer;
+
+
+ // Construction and destruction
+ BOOST_UBLAS_INLINE
+ iterator ():
+ container_reference<self_type> (), it_ () {}
+ BOOST_UBLAS_INLINE
+ iterator (self_type &v, const subiterator_type &it):
+ container_reference<self_type> (v), it_ (it) {}
+
+ // Arithmetic
+ BOOST_UBLAS_INLINE
+ iterator &operator ++ () {
+ ++ it_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ iterator &operator -- () {
+ -- it_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ iterator &operator += (difference_type n) {
+ it_ += n;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ iterator &operator -= (difference_type n) {
+ it_ -= n;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ difference_type operator - (const iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ - it.it_;
+ }
+
+ // Dereference
+ BOOST_UBLAS_INLINE
+ reference operator * () const {
+ BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_ , bad_index ());
+ return *it_;
+ }
+ BOOST_UBLAS_INLINE
+ reference operator [] (difference_type n) const {
+ return *(it_ + n);
+ }
+
+ // Index
+ BOOST_UBLAS_INLINE
+ size_type index () const {
+ BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_ , bad_index ());
+ return it_ - (*this) ().begin ().it_;
+ }
+
+ // Assignment
+ BOOST_UBLAS_INLINE
+ iterator &operator = (const iterator &it) {
+ container_reference<self_type>::assign (&it ());
+ it_ = it.it_;
+ return *this;
+ }
+
+ // Comparison
+ BOOST_UBLAS_INLINE
+ bool operator == (const iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ == it.it_;
+ }
+ BOOST_UBLAS_INLINE
+ bool operator < (const iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ < it.it_;
+ }
 
- private:
- subiterator_type it_;
+ private:
+ subiterator_type it_;
 
- friend class const_iterator;
- };
+ friend class const_iterator;
+ };
 #endif
 
         /// \brief Return an iterator on the first element of the vector
- BOOST_UBLAS_INLINE
- iterator begin () {
- return find (0);
- }
-
+ BOOST_UBLAS_INLINE
+ iterator begin () {
+ return find (0);
+ }
+
         /// \brief Return an iterator at the end of the vector
- BOOST_UBLAS_INLINE
- iterator end () {
- return find (data_.size ());
- }
-
- // Reverse iterator
- typedef reverse_iterator_base<const_iterator> const_reverse_iterator;
- typedef reverse_iterator_base<iterator> reverse_iterator;
-
+ BOOST_UBLAS_INLINE
+ iterator end () {
+ return find (data_.size ());
+ }
+
+ // Reverse iterator
+ typedef reverse_iterator_base<const_iterator> const_reverse_iterator;
+ typedef reverse_iterator_base<iterator> reverse_iterator;
+
         /// \brief Return a const reverse iterator before the first element of the reversed vector (i.e. end() of normal vector)
- BOOST_UBLAS_INLINE
- const_reverse_iterator rbegin () const {
- return const_reverse_iterator (end ());
- }
-
+ BOOST_UBLAS_INLINE
+ const_reverse_iterator rbegin () const {
+ return const_reverse_iterator (end ());
+ }
+
         /// \brief Return a const reverse iterator on the end of the reverse vector (i.e. first element of the normal vector)
- BOOST_UBLAS_INLINE
- const_reverse_iterator rend () const {
- return const_reverse_iterator (begin ());
- }
-
+ BOOST_UBLAS_INLINE
+ const_reverse_iterator rend () const {
+ return const_reverse_iterator (begin ());
+ }
+
         /// \brief Return a const reverse iterator before the first element of the reversed vector (i.e. end() of normal vector)
- BOOST_UBLAS_INLINE
- reverse_iterator rbegin () {
- return reverse_iterator (end ());
- }
-
+ BOOST_UBLAS_INLINE
+ reverse_iterator rbegin () {
+ return reverse_iterator (end ());
+ }
+
         /// \brief Return a const reverse iterator on the end of the reverse vector (i.e. first element of the normal vector)
- BOOST_UBLAS_INLINE
- reverse_iterator rend () {
- return reverse_iterator (begin ());
- }
-
+ BOOST_UBLAS_INLINE
+ reverse_iterator rend () {
+ return reverse_iterator (begin ());
+ }
+
         // -------------
- // Serialization
+ // Serialization
         // -------------
         
         /// Serialize a vector into and archive as defined in Boost
         /// \param ar Archive object. Can be a flat file, an XML file or any other stream
         /// \param file_version Optional file version (not yet used)
- template<class Archive>
- void serialize(Archive & ar, const unsigned int /* file_version */){
- ar & serialization::make_nvp("data",data_);
- }
-
- private:
- array_type data_;
- };
-
-
- // --------------------
- // Bounded vector class
- // --------------------
-
- /// \brief a dense vector of values of type \c T, of variable size but with maximum \f$N\f$.
- /// A dense vector of values of type \c T, of variable size but with maximum \f$N\f$. The default constructor
- /// creates the vector with size \f$N\f$. Elements are constructed by the storage type \c bounded_array, which \b need \b not \b initialise their value.
- template<class T, std::size_t N>
- class bounded_vector:
- public vector<T, bounded_array<T, N> > {
-
- typedef vector<T, bounded_array<T, N> > vector_type;
- public:
- typedef typename vector_type::size_type size_type;
- static const size_type max_size = N;
-
- // Construction and destruction
- BOOST_UBLAS_INLINE
- bounded_vector ():
- vector_type (N) {}
- BOOST_UBLAS_INLINE
- bounded_vector (size_type size):
- vector_type (size) {}
- BOOST_UBLAS_INLINE
- bounded_vector (const bounded_vector &v):
- vector_type (v) {}
- template<class A2> // Allow vector<T,bounded_array<N> construction
- BOOST_UBLAS_INLINE
- bounded_vector (const vector<T, A2> &v):
- vector_type (v) {}
- template<class AE>
- BOOST_UBLAS_INLINE
- bounded_vector (const vector_expression<AE> &ae):
- vector_type (ae) {}
- BOOST_UBLAS_INLINE
- ~bounded_vector () {}
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int /* file_version */){
+ ar & serialization::make_nvp("data",data_);
+ }
+
+ private:
+ array_type data_;
+ };
+
+
+ // --------------------
+ // Bounded vector class
+ // --------------------
+
+ /// \brief a dense vector of values of type \c T, of variable size but with maximum \f$N\f$.
+ /// A dense vector of values of type \c T, of variable size but with maximum \f$N\f$. The default constructor
+ /// creates the vector with size \f$N\f$. Elements are constructed by the storage type \c bounded_array, which \b need \b not \b initialise their value.
+ template<class T, std::size_t N>
+ class bounded_vector:
+ public vector<T, bounded_array<T, N> > {
+
+ typedef vector<T, bounded_array<T, N> > vector_type;
+ public:
+ typedef typename vector_type::size_type size_type;
+ static const size_type max_size = N;
+
+ // Construction and destruction
+ BOOST_UBLAS_INLINE
+ bounded_vector ():
+ vector_type (N) {}
+ BOOST_UBLAS_INLINE
+ bounded_vector (size_type size):
+ vector_type (size) {}
+ BOOST_UBLAS_INLINE
+ bounded_vector (const bounded_vector &v):
+ vector_type (v) {}
+ template<class A2> // Allow vector<T,bounded_array<N> construction
+ BOOST_UBLAS_INLINE
+ bounded_vector (const vector<T, A2> &v):
+ vector_type (v) {}
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ bounded_vector (const vector_expression<AE> &ae):
+ vector_type (ae) {}
+ BOOST_UBLAS_INLINE
+ ~bounded_vector () {}
 
- // Assignment
+ // Assignment
 #ifdef BOOST_UBLAS_MOVE_SEMANTICS
 
- /*! @note "pass by value" the key idea to enable move semantics */
- BOOST_UBLAS_INLINE
- bounded_vector &operator = (bounded_vector v) {
- vector_type::operator = (v);
- return *this;
- }
+ /*! @note "pass by value" the key idea to enable move semantics */
+ BOOST_UBLAS_INLINE
+ bounded_vector &operator = (bounded_vector v) {
+ vector_type::operator = (v);
+ return *this;
+ }
 #else
- BOOST_UBLAS_INLINE
- bounded_vector &operator = (const bounded_vector &v) {
- vector_type::operator = (v);
- return *this;
- }
-#endif
- template<class A2> // Generic vector assignment
- BOOST_UBLAS_INLINE
- bounded_vector &operator = (const vector<T, A2> &v) {
- vector_type::operator = (v);
- return *this;
- }
- template<class C> // Container assignment without temporary
- BOOST_UBLAS_INLINE
- bounded_vector &operator = (const vector_container<C> &v) {
- vector_type::operator = (v);
- return *this;
- }
- template<class AE>
- BOOST_UBLAS_INLINE
- bounded_vector &operator = (const vector_expression<AE> &ae) {
- vector_type::operator = (ae);
- return *this;
- }
- };
-
-
- // -----------------
- // Zero vector class
- // -----------------
-
- /// \brief A zero vector of type \c T and a given \c size
- /// A zero vector of type \c T and a given \c size. This is a virtual vector in the sense that no memory is allocated
- /// for storing the zero values: it still acts like any other vector. However assigning values to it will not change the zero
- /// vector into a normal vector. It must first be assigned to another normal vector by any suitable means. Its memory footprint is constant.
- template<class T, class ALLOC>
- class zero_vector:
- public vector_container<zero_vector<T, ALLOC> > {
-
- typedef const T *const_pointer;
- typedef zero_vector<T, ALLOC> self_type;
- public:
+ BOOST_UBLAS_INLINE
+ bounded_vector &operator = (const bounded_vector &v) {
+ vector_type::operator = (v);
+ return *this;
+ }
+#endif
+ template<class A2> // Generic vector assignment
+ BOOST_UBLAS_INLINE
+ bounded_vector &operator = (const vector<T, A2> &v) {
+ vector_type::operator = (v);
+ return *this;
+ }
+ template<class C> // Container assignment without temporary
+ BOOST_UBLAS_INLINE
+ bounded_vector &operator = (const vector_container<C> &v) {
+ vector_type::operator = (v);
+ return *this;
+ }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ bounded_vector &operator = (const vector_expression<AE> &ae) {
+ vector_type::operator = (ae);
+ return *this;
+ }
+ };
+
+
+ // -----------------
+ // Zero vector class
+ // -----------------
+
+ /// \brief A zero vector of type \c T and a given \c size
+ /// A zero vector of type \c T and a given \c size. This is a virtual vector in the sense that no memory is allocated
+ /// for storing the zero values: it still acts like any other vector. However assigning values to it will not change the zero
+ /// vector into a normal vector. It must first be assigned to another normal vector by any suitable means. Its memory footprint is constant.
+ template<class T, class ALLOC>
+ class zero_vector:
+ public vector_container<zero_vector<T, ALLOC> > {
+
+ typedef const T *const_pointer;
+ typedef zero_vector<T, ALLOC> self_type;
+ public:
 #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS
- using vector_container<self_type>::operator ();
+ using vector_container<self_type>::operator ();
 #endif
- typedef typename ALLOC::size_type size_type;
- typedef typename ALLOC::difference_type difference_type;
- typedef T value_type;
- typedef const T &const_reference;
- typedef T &reference;
- typedef const vector_reference<const self_type> const_closure_type;
- typedef vector_reference<self_type> closure_type;
- typedef sparse_tag storage_category;
-
- // Construction and destruction
- BOOST_UBLAS_INLINE
- zero_vector ():
- vector_container<self_type> (),
- size_ (0) {}
- explicit BOOST_UBLAS_INLINE
- zero_vector (size_type size):
- vector_container<self_type> (),
- size_ (size) {}
- BOOST_UBLAS_INLINE
- zero_vector (const zero_vector &v):
- vector_container<self_type> (),
- size_ (v.size_) {}
-
- // Accessors
- BOOST_UBLAS_INLINE
- size_type size () const {
- return size_;
- }
-
- // Resizing
- BOOST_UBLAS_INLINE
- void resize (size_type size, bool /*preserve*/ = true) {
- size_ = size;
- }
-
- // Element support
- BOOST_UBLAS_INLINE
- const_pointer find_element (size_type i) const {
- return & zero_;
- }
-
- // Element access
- BOOST_UBLAS_INLINE
- const_reference operator () (size_type /* i */) const {
- return zero_;
- }
-
- BOOST_UBLAS_INLINE
- const_reference operator [] (size_type i) const {
- return (*this) (i);
- }
-
- // Assignment
- BOOST_UBLAS_INLINE
- zero_vector &operator = (const zero_vector &v) {
- size_ = v.size_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- zero_vector &assign_temporary (zero_vector &v) {
- swap (v);
- return *this;
- }
-
- // Swapping
- BOOST_UBLAS_INLINE
- void swap (zero_vector &v) {
- if (this != &v) {
- std::swap (size_, v.size_);
- }
- }
- BOOST_UBLAS_INLINE
- friend void swap (zero_vector &v1, zero_vector &v2) {
- v1.swap (v2);
- }
-
- // Iterator types
- public:
- class const_iterator;
-
- // Element lookup
- BOOST_UBLAS_INLINE
- const_iterator find (size_type /*i*/) const {
- return const_iterator (*this);
- }
-
- class const_iterator:
- public container_const_reference<zero_vector>,
- public bidirectional_iterator_base<sparse_bidirectional_iterator_tag,
- const_iterator, value_type> {
- public:
- typedef typename zero_vector::difference_type difference_type;
- typedef typename zero_vector::value_type value_type;
- typedef typename zero_vector::const_reference reference;
- typedef typename zero_vector::const_pointer pointer;
-
- // Construction and destruction
- BOOST_UBLAS_INLINE
- const_iterator ():
- container_const_reference<self_type> () {}
- BOOST_UBLAS_INLINE
- const_iterator (const self_type &v):
- container_const_reference<self_type> (v) {}
-
- // Arithmetic
- BOOST_UBLAS_INLINE
- const_iterator &operator ++ () {
- BOOST_UBLAS_CHECK_FALSE (bad_index ());
- return *this;
- }
- BOOST_UBLAS_INLINE
- const_iterator &operator -- () {
- BOOST_UBLAS_CHECK_FALSE (bad_index ());
- return *this;
- }
-
- // Dereference
- BOOST_UBLAS_INLINE
- const_reference operator * () const {
- BOOST_UBLAS_CHECK_FALSE (bad_index ());
- return zero_; // arbitary return value
- }
-
- // Index
- BOOST_UBLAS_INLINE
- size_type index () const {
- BOOST_UBLAS_CHECK_FALSE (bad_index ());
- return 0; // arbitary return value
- }
-
- // Assignment
- BOOST_UBLAS_INLINE
- const_iterator &operator = (const const_iterator &it) {
- container_const_reference<self_type>::assign (&it ());
- return *this;
- }
-
- // Comparison
- BOOST_UBLAS_INLINE
- bool operator == (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- detail::ignore_unused_variable_warning(it);
- return true;
- }
- };
-
- typedef const_iterator iterator;
-
- BOOST_UBLAS_INLINE
- const_iterator begin () const {
- return const_iterator (*this);
- }
- BOOST_UBLAS_INLINE
- const_iterator end () const {
- return const_iterator (*this);
- }
-
- // Reverse iterator
- typedef reverse_iterator_base<const_iterator> const_reverse_iterator;
-
- BOOST_UBLAS_INLINE
- const_reverse_iterator rbegin () const {
- return const_reverse_iterator (end ());
- }
- BOOST_UBLAS_INLINE
- const_reverse_iterator rend () const {
- return const_reverse_iterator (begin ());
- }
-
- // Serialization
- template<class Archive>
- void serialize(Archive & ar, const unsigned int /* file_version */){
- serialization::collection_size_type s (size_);
- ar & serialization::make_nvp("size",s);
- if (Archive::is_loading::value) {
- size_ = s;
- }
- }
-
- private:
- size_type size_;
- typedef const value_type const_value_type;
- static const_value_type zero_;
- };
-
- template<class T, class ALLOC>
- typename zero_vector<T, ALLOC>::const_value_type zero_vector<T, ALLOC>::zero_ = T(/*zero*/);
-
-
- // Unit vector class
- /// \brief unit_vector represents a canonical unit vector
- /// unit_vector represents a canonical unit vector. The \e k-th unit vector of dimension \f$n\f$ holds 0 for every value \f$u_i\f$ s.t. \f$i \neq k\f$ and 1 when \f$i=k\f$.
- /// At construction, the value \e k is given after the dimension of the vector.
- /// \tparam T is the type of elements in the vector. They must be 0 and 1 assignable in order for the vector to have its unit-vector semantic.
- /// \tparam ALLOC a specific allocator can be specified if needed. Most of the time this parameter is omited.
- template<class T, class ALLOC>
- class unit_vector:
- public vector_container<unit_vector<T, ALLOC> > {
-
- typedef const T *const_pointer;
- typedef unit_vector<T, ALLOC> self_type;
- public:
+ typedef typename ALLOC::size_type size_type;
+ typedef typename ALLOC::difference_type difference_type;
+ typedef T value_type;
+ typedef const T &const_reference;
+ typedef T &reference;
+ typedef const vector_reference<const self_type> const_closure_type;
+ typedef vector_reference<self_type> closure_type;
+ typedef sparse_tag storage_category;
+
+ // Construction and destruction
+ BOOST_UBLAS_INLINE
+ zero_vector ():
+ vector_container<self_type> (),
+ size_ (0) {}
+ explicit BOOST_UBLAS_INLINE
+ zero_vector (size_type size):
+ vector_container<self_type> (),
+ size_ (size) {}
+ BOOST_UBLAS_INLINE
+ zero_vector (const zero_vector &v):
+ vector_container<self_type> (),
+ size_ (v.size_) {}
+
+ // Accessors
+ BOOST_UBLAS_INLINE
+ size_type size () const {
+ return size_;
+ }
+
+ // Resizing
+ BOOST_UBLAS_INLINE
+ void resize (size_type size, bool /*preserve*/ = true) {
+ size_ = size;
+ }
+
+ // Element support
+ BOOST_UBLAS_INLINE
+ const_pointer find_element (size_type i) const {
+ return & zero_;
+ }
+
+ // Element access
+ BOOST_UBLAS_INLINE
+ const_reference operator () (size_type /* i */) const {
+ return zero_;
+ }
+
+ BOOST_UBLAS_INLINE
+ const_reference operator [] (size_type i) const {
+ return (*this) (i);
+ }
+
+ // Assignment
+ BOOST_UBLAS_INLINE
+ zero_vector &operator = (const zero_vector &v) {
+ size_ = v.size_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ zero_vector &assign_temporary (zero_vector &v) {
+ swap (v);
+ return *this;
+ }
+
+ // Swapping
+ BOOST_UBLAS_INLINE
+ void swap (zero_vector &v) {
+ if (this != &v) {
+ std::swap (size_, v.size_);
+ }
+ }
+ BOOST_UBLAS_INLINE
+ friend void swap (zero_vector &v1, zero_vector &v2) {
+ v1.swap (v2);
+ }
+
+ // Iterator types
+ public:
+ class const_iterator;
+
+ // Element lookup
+ BOOST_UBLAS_INLINE
+ const_iterator find (size_type /*i*/) const {
+ return const_iterator (*this);
+ }
+
+ class const_iterator:
+ public container_const_reference<zero_vector>,
+ public bidirectional_iterator_base<sparse_bidirectional_iterator_tag,
+ const_iterator, value_type> {
+ public:
+ typedef typename zero_vector::difference_type difference_type;
+ typedef typename zero_vector::value_type value_type;
+ typedef typename zero_vector::const_reference reference;
+ typedef typename zero_vector::const_pointer pointer;
+
+ // Construction and destruction
+ BOOST_UBLAS_INLINE
+ const_iterator ():
+ container_const_reference<self_type> () {}
+ BOOST_UBLAS_INLINE
+ const_iterator (const self_type &v):
+ container_const_reference<self_type> (v) {}
+
+ // Arithmetic
+ BOOST_UBLAS_INLINE
+ const_iterator &operator ++ () {
+ BOOST_UBLAS_CHECK_FALSE (bad_index ());
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator &operator -- () {
+ BOOST_UBLAS_CHECK_FALSE (bad_index ());
+ return *this;
+ }
+
+ // Dereference
+ BOOST_UBLAS_INLINE
+ const_reference operator * () const {
+ BOOST_UBLAS_CHECK_FALSE (bad_index ());
+ return zero_; // arbitary return value
+ }
+
+ // Index
+ BOOST_UBLAS_INLINE
+ size_type index () const {
+ BOOST_UBLAS_CHECK_FALSE (bad_index ());
+ return 0; // arbitary return value
+ }
+
+ // Assignment
+ BOOST_UBLAS_INLINE
+ const_iterator &operator = (const const_iterator &it) {
+ container_const_reference<self_type>::assign (&it ());
+ return *this;
+ }
+
+ // Comparison
+ BOOST_UBLAS_INLINE
+ bool operator == (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ detail::ignore_unused_variable_warning(it);
+ return true;
+ }
+ };
+
+ typedef const_iterator iterator;
+
+ BOOST_UBLAS_INLINE
+ const_iterator begin () const {
+ return const_iterator (*this);
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator end () const {
+ return const_iterator (*this);
+ }
+
+ // Reverse iterator
+ typedef reverse_iterator_base<const_iterator> const_reverse_iterator;
+
+ BOOST_UBLAS_INLINE
+ const_reverse_iterator rbegin () const {
+ return const_reverse_iterator (end ());
+ }
+ BOOST_UBLAS_INLINE
+ const_reverse_iterator rend () const {
+ return const_reverse_iterator (begin ());
+ }
+
+ // Serialization
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int /* file_version */){
+ serialization::collection_size_type s (size_);
+ ar & serialization::make_nvp("size",s);
+ if (Archive::is_loading::value) {
+ size_ = s;
+ }
+ }
+
+ private:
+ size_type size_;
+ typedef const value_type const_value_type;
+ static const_value_type zero_;
+ };
+
+ template<class T, class ALLOC>
+ typename zero_vector<T, ALLOC>::const_value_type zero_vector<T, ALLOC>::zero_ = T(/*zero*/);
+
+
+ // Unit vector class
+ /// \brief unit_vector represents a canonical unit vector
+ /// unit_vector represents a canonical unit vector. The \e k-th unit vector of dimension \f$n\f$ holds 0 for every value \f$u_i\f$ s.t. \f$i \neq k\f$ and 1 when \f$i=k\f$.
+ /// At construction, the value \e k is given after the dimension of the vector.
+ /// \tparam T is the type of elements in the vector. They must be 0 and 1 assignable in order for the vector to have its unit-vector semantic.
+ /// \tparam ALLOC a specific allocator can be specified if needed. Most of the time this parameter is omited.
+ template<class T, class ALLOC>
+ class unit_vector:
+ public vector_container<unit_vector<T, ALLOC> > {
+
+ typedef const T *const_pointer;
+ typedef unit_vector<T, ALLOC> self_type;
+ public:
 #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS
- using vector_container<self_type>::operator ();
+ using vector_container<self_type>::operator ();
 #endif
- typedef typename ALLOC::size_type size_type;
- typedef typename ALLOC::difference_type difference_type;
- typedef T value_type;
- typedef const T &const_reference;
- typedef T &reference;
- typedef const vector_reference<const self_type> const_closure_type;
- typedef vector_reference<self_type> closure_type;
- typedef sparse_tag storage_category;
+ typedef typename ALLOC::size_type size_type;
+ typedef typename ALLOC::difference_type difference_type;
+ typedef T value_type;
+ typedef const T &const_reference;
+ typedef T &reference;
+ typedef const vector_reference<const self_type> const_closure_type;
+ typedef vector_reference<self_type> closure_type;
+ typedef sparse_tag storage_category;
 
- // Construction and destruction
+ // Construction and destruction
         /// \brief Simple constructor with dimension and index 0
- BOOST_UBLAS_INLINE
- unit_vector ():
- vector_container<self_type> (),
- size_ (0), index_ (0) {}
-
+ BOOST_UBLAS_INLINE
+ unit_vector ():
+ vector_container<self_type> (),
+ size_ (0), index_ (0) {}
+
         /// \brief Constructor of unit_vector
         /// \param size is the dimension of the vector
         /// \param index is the order of the vector
- BOOST_UBLAS_INLINE
- explicit unit_vector (size_type size, size_type index = 0):
- vector_container<self_type> (),
- size_ (size), index_ (index) {}
-
+ BOOST_UBLAS_INLINE
+ explicit unit_vector (size_type size, size_type index = 0):
+ vector_container<self_type> (),
+ size_ (size), index_ (index) {}
+
         /// \brief Copy-constructor
- BOOST_UBLAS_INLINE
- unit_vector (const unit_vector &v):
- vector_container<self_type> (),
- size_ (v.size_), index_ (v.index_) {}
-
- // Accessors
+ BOOST_UBLAS_INLINE
+ unit_vector (const unit_vector &v):
+ vector_container<self_type> (),
+ size_ (v.size_), index_ (v.index_) {}
+
+ // Accessors
         //----------
         
         /// \brief Return the size (dimension) of the vector
- BOOST_UBLAS_INLINE
- size_type size () const {
- return size_;
- }
-
+ BOOST_UBLAS_INLINE
+ size_type size () const {
+ return size_;
+ }
+
         /// \brief Return the order of the unit vector
- BOOST_UBLAS_INLINE
- size_type index () const {
- return index_;
- }
-
- // Resizing
+ BOOST_UBLAS_INLINE
+ size_type index () const {
+ return index_;
+ }
+
+ // Resizing
         // --------
         
         /// \brief Resize the vector. The values are preserved by default (i.e. the index does not change)
         /// \param size is the new size of the vector
- BOOST_UBLAS_INLINE
- void resize (size_type size, bool /*preserve*/ = true) {
- size_ = size;
- }
-
- // Element support
+ BOOST_UBLAS_INLINE
+ void resize (size_type size, bool /*preserve*/ = true) {
+ size_ = size;
+ }
+
+ // Element support
         // ---------------
         
         /// \brief Return a const pointer to the element of index i
- BOOST_UBLAS_INLINE
- const_pointer find_element (size_type i) const {
- if (i == index_)
- return & one_;
- else
- return & zero_;
- }
-
- // Element access
- BOOST_UBLAS_INLINE
- const_reference operator () (size_type i) const {
- if (i == index_)
- return one_;
- else
- return zero_;
- }
-
- BOOST_UBLAS_INLINE
- const_reference operator [] (size_type i) const {
- return (*this) (i);
- }
-
- // Assignment
- BOOST_UBLAS_INLINE
- unit_vector &operator = (const unit_vector &v) {
- size_ = v.size_;
- index_ = v.index_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- unit_vector &assign_temporary (unit_vector &v) {
- swap (v);
- return *this;
- }
-
- // Swapping
- BOOST_UBLAS_INLINE
- void swap (unit_vector &v) {
- if (this != &v) {
- std::swap (size_, v.size_);
- std::swap (index_, v.index_);
- }
- }
- BOOST_UBLAS_INLINE
- friend void swap (unit_vector &v1, unit_vector &v2) {
- v1.swap (v2);
- }
-
- // Iterator types
- private:
- // Use bool to indicate begin (one_ as value)
- typedef bool const_subiterator_type;
- public:
- class const_iterator;
-
- // Element lookup
- BOOST_UBLAS_INLINE
- const_iterator find (size_type i) const {
- return const_iterator (*this, i <= index_);
- }
-
- class const_iterator:
- public container_const_reference<unit_vector>,
- public bidirectional_iterator_base<sparse_bidirectional_iterator_tag,
- const_iterator, value_type> {
- public:
- typedef typename unit_vector::difference_type difference_type;
- typedef typename unit_vector::value_type value_type;
- typedef typename unit_vector::const_reference reference;
- typedef typename unit_vector::const_pointer pointer;
-
- // Construction and destruction
- BOOST_UBLAS_INLINE
- const_iterator ():
- container_const_reference<unit_vector> (), it_ () {}
- BOOST_UBLAS_INLINE
- const_iterator (const unit_vector &v, const const_subiterator_type &it):
- container_const_reference<unit_vector> (v), it_ (it) {}
-
- // Arithmetic
- BOOST_UBLAS_INLINE
- const_iterator &operator ++ () {
- BOOST_UBLAS_CHECK (it_, bad_index ());
- it_ = !it_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- const_iterator &operator -- () {
- BOOST_UBLAS_CHECK (!it_, bad_index ());
- it_ = !it_;
- return *this;
- }
-
- // Dereference
- BOOST_UBLAS_INLINE
- const_reference operator * () const {
- BOOST_UBLAS_CHECK (it_, bad_index ());
- return one_;
- }
-
- // Index
- BOOST_UBLAS_INLINE
- size_type index () const {
- BOOST_UBLAS_CHECK (it_, bad_index ());
- return (*this) ().index_;
- }
-
- // Assignment
- BOOST_UBLAS_INLINE
- const_iterator &operator = (const const_iterator &it) {
- container_const_reference<unit_vector>::assign (&it ());
- it_ = it.it_;
- return *this;
- }
-
- // Comparison
- BOOST_UBLAS_INLINE
- bool operator == (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ == it.it_;
- }
-
- private:
- const_subiterator_type it_;
- };
-
- typedef const_iterator iterator;
-
- BOOST_UBLAS_INLINE
- const_iterator begin () const {
- return const_iterator (*this, true);
- }
- BOOST_UBLAS_INLINE
- const_iterator end () const {
- return const_iterator (*this, false);
- }
-
- // Reverse iterator
- typedef reverse_iterator_base<const_iterator> const_reverse_iterator;
-
- BOOST_UBLAS_INLINE
- const_reverse_iterator rbegin () const {
- return const_reverse_iterator (end ());
- }
- BOOST_UBLAS_INLINE
- const_reverse_iterator rend () const {
- return const_reverse_iterator (begin ());
- }
-
- // Serialization
- template<class Archive>
- void serialize(Archive & ar, const unsigned int /* file_version */){
- serialization::collection_size_type s (size_);
- ar & serialization::make_nvp("size",s);
- if (Archive::is_loading::value) {
- size_ = s;
- }
- ar & serialization::make_nvp("index", index_);
- }
-
- private:
- size_type size_;
- size_type index_;
- typedef const value_type const_value_type;
- static const_value_type zero_;
- static const_value_type one_;
- };
-
- template<class T, class ALLOC>
- typename unit_vector<T, ALLOC>::const_value_type unit_vector<T, ALLOC>::zero_ = T(/*zero*/);
- template<class T, class ALLOC>
- typename unit_vector<T, ALLOC>::const_value_type unit_vector<T, ALLOC>::one_ (1); // ISSUE: need 'one'-traits here
-
- /// \brief A scalar (i.e. unique value) vector of type \c T and a given \c size
- /// A scalar (i.e. unique value) vector of type \c T and a given \c size. This is a virtual vector in the sense that no memory is allocated
- /// for storing the unique value more than once: it still acts like any other vector. However assigning a new value will change all the value at once.
- /// vector into a normal vector. It must first be assigned to another normal vector by any suitable means. Its memory footprint is constant.
- /// \tparam T type of the objects stored in the vector: it can be anything even if most of the time, scalar types will be used like \c double or \c int. Complex types can be used, or even classes like boost::interval.
- template<class T, class ALLOC>
- class scalar_vector:
- public vector_container<scalar_vector<T, ALLOC> > {
-
- typedef const T *const_pointer;
- typedef scalar_vector<T, ALLOC> self_type;
- public:
+ BOOST_UBLAS_INLINE
+ const_pointer find_element (size_type i) const {
+ if (i == index_)
+ return & one_;
+ else
+ return & zero_;
+ }
+
+ // Element access
+ BOOST_UBLAS_INLINE
+ const_reference operator () (size_type i) const {
+ if (i == index_)
+ return one_;
+ else
+ return zero_;
+ }
+
+ BOOST_UBLAS_INLINE
+ const_reference operator [] (size_type i) const {
+ return (*this) (i);
+ }
+
+ // Assignment
+ BOOST_UBLAS_INLINE
+ unit_vector &operator = (const unit_vector &v) {
+ size_ = v.size_;
+ index_ = v.index_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ unit_vector &assign_temporary (unit_vector &v) {
+ swap (v);
+ return *this;
+ }
+
+ // Swapping
+ BOOST_UBLAS_INLINE
+ void swap (unit_vector &v) {
+ if (this != &v) {
+ std::swap (size_, v.size_);
+ std::swap (index_, v.index_);
+ }
+ }
+ BOOST_UBLAS_INLINE
+ friend void swap (unit_vector &v1, unit_vector &v2) {
+ v1.swap (v2);
+ }
+
+ // Iterator types
+ private:
+ // Use bool to indicate begin (one_ as value)
+ typedef bool const_subiterator_type;
+ public:
+ class const_iterator;
+
+ // Element lookup
+ BOOST_UBLAS_INLINE
+ const_iterator find (size_type i) const {
+ return const_iterator (*this, i <= index_);
+ }
+
+ class const_iterator:
+ public container_const_reference<unit_vector>,
+ public bidirectional_iterator_base<sparse_bidirectional_iterator_tag,
+ const_iterator, value_type> {
+ public:
+ typedef typename unit_vector::difference_type difference_type;
+ typedef typename unit_vector::value_type value_type;
+ typedef typename unit_vector::const_reference reference;
+ typedef typename unit_vector::const_pointer pointer;
+
+ // Construction and destruction
+ BOOST_UBLAS_INLINE
+ const_iterator ():
+ container_const_reference<unit_vector> (), it_ () {}
+ BOOST_UBLAS_INLINE
+ const_iterator (const unit_vector &v, const const_subiterator_type &it):
+ container_const_reference<unit_vector> (v), it_ (it) {}
+
+ // Arithmetic
+ BOOST_UBLAS_INLINE
+ const_iterator &operator ++ () {
+ BOOST_UBLAS_CHECK (it_, bad_index ());
+ it_ = !it_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator &operator -- () {
+ BOOST_UBLAS_CHECK (!it_, bad_index ());
+ it_ = !it_;
+ return *this;
+ }
+
+ // Dereference
+ BOOST_UBLAS_INLINE
+ const_reference operator * () const {
+ BOOST_UBLAS_CHECK (it_, bad_index ());
+ return one_;
+ }
+
+ // Index
+ BOOST_UBLAS_INLINE
+ size_type index () const {
+ BOOST_UBLAS_CHECK (it_, bad_index ());
+ return (*this) ().index_;
+ }
+
+ // Assignment
+ BOOST_UBLAS_INLINE
+ const_iterator &operator = (const const_iterator &it) {
+ container_const_reference<unit_vector>::assign (&it ());
+ it_ = it.it_;
+ return *this;
+ }
+
+ // Comparison
+ BOOST_UBLAS_INLINE
+ bool operator == (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ == it.it_;
+ }
+
+ private:
+ const_subiterator_type it_;
+ };
+
+ typedef const_iterator iterator;
+
+ BOOST_UBLAS_INLINE
+ const_iterator begin () const {
+ return const_iterator (*this, true);
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator end () const {
+ return const_iterator (*this, false);
+ }
+
+ // Reverse iterator
+ typedef reverse_iterator_base<const_iterator> const_reverse_iterator;
+
+ BOOST_UBLAS_INLINE
+ const_reverse_iterator rbegin () const {
+ return const_reverse_iterator (end ());
+ }
+ BOOST_UBLAS_INLINE
+ const_reverse_iterator rend () const {
+ return const_reverse_iterator (begin ());
+ }
+
+ // Serialization
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int /* file_version */){
+ serialization::collection_size_type s (size_);
+ ar & serialization::make_nvp("size",s);
+ if (Archive::is_loading::value) {
+ size_ = s;
+ }
+ ar & serialization::make_nvp("index", index_);
+ }
+
+ private:
+ size_type size_;
+ size_type index_;
+ typedef const value_type const_value_type;
+ static const_value_type zero_;
+ static const_value_type one_;
+ };
+
+ template<class T, class ALLOC>
+ typename unit_vector<T, ALLOC>::const_value_type unit_vector<T, ALLOC>::zero_ = T(/*zero*/);
+ template<class T, class ALLOC>
+ typename unit_vector<T, ALLOC>::const_value_type unit_vector<T, ALLOC>::one_ (1); // ISSUE: need 'one'-traits here
+
+ /// \brief A scalar (i.e. unique value) vector of type \c T and a given \c size
+ /// A scalar (i.e. unique value) vector of type \c T and a given \c size. This is a virtual vector in the sense that no memory is allocated
+ /// for storing the unique value more than once: it still acts like any other vector. However assigning a new value will change all the value at once.
+ /// vector into a normal vector. It must first be assigned to another normal vector by any suitable means. Its memory footprint is constant.
+ /// \tparam T type of the objects stored in the vector: it can be anything even if most of the time, scalar types will be used like \c double or \c int. Complex types can be used, or even classes like boost::interval.
+ template<class T, class ALLOC>
+ class scalar_vector:
+ public vector_container<scalar_vector<T, ALLOC> > {
+
+ typedef const T *const_pointer;
+ typedef scalar_vector<T, ALLOC> self_type;
+ public:
 #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS
- using vector_container<self_type>::operator ();
+ using vector_container<self_type>::operator ();
 #endif
- typedef typename ALLOC::size_type size_type;
- typedef typename ALLOC::difference_type difference_type;
- typedef T value_type;
- typedef const T &const_reference;
- typedef T &reference;
- typedef const vector_reference<const self_type> const_closure_type;
- typedef vector_reference<self_type> closure_type;
- typedef dense_tag storage_category;
-
- // Construction and destruction
- BOOST_UBLAS_INLINE
- scalar_vector ():
- vector_container<self_type> (),
- size_ (0), value_ () {}
- BOOST_UBLAS_INLINE
- explicit scalar_vector (size_type size, const value_type &value = value_type(1)):
- vector_container<self_type> (),
- size_ (size), value_ (value) {}
- BOOST_UBLAS_INLINE
- scalar_vector (const scalar_vector &v):
- vector_container<self_type> (),
- size_ (v.size_), value_ (v.value_) {}
-
- // Accessors
- BOOST_UBLAS_INLINE
- size_type size () const {
- return size_;
- }
-
- // Resizing
- BOOST_UBLAS_INLINE
- void resize (size_type size, bool /*preserve*/ = true) {
- size_ = size;
- }
-
- // Element support
- BOOST_UBLAS_INLINE
- const_pointer find_element (size_type /*i*/) const {
- return & value_;
- }
-
- // Element access
- BOOST_UBLAS_INLINE
- const_reference operator () (size_type /*i*/) const {
- return value_;
- }
-
- BOOST_UBLAS_INLINE
- const_reference operator [] (size_type /*i*/) const {
- return value_;
- }
-
- // Assignment
- BOOST_UBLAS_INLINE
- scalar_vector &operator = (const scalar_vector &v) {
- size_ = v.size_;
- value_ = v.value_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- scalar_vector &assign_temporary (scalar_vector &v) {
- swap (v);
- return *this;
- }
-
- // Swapping
- BOOST_UBLAS_INLINE
- void swap (scalar_vector &v) {
- if (this != &v) {
- std::swap (size_, v.size_);
- std::swap (value_, v.value_);
- }
- }
- BOOST_UBLAS_INLINE
- friend void swap (scalar_vector &v1, scalar_vector &v2) {
- v1.swap (v2);
- }
-
- // Iterator types
- private:
- // Use an index
- typedef size_type const_subiterator_type;
+ typedef typename ALLOC::size_type size_type;
+ typedef typename ALLOC::difference_type difference_type;
+ typedef T value_type;
+ typedef const T &const_reference;
+ typedef T &reference;
+ typedef const vector_reference<const self_type> const_closure_type;
+ typedef vector_reference<self_type> closure_type;
+ typedef dense_tag storage_category;
+
+ // Construction and destruction
+ BOOST_UBLAS_INLINE
+ scalar_vector ():
+ vector_container<self_type> (),
+ size_ (0), value_ () {}
+ BOOST_UBLAS_INLINE
+ explicit scalar_vector (size_type size, const value_type &value = value_type(1)):
+ vector_container<self_type> (),
+ size_ (size), value_ (value) {}
+ BOOST_UBLAS_INLINE
+ scalar_vector (const scalar_vector &v):
+ vector_container<self_type> (),
+ size_ (v.size_), value_ (v.value_) {}
+
+ // Accessors
+ BOOST_UBLAS_INLINE
+ size_type size () const {
+ return size_;
+ }
+
+ // Resizing
+ BOOST_UBLAS_INLINE
+ void resize (size_type size, bool /*preserve*/ = true) {
+ size_ = size;
+ }
+
+ // Element support
+ BOOST_UBLAS_INLINE
+ const_pointer find_element (size_type /*i*/) const {
+ return & value_;
+ }
+
+ // Element access
+ BOOST_UBLAS_INLINE
+ const_reference operator () (size_type /*i*/) const {
+ return value_;
+ }
+
+ BOOST_UBLAS_INLINE
+ const_reference operator [] (size_type /*i*/) const {
+ return value_;
+ }
+
+ // Assignment
+ BOOST_UBLAS_INLINE
+ scalar_vector &operator = (const scalar_vector &v) {
+ size_ = v.size_;
+ value_ = v.value_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ scalar_vector &assign_temporary (scalar_vector &v) {
+ swap (v);
+ return *this;
+ }
+
+ // Swapping
+ BOOST_UBLAS_INLINE
+ void swap (scalar_vector &v) {
+ if (this != &v) {
+ std::swap (size_, v.size_);
+ std::swap (value_, v.value_);
+ }
+ }
+ BOOST_UBLAS_INLINE
+ friend void swap (scalar_vector &v1, scalar_vector &v2) {
+ v1.swap (v2);
+ }
+
+ // Iterator types
+ private:
+ // Use an index
+ typedef size_type const_subiterator_type;
 
- public:
+ public:
 #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR
- typedef indexed_const_iterator<self_type, dense_random_access_iterator_tag> iterator;
- typedef indexed_const_iterator<self_type, dense_random_access_iterator_tag> const_iterator;
+ typedef indexed_const_iterator<self_type, dense_random_access_iterator_tag> iterator;
+ typedef indexed_const_iterator<self_type, dense_random_access_iterator_tag> const_iterator;
 #else
- class const_iterator;
+ class const_iterator;
 #endif
 
- // Element lookup
- BOOST_UBLAS_INLINE
- const_iterator find (size_type i) const {
- return const_iterator (*this, i);
- }
+ // Element lookup
+ BOOST_UBLAS_INLINE
+ const_iterator find (size_type i) const {
+ return const_iterator (*this, i);
+ }
 
 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
- class const_iterator:
- public container_const_reference<scalar_vector>,
- public random_access_iterator_base<dense_random_access_iterator_tag,
- const_iterator, value_type> {
- public:
- typedef typename scalar_vector::difference_type difference_type;
- typedef typename scalar_vector::value_type value_type;
- typedef typename scalar_vector::const_reference reference;
- typedef typename scalar_vector::const_pointer pointer;
-
- // Construction and destruction
- BOOST_UBLAS_INLINE
- const_iterator ():
- container_const_reference<scalar_vector> (), it_ () {}
- BOOST_UBLAS_INLINE
- const_iterator (const scalar_vector &v, const const_subiterator_type &it):
- container_const_reference<scalar_vector> (v), it_ (it) {}
-
- // Arithmetic
- BOOST_UBLAS_INLINE
- const_iterator &operator ++ () {
- ++ it_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- const_iterator &operator -- () {
- -- it_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- const_iterator &operator += (difference_type n) {
- it_ += n;
- return *this;
- }
- BOOST_UBLAS_INLINE
- const_iterator &operator -= (difference_type n) {
- it_ -= n;
- return *this;
- }
- BOOST_UBLAS_INLINE
- difference_type operator - (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ - it.it_;
- }
-
- // Dereference
- BOOST_UBLAS_INLINE
- const_reference operator * () const {
- BOOST_UBLAS_CHECK (it_ < (*this) ().size (), bad_index ());
- return (*this) () (index ());
- }
- BOOST_UBLAS_INLINE
- const_reference operator [] (difference_type n) const {
- return *(*this + n);
- }
-
- // Index
- BOOST_UBLAS_INLINE
- size_type index () const {
- BOOST_UBLAS_CHECK (it_ < (*this) ().size (), bad_index ());
- return it_;
- }
-
- // Assignment
- BOOST_UBLAS_INLINE
- const_iterator &operator = (const const_iterator &it) {
- container_const_reference<scalar_vector>::assign (&it ());
- it_ = it.it_;
- return *this;
- }
-
- // Comparison
- BOOST_UBLAS_INLINE
- bool operator == (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ == it.it_;
- }
- BOOST_UBLAS_INLINE
- bool operator < (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ < it.it_;
- }
-
- private:
- const_subiterator_type it_;
- };
-
- typedef const_iterator iterator;
-#endif
-
- BOOST_UBLAS_INLINE
- const_iterator begin () const {
- return find (0);
- }
- BOOST_UBLAS_INLINE
- const_iterator end () const {
- return find (size_);
- }
-
- // Reverse iterator
- typedef reverse_iterator_base<const_iterator> const_reverse_iterator;
-
- BOOST_UBLAS_INLINE
- const_reverse_iterator rbegin () const {
- return const_reverse_iterator (end ());
- }
- BOOST_UBLAS_INLINE
- const_reverse_iterator rend () const {
- return const_reverse_iterator (begin ());
- }
-
- // Serialization
- template<class Archive>
- void serialize(Archive & ar, const unsigned int /* file_version */){
- serialization::collection_size_type s (size_);
- ar & serialization::make_nvp("size",s);
- if (Archive::is_loading::value) {
- size_ = s;
- }
- ar & serialization::make_nvp("value", value_);
- }
-
- private:
- size_type size_;
- value_type value_;
- };
-
- // ------------------------
- // Array based vector class
- // ------------------------
-
- /// \brief A dense vector of values of type \c T with the given \c size. The data is stored as an ordinary C++ array \c T \c data_[M]
- template<class T, std::size_t N>
- class c_vector:
- public vector_container<c_vector<T, N> > {
+ class const_iterator:
+ public container_const_reference<scalar_vector>,
+ public random_access_iterator_base<dense_random_access_iterator_tag,
+ const_iterator, value_type> {
+ public:
+ typedef typename scalar_vector::difference_type difference_type;
+ typedef typename scalar_vector::value_type value_type;
+ typedef typename scalar_vector::const_reference reference;
+ typedef typename scalar_vector::const_pointer pointer;
+
+ // Construction and destruction
+ BOOST_UBLAS_INLINE
+ const_iterator ():
+ container_const_reference<scalar_vector> (), it_ () {}
+ BOOST_UBLAS_INLINE
+ const_iterator (const scalar_vector &v, const const_subiterator_type &it):
+ container_const_reference<scalar_vector> (v), it_ (it) {}
+
+ // Arithmetic
+ BOOST_UBLAS_INLINE
+ const_iterator &operator ++ () {
+ ++ it_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator &operator -- () {
+ -- it_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator &operator += (difference_type n) {
+ it_ += n;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator &operator -= (difference_type n) {
+ it_ -= n;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ difference_type operator - (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ - it.it_;
+ }
+
+ // Dereference
+ BOOST_UBLAS_INLINE
+ const_reference operator * () const {
+ BOOST_UBLAS_CHECK (it_ < (*this) ().size (), bad_index ());
+ return (*this) () (index ());
+ }
+ BOOST_UBLAS_INLINE
+ const_reference operator [] (difference_type n) const {
+ return *(*this + n);
+ }
+
+ // Index
+ BOOST_UBLAS_INLINE
+ size_type index () const {
+ BOOST_UBLAS_CHECK (it_ < (*this) ().size (), bad_index ());
+ return it_;
+ }
+
+ // Assignment
+ BOOST_UBLAS_INLINE
+ const_iterator &operator = (const const_iterator &it) {
+ container_const_reference<scalar_vector>::assign (&it ());
+ it_ = it.it_;
+ return *this;
+ }
+
+ // Comparison
+ BOOST_UBLAS_INLINE
+ bool operator == (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ == it.it_;
+ }
+ BOOST_UBLAS_INLINE
+ bool operator < (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ < it.it_;
+ }
+
+ private:
+ const_subiterator_type it_;
+ };
+
+ typedef const_iterator iterator;
+#endif
+
+ BOOST_UBLAS_INLINE
+ const_iterator begin () const {
+ return find (0);
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator end () const {
+ return find (size_);
+ }
+
+ // Reverse iterator
+ typedef reverse_iterator_base<const_iterator> const_reverse_iterator;
+
+ BOOST_UBLAS_INLINE
+ const_reverse_iterator rbegin () const {
+ return const_reverse_iterator (end ());
+ }
+ BOOST_UBLAS_INLINE
+ const_reverse_iterator rend () const {
+ return const_reverse_iterator (begin ());
+ }
+
+ // Serialization
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int /* file_version */){
+ serialization::collection_size_type s (size_);
+ ar & serialization::make_nvp("size",s);
+ if (Archive::is_loading::value) {
+ size_ = s;
+ }
+ ar & serialization::make_nvp("value", value_);
+ }
+
+ private:
+ size_type size_;
+ value_type value_;
+ };
+
+ // ------------------------
+ // Array based vector class
+ // ------------------------
+
+ /// \brief A dense vector of values of type \c T with the given \c size. The data is stored as an ordinary C++ array \c T \c data_[M]
+ template<class T, std::size_t N>
+ class c_vector:
+ public vector_container<c_vector<T, N> > {
 
- typedef c_vector<T, N> self_type;
- public:
+ typedef c_vector<T, N> self_type;
+ public:
 #ifdef BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS
- using vector_container<self_type>::operator ();
+ using vector_container<self_type>::operator ();
 #endif
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef T value_type;
- typedef const T &const_reference;
- typedef T &reference;
- typedef value_type array_type[N];
- typedef T *pointer;
- typedef const T *const_pointer;
- typedef const vector_reference<const self_type> const_closure_type;
- typedef vector_reference<self_type> closure_type;
- typedef self_type vector_temporary_type;
- typedef dense_tag storage_category;
-
- // Construction and destruction
- BOOST_UBLAS_INLINE
- c_vector ():
- size_ (N) /* , data_ () */ {}
- explicit BOOST_UBLAS_INLINE
- c_vector (size_type size):
- size_ (size) /* , data_ () */ {
- if (size_ > N)
- bad_size ().raise ();
- }
- BOOST_UBLAS_INLINE
- c_vector (const c_vector &v):
- size_ (v.size_) /* , data_ () */ {
- if (size_ > N)
- bad_size ().raise ();
- assign(v);
- }
- template<class AE>
- BOOST_UBLAS_INLINE
- c_vector (const vector_expression<AE> &ae):
- size_ (ae ().size ()) /* , data_ () */ {
- if (size_ > N)
- bad_size ().raise ();
- vector_assign<scalar_assign> (*this, ae);
- }
-
- // Accessors
- BOOST_UBLAS_INLINE
- size_type size () const {
- return size_;
- }
- BOOST_UBLAS_INLINE
- const_pointer data () const {
- return data_;
- }
- BOOST_UBLAS_INLINE
- pointer data () {
- return data_;
- }
-
- // Resizing
- BOOST_UBLAS_INLINE
- void resize (size_type size, bool preserve = true) {
- if (size > N)
- bad_size ().raise ();
- size_ = size;
- }
-
- // Element support
- BOOST_UBLAS_INLINE
- pointer find_element (size_type i) {
- return const_cast<pointer> (const_cast<const self_type&>(*this).find_element (i));
- }
- BOOST_UBLAS_INLINE
- const_pointer find_element (size_type i) const {
- return & data_ [i];
- }
-
- // Element access
- BOOST_UBLAS_INLINE
- const_reference operator () (size_type i) const {
- BOOST_UBLAS_CHECK (i < size_, bad_index ());
- return data_ [i];
- }
- BOOST_UBLAS_INLINE
- reference operator () (size_type i) {
- BOOST_UBLAS_CHECK (i < size_, bad_index ());
- return data_ [i];
- }
-
- BOOST_UBLAS_INLINE
- const_reference operator [] (size_type i) const {
- return (*this) (i);
- }
- BOOST_UBLAS_INLINE
- reference operator [] (size_type i) {
- return (*this) (i);
- }
-
- // Element assignment
- BOOST_UBLAS_INLINE
- reference insert_element (size_type i, const_reference t) {
- BOOST_UBLAS_CHECK (i < size_, bad_index ());
- return (data_ [i] = t);
- }
- BOOST_UBLAS_INLINE
- void erase_element (size_type i) {
- BOOST_UBLAS_CHECK (i < size_, bad_index ());
- data_ [i] = value_type/*zero*/();
- }
-
- // Zeroing
- BOOST_UBLAS_INLINE
- void clear () {
- std::fill (data_, data_ + size_, value_type/*zero*/());
- }
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef T value_type;
+ typedef const T &const_reference;
+ typedef T &reference;
+ typedef value_type array_type[N];
+ typedef T *pointer;
+ typedef const T *const_pointer;
+ typedef const vector_reference<const self_type> const_closure_type;
+ typedef vector_reference<self_type> closure_type;
+ typedef self_type vector_temporary_type;
+ typedef dense_tag storage_category;
+
+ // Construction and destruction
+ BOOST_UBLAS_INLINE
+ c_vector ():
+ size_ (N) /* , data_ () */ {}
+ explicit BOOST_UBLAS_INLINE
+ c_vector (size_type size):
+ size_ (size) /* , data_ () */ {
+ if (size_ > N)
+ bad_size ().raise ();
+ }
+ BOOST_UBLAS_INLINE
+ c_vector (const c_vector &v):
+ size_ (v.size_) /* , data_ () */ {
+ if (size_ > N)
+ bad_size ().raise ();
+ assign(v);
+ }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ c_vector (const vector_expression<AE> &ae):
+ size_ (ae ().size ()) /* , data_ () */ {
+ if (size_ > N)
+ bad_size ().raise ();
+ vector_assign<scalar_assign> (*this, ae);
+ }
+
+ // Accessors
+ BOOST_UBLAS_INLINE
+ size_type size () const {
+ return size_;
+ }
+ BOOST_UBLAS_INLINE
+ const_pointer data () const {
+ return data_;
+ }
+ BOOST_UBLAS_INLINE
+ pointer data () {
+ return data_;
+ }
+
+ // Resizing
+ BOOST_UBLAS_INLINE
+ void resize (size_type size, bool preserve = true) {
+ if (size > N)
+ bad_size ().raise ();
+ size_ = size;
+ }
+
+ // Element support
+ BOOST_UBLAS_INLINE
+ pointer find_element (size_type i) {
+ return const_cast<pointer> (const_cast<const self_type&>(*this).find_element (i));
+ }
+ BOOST_UBLAS_INLINE
+ const_pointer find_element (size_type i) const {
+ return & data_ [i];
+ }
+
+ // Element access
+ BOOST_UBLAS_INLINE
+ const_reference operator () (size_type i) const {
+ BOOST_UBLAS_CHECK (i < size_, bad_index ());
+ return data_ [i];
+ }
+ BOOST_UBLAS_INLINE
+ reference operator () (size_type i) {
+ BOOST_UBLAS_CHECK (i < size_, bad_index ());
+ return data_ [i];
+ }
+
+ BOOST_UBLAS_INLINE
+ const_reference operator [] (size_type i) const {
+ return (*this) (i);
+ }
+ BOOST_UBLAS_INLINE
+ reference operator [] (size_type i) {
+ return (*this) (i);
+ }
+
+ // Element assignment
+ BOOST_UBLAS_INLINE
+ reference insert_element (size_type i, const_reference t) {
+ BOOST_UBLAS_CHECK (i < size_, bad_index ());
+ return (data_ [i] = t);
+ }
+ BOOST_UBLAS_INLINE
+ void erase_element (size_type i) {
+ BOOST_UBLAS_CHECK (i < size_, bad_index ());
+ data_ [i] = value_type/*zero*/();
+ }
+
+ // Zeroing
+ BOOST_UBLAS_INLINE
+ void clear () {
+ std::fill (data_, data_ + size_, value_type/*zero*/());
+ }
 
- // Assignment
+ // Assignment
 #ifdef BOOST_UBLAS_MOVE_SEMANTICS
 
- /*! @note "pass by value" the key idea to enable move semantics */
- BOOST_UBLAS_INLINE
- c_vector &operator = (c_vector v) {
- assign_temporary(v);
- return *this;
- }
+ /*! @note "pass by value" the key idea to enable move semantics */
+ BOOST_UBLAS_INLINE
+ c_vector &operator = (c_vector v) {
+ assign_temporary(v);
+ return *this;
+ }
 #else
- BOOST_UBLAS_INLINE
- c_vector &operator = (const c_vector &v) {
- size_ = v.size_;
- std::copy (v.data_, v.data_ + v.size_, data_);
- return *this;
- }
-#endif
- template<class C> // Container assignment without temporary
- BOOST_UBLAS_INLINE
- c_vector &operator = (const vector_container<C> &v) {
- resize (v ().size (), false);
- assign (v);
- return *this;
- }
- BOOST_UBLAS_INLINE
- c_vector &assign_temporary (c_vector &v) {
- swap (v);
- return *this;
- }
- template<class AE>
- BOOST_UBLAS_INLINE
- c_vector &operator = (const vector_expression<AE> &ae) {
- self_type temporary (ae);
- return assign_temporary (temporary);
- }
- template<class AE>
- BOOST_UBLAS_INLINE
- c_vector &assign (const vector_expression<AE> &ae) {
- vector_assign<scalar_assign> (*this, ae);
- return *this;
- }
-
- // Computed assignment
- template<class AE>
- BOOST_UBLAS_INLINE
- c_vector &operator += (const vector_expression<AE> &ae) {
- self_type temporary (*this + ae);
- return assign_temporary (temporary);
- }
- template<class C> // Container assignment without temporary
- BOOST_UBLAS_INLINE
- c_vector &operator += (const vector_container<C> &v) {
- plus_assign (v);
- return *this;
- }
- template<class AE>
- BOOST_UBLAS_INLINE
- c_vector &plus_assign (const vector_expression<AE> &ae) {
- vector_assign<scalar_plus_assign> ( *this, ae);
- return *this;
- }
- template<class AE>
- BOOST_UBLAS_INLINE
- c_vector &operator -= (const vector_expression<AE> &ae) {
- self_type temporary (*this - ae);
- return assign_temporary (temporary);
- }
- template<class C> // Container assignment without temporary
- BOOST_UBLAS_INLINE
- c_vector &operator -= (const vector_container<C> &v) {
- minus_assign (v);
- return *this;
- }
- template<class AE>
- BOOST_UBLAS_INLINE
- c_vector &minus_assign (const vector_expression<AE> &ae) {
- vector_assign<scalar_minus_assign> (*this, ae);
- return *this;
- }
- template<class AT>
- BOOST_UBLAS_INLINE
- c_vector &operator *= (const AT &at) {
- vector_assign_scalar<scalar_multiplies_assign> (*this, at);
- return *this;
- }
- template<class AT>
- BOOST_UBLAS_INLINE
- c_vector &operator /= (const AT &at) {
- vector_assign_scalar<scalar_divides_assign> (*this, at);
- return *this;
- }
-
- // Swapping
- BOOST_UBLAS_INLINE
- void swap (c_vector &v) {
- if (this != &v) {
- BOOST_UBLAS_CHECK (size_ == v.size_, bad_size ());
- std::swap (size_, v.size_);
- std::swap_ranges (data_, data_ + size_, v.data_);
- }
- }
- BOOST_UBLAS_INLINE
- friend void swap (c_vector &v1, c_vector &v2) {
- v1.swap (v2);
- }
-
- // Iterator types
- private:
- // Use pointers for iterator
- typedef const_pointer const_subiterator_type;
- typedef pointer subiterator_type;
+ BOOST_UBLAS_INLINE
+ c_vector &operator = (const c_vector &v) {
+ size_ = v.size_;
+ std::copy (v.data_, v.data_ + v.size_, data_);
+ return *this;
+ }
+#endif
+ template<class C> // Container assignment without temporary
+ BOOST_UBLAS_INLINE
+ c_vector &operator = (const vector_container<C> &v) {
+ resize (v ().size (), false);
+ assign (v);
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ c_vector &assign_temporary (c_vector &v) {
+ swap (v);
+ return *this;
+ }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ c_vector &operator = (const vector_expression<AE> &ae) {
+ self_type temporary (ae);
+ return assign_temporary (temporary);
+ }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ c_vector &assign (const vector_expression<AE> &ae) {
+ vector_assign<scalar_assign> (*this, ae);
+ return *this;
+ }
+
+ // Computed assignment
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ c_vector &operator += (const vector_expression<AE> &ae) {
+ self_type temporary (*this + ae);
+ return assign_temporary (temporary);
+ }
+ template<class C> // Container assignment without temporary
+ BOOST_UBLAS_INLINE
+ c_vector &operator += (const vector_container<C> &v) {
+ plus_assign (v);
+ return *this;
+ }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ c_vector &plus_assign (const vector_expression<AE> &ae) {
+ vector_assign<scalar_plus_assign> ( *this, ae);
+ return *this;
+ }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ c_vector &operator -= (const vector_expression<AE> &ae) {
+ self_type temporary (*this - ae);
+ return assign_temporary (temporary);
+ }
+ template<class C> // Container assignment without temporary
+ BOOST_UBLAS_INLINE
+ c_vector &operator -= (const vector_container<C> &v) {
+ minus_assign (v);
+ return *this;
+ }
+ template<class AE>
+ BOOST_UBLAS_INLINE
+ c_vector &minus_assign (const vector_expression<AE> &ae) {
+ vector_assign<scalar_minus_assign> (*this, ae);
+ return *this;
+ }
+ template<class AT>
+ BOOST_UBLAS_INLINE
+ c_vector &operator *= (const AT &at) {
+ vector_assign_scalar<scalar_multiplies_assign> (*this, at);
+ return *this;
+ }
+ template<class AT>
+ BOOST_UBLAS_INLINE
+ c_vector &operator /= (const AT &at) {
+ vector_assign_scalar<scalar_divides_assign> (*this, at);
+ return *this;
+ }
+
+ // Swapping
+ BOOST_UBLAS_INLINE
+ void swap (c_vector &v) {
+ if (this != &v) {
+ BOOST_UBLAS_CHECK (size_ == v.size_, bad_size ());
+ std::swap (size_, v.size_);
+ std::swap_ranges (data_, data_ + size_, v.data_);
+ }
+ }
+ BOOST_UBLAS_INLINE
+ friend void swap (c_vector &v1, c_vector &v2) {
+ v1.swap (v2);
+ }
+
+ // Iterator types
+ private:
+ // Use pointers for iterator
+ typedef const_pointer const_subiterator_type;
+ typedef pointer subiterator_type;
 
- public:
+ public:
 #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR
- typedef indexed_iterator<self_type, dense_random_access_iterator_tag> iterator;
- typedef indexed_const_iterator<self_type, dense_random_access_iterator_tag> const_iterator;
+ typedef indexed_iterator<self_type, dense_random_access_iterator_tag> iterator;
+ typedef indexed_const_iterator<self_type, dense_random_access_iterator_tag> const_iterator;
 #else
- class const_iterator;
- class iterator;
+ class const_iterator;
+ class iterator;
 #endif
 
- // Element lookup
- BOOST_UBLAS_INLINE
- const_iterator find (size_type i) const {
+ // Element lookup
+ BOOST_UBLAS_INLINE
+ const_iterator find (size_type i) const {
 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
- return const_iterator (*this, &data_ [i]);
+ return const_iterator (*this, &data_ [i]);
 #else
- return const_iterator (*this, i);
+ return const_iterator (*this, i);
 #endif
- }
- BOOST_UBLAS_INLINE
- iterator find (size_type i) {
+ }
+ BOOST_UBLAS_INLINE
+ iterator find (size_type i) {
 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
- return iterator (*this, &data_ [i]);
+ return iterator (*this, &data_ [i]);
 #else
- return iterator (*this, i);
+ return iterator (*this, i);
 #endif
- }
+ }
 
 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
- class const_iterator:
- public container_const_reference<c_vector>,
- public random_access_iterator_base<dense_random_access_iterator_tag,
- const_iterator, value_type> {
- public:
- typedef typename c_vector::difference_type difference_type;
- typedef typename c_vector::value_type value_type;
- typedef typename c_vector::const_reference reference;
- typedef typename c_vector::const_pointer pointer;
-
- // Construction and destruction
- BOOST_UBLAS_INLINE
- const_iterator ():
- container_const_reference<self_type> (), it_ () {}
- BOOST_UBLAS_INLINE
- const_iterator (const self_type &v, const const_subiterator_type &it):
- container_const_reference<self_type> (v), it_ (it) {}
- BOOST_UBLAS_INLINE
- const_iterator (const typename self_type::iterator &it): // ISSUE self_type:: stops VC8 using std::iterator here
- container_const_reference<self_type> (it ()), it_ (it.it_) {}
-
- // Arithmetic
- BOOST_UBLAS_INLINE
- const_iterator &operator ++ () {
- ++ it_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- const_iterator &operator -- () {
- -- it_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- const_iterator &operator += (difference_type n) {
- it_ += n;
- return *this;
- }
- BOOST_UBLAS_INLINE
- const_iterator &operator -= (difference_type n) {
- it_ -= n;
- return *this;
- }
- BOOST_UBLAS_INLINE
- difference_type operator - (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ - it.it_;
- }
-
- // Dereference
- BOOST_UBLAS_INLINE
- const_reference operator * () const {
- BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
- return *it_;
- }
- BOOST_UBLAS_INLINE
- const_reference operator [] (difference_type n) const {
- return *(it_ + n);
- }
-
- // Index
- BOOST_UBLAS_INLINE
- size_type index () const {
- BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
- const self_type &v = (*this) ();
- return it_ - v.begin ().it_;
- }
-
- // Assignment
- BOOST_UBLAS_INLINE
- const_iterator &operator = (const const_iterator &it) {
- container_const_reference<self_type>::assign (&it ());
- it_ = it.it_;
- return *this;
- }
-
- // Comparison
- BOOST_UBLAS_INLINE
- bool operator == (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ == it.it_;
- }
- BOOST_UBLAS_INLINE
- bool operator < (const const_iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ < it.it_;
- }
-
- private:
- const_subiterator_type it_;
-
- friend class iterator;
- };
-#endif
-
- BOOST_UBLAS_INLINE
- const_iterator begin () const {
- return find (0);
- }
- BOOST_UBLAS_INLINE
- const_iterator end () const {
- return find (size_);
- }
+ class const_iterator:
+ public container_const_reference<c_vector>,
+ public random_access_iterator_base<dense_random_access_iterator_tag,
+ const_iterator, value_type> {
+ public:
+ typedef typename c_vector::difference_type difference_type;
+ typedef typename c_vector::value_type value_type;
+ typedef typename c_vector::const_reference reference;
+ typedef typename c_vector::const_pointer pointer;
+
+ // Construction and destruction
+ BOOST_UBLAS_INLINE
+ const_iterator ():
+ container_const_reference<self_type> (), it_ () {}
+ BOOST_UBLAS_INLINE
+ const_iterator (const self_type &v, const const_subiterator_type &it):
+ container_const_reference<self_type> (v), it_ (it) {}
+ BOOST_UBLAS_INLINE
+ const_iterator (const typename self_type::iterator &it): // ISSUE self_type:: stops VC8 using std::iterator here
+ container_const_reference<self_type> (it ()), it_ (it.it_) {}
+
+ // Arithmetic
+ BOOST_UBLAS_INLINE
+ const_iterator &operator ++ () {
+ ++ it_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator &operator -- () {
+ -- it_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator &operator += (difference_type n) {
+ it_ += n;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator &operator -= (difference_type n) {
+ it_ -= n;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ difference_type operator - (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ - it.it_;
+ }
+
+ // Dereference
+ BOOST_UBLAS_INLINE
+ const_reference operator * () const {
+ BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
+ return *it_;
+ }
+ BOOST_UBLAS_INLINE
+ const_reference operator [] (difference_type n) const {
+ return *(it_ + n);
+ }
+
+ // Index
+ BOOST_UBLAS_INLINE
+ size_type index () const {
+ BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
+ const self_type &v = (*this) ();
+ return it_ - v.begin ().it_;
+ }
+
+ // Assignment
+ BOOST_UBLAS_INLINE
+ const_iterator &operator = (const const_iterator &it) {
+ container_const_reference<self_type>::assign (&it ());
+ it_ = it.it_;
+ return *this;
+ }
+
+ // Comparison
+ BOOST_UBLAS_INLINE
+ bool operator == (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ == it.it_;
+ }
+ BOOST_UBLAS_INLINE
+ bool operator < (const const_iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ < it.it_;
+ }
+
+ private:
+ const_subiterator_type it_;
+
+ friend class iterator;
+ };
+#endif
+
+ BOOST_UBLAS_INLINE
+ const_iterator begin () const {
+ return find (0);
+ }
+ BOOST_UBLAS_INLINE
+ const_iterator end () const {
+ return find (size_);
+ }
 
 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
- class iterator:
- public container_reference<c_vector>,
- public random_access_iterator_base<dense_random_access_iterator_tag,
- iterator, value_type> {
- public:
- typedef typename c_vector::difference_type difference_type;
- typedef typename c_vector::value_type value_type;
- typedef typename c_vector::reference reference;
- typedef typename c_vector::pointer pointer;
-
- // Construction and destruction
- BOOST_UBLAS_INLINE
- iterator ():
- container_reference<self_type> (), it_ () {}
- BOOST_UBLAS_INLINE
- iterator (self_type &v, const subiterator_type &it):
- container_reference<self_type> (v), it_ (it) {}
-
- // Arithmetic
- BOOST_UBLAS_INLINE
- iterator &operator ++ () {
- ++ it_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- iterator &operator -- () {
- -- it_;
- return *this;
- }
- BOOST_UBLAS_INLINE
- iterator &operator += (difference_type n) {
- it_ += n;
- return *this;
- }
- BOOST_UBLAS_INLINE
- iterator &operator -= (difference_type n) {
- it_ -= n;
- return *this;
- }
- BOOST_UBLAS_INLINE
- difference_type operator - (const iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ - it.it_;
- }
-
- // Dereference
- BOOST_UBLAS_INLINE
- reference operator * () const {
- BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
- return *it_;
- }
- BOOST_UBLAS_INLINE
- reference operator [] (difference_type n) const {
- return *(it_ + n);
- }
-
- // Index
- BOOST_UBLAS_INLINE
- size_type index () const {
- BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
- // EDG won't allow const self_type it doesn't allow friend access to it_
- self_type &v = (*this) ();
- return it_ - v.begin ().it_;
- }
-
- // Assignment
- BOOST_UBLAS_INLINE
- iterator &operator = (const iterator &it) {
- container_reference<self_type>::assign (&it ());
- it_ = it.it_;
- return *this;
- }
-
- // Comparison
- BOOST_UBLAS_INLINE
- bool operator == (const iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ == it.it_;
- }
- BOOST_UBLAS_INLINE
- bool operator < (const iterator &it) const {
- BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
- return it_ < it.it_;
- }
-
- private:
- subiterator_type it_;
-
- friend class const_iterator;
- };
-#endif
-
- BOOST_UBLAS_INLINE
- iterator begin () {
- return find (0);
- }
- BOOST_UBLAS_INLINE
- iterator end () {
- return find (size_);
- }
-
- // Reverse iterator
- typedef reverse_iterator_base<const_iterator> const_reverse_iterator;
- typedef reverse_iterator_base<iterator> reverse_iterator;
-
- BOOST_UBLAS_INLINE
- const_reverse_iterator rbegin () const {
- return const_reverse_iterator (end ());
- }
- BOOST_UBLAS_INLINE
- const_reverse_iterator rend () const {
- return const_reverse_iterator (begin ());
- }
- BOOST_UBLAS_INLINE
- reverse_iterator rbegin () {
- return reverse_iterator (end ());
- }
- BOOST_UBLAS_INLINE
- reverse_iterator rend () {
- return reverse_iterator (begin ());
- }
-
- // Serialization
- template<class Archive>
- void serialize(Archive & ar, const unsigned int /* file_version */){
- serialization::collection_size_type s (size_);
- ar & serialization::make_nvp("size",s);
-
- // copy the value back if loading
- if (Archive::is_loading::value) {
- if (s > N) bad_size("too large size in bounded_vector::load()\n").raise();
- size_ = s;
- }
- // ISSUE: this writes the full array
- ar & serialization::make_nvp("data",data_);
- }
-
- private:
- size_type size_;
- array_type data_;
- };
+ class iterator:
+ public container_reference<c_vector>,
+ public random_access_iterator_base<dense_random_access_iterator_tag,
+ iterator, value_type> {
+ public:
+ typedef typename c_vector::difference_type difference_type;
+ typedef typename c_vector::value_type value_type;
+ typedef typename c_vector::reference reference;
+ typedef typename c_vector::pointer pointer;
+
+ // Construction and destruction
+ BOOST_UBLAS_INLINE
+ iterator ():
+ container_reference<self_type> (), it_ () {}
+ BOOST_UBLAS_INLINE
+ iterator (self_type &v, const subiterator_type &it):
+ container_reference<self_type> (v), it_ (it) {}
+
+ // Arithmetic
+ BOOST_UBLAS_INLINE
+ iterator &operator ++ () {
+ ++ it_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ iterator &operator -- () {
+ -- it_;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ iterator &operator += (difference_type n) {
+ it_ += n;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ iterator &operator -= (difference_type n) {
+ it_ -= n;
+ return *this;
+ }
+ BOOST_UBLAS_INLINE
+ difference_type operator - (const iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ - it.it_;
+ }
+
+ // Dereference
+ BOOST_UBLAS_INLINE
+ reference operator * () const {
+ BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
+ return *it_;
+ }
+ BOOST_UBLAS_INLINE
+ reference operator [] (difference_type n) const {
+ return *(it_ + n);
+ }
+
+ // Index
+ BOOST_UBLAS_INLINE
+ size_type index () const {
+ BOOST_UBLAS_CHECK (it_ >= (*this) ().begin ().it_ && it_ < (*this) ().end ().it_, bad_index ());
+ // EDG won't allow const self_type it doesn't allow friend access to it_
+ self_type &v = (*this) ();
+ return it_ - v.begin ().it_;
+ }
+
+ // Assignment
+ BOOST_UBLAS_INLINE
+ iterator &operator = (const iterator &it) {
+ container_reference<self_type>::assign (&it ());
+ it_ = it.it_;
+ return *this;
+ }
+
+ // Comparison
+ BOOST_UBLAS_INLINE
+ bool operator == (const iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ == it.it_;
+ }
+ BOOST_UBLAS_INLINE
+ bool operator < (const iterator &it) const {
+ BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ return it_ < it.it_;
+ }
+
+ private:
+ subiterator_type it_;
+
+ friend class const_iterator;
+ };
+#endif
+
+ BOOST_UBLAS_INLINE
+ iterator begin () {
+ return find (0);
+ }
+ BOOST_UBLAS_INLINE
+ iterator end () {
+ return find (size_);
+ }
+
+ // Reverse iterator
+ typedef reverse_iterator_base<const_iterator> const_reverse_iterator;
+ typedef reverse_iterator_base<iterator> reverse_iterator;
+
+ BOOST_UBLAS_INLINE
+ const_reverse_iterator rbegin () const {
+ return const_reverse_iterator (end ());
+ }
+ BOOST_UBLAS_INLINE
+ const_reverse_iterator rend () const {
+ return const_reverse_iterator (begin ());
+ }
+ BOOST_UBLAS_INLINE
+ reverse_iterator rbegin () {
+ return reverse_iterator (end ());
+ }
+ BOOST_UBLAS_INLINE
+ reverse_iterator rend () {
+ return reverse_iterator (begin ());
+ }
+
+ // Serialization
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int /* file_version */){
+ serialization::collection_size_type s (size_);
+ ar & serialization::make_nvp("size",s);
+
+ // copy the value back if loading
+ if (Archive::is_loading::value) {
+ if (s > N) bad_size("too large size in bounded_vector::load()\n").raise();
+ size_ = s;
+ }
+ // ISSUE: this writes the full array
+ ar & serialization::make_nvp("data",data_);
+ }
+
+ private:
+ size_type size_;
+ array_type data_;
+ };
 
 }}}
 


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