diff --git a/vector.hpp b/vector.hpp index d0149342..044e4859 100644 --- a/vector.hpp +++ b/vector.hpp @@ -11,6 +11,8 @@ // // And we acknowledge the support from all contributors. +/// \file Defition + #ifndef _BOOST_UBLAS_VECTOR_ #define _BOOST_UBLAS_VECTOR_ diff --git a/vector_proxy.hpp b/vector_proxy.hpp index 6e80a27c..8654c1eb 100644 --- a/vector_proxy.hpp +++ b/vector_proxy.hpp @@ -21,7 +21,16 @@ namespace boost { namespace numeric { namespace ublas { + // ------------------------ // Vector based range class + // ------------------------ + + /// \brief A subvector defined by a range on another vector. It is used as a normal vector. + /// A subvector defined by a range on another vector. It is used as a normal vector. + /// After being defined it allows the manipulation of a subvector like a normal vector. + /// If the specified range falls outside that of of the index range of the vector, then + /// the \c vector_range is not a well formed Vector Expression and access to an element + /// outside of index range of the vector is \b undefined. template class vector_range: public vector_expression > { @@ -476,13 +485,25 @@ namespace boost { namespace numeric { namespace ublas { range_type r_; }; + // ------------------ // Simple Projections + // ------------------ + + /// \brief Return a \c vector_range on a specified vector, a start and stop index. + /// Return a \c vector_range on a specified vector, a start and stop index. The resulting \c vector_range can be manipulated like a normal vector. + /// If the specified range falls outside that of of the index range of the vector, then the resulting \c vector_range is not a well formed + /// Vector Expression and access to an element outside of index range of the vector is \b undefined. template BOOST_UBLAS_INLINE vector_range subrange (V &data, typename V::size_type start, typename V::size_type stop) { typedef basic_range range_type; return vector_range (data, range_type (start, stop)); } + + /// \brief Return a \c const \c vector_range on a specified vector, a start and stop index. + /// Return a \c const \c vector_range on a specified vector, a start and stop index. The resulting \c const \c vector_range can be manipulated like a normal vector. + /// If the specified range falls outside that of of the index range of the vector, then the resulting \c vector_range is not a well formed + /// Vector Expression and access to an element outside of index range of the vector is \b undefined. template BOOST_UBLAS_INLINE vector_range subrange (const V &data, typename V::size_type start, typename V::size_type stop) { @@ -490,23 +511,45 @@ namespace boost { namespace numeric { namespace ublas { return vector_range (data, range_type (start, stop)); } + // ------------------- // Generic Projections + // ------------------- + + /// \brief Return a \c const \c vector_range on a specified vector and \c range + /// Return a \c const \c vector_range on a specified vector and \c range. The resulting \c vector_range can be manipulated like a normal vector. + /// If the specified range falls outside that of of the index range of the vector, then the resulting \c vector_range is not a well formed + /// Vector Expression and access to an element outside of index range of the vector is \b undefined. template BOOST_UBLAS_INLINE vector_range project (V &data, typename vector_range::range_type const &r) { return vector_range (data, r); } + + /// \brief Return a \c vector_range on a specified vector and \c range + /// Return a \c vector_range on a specified vector and \c range. The resulting \c vector_range can be manipulated like a normal vector. + /// If the specified range falls outside that of of the index range of the vector, then the resulting \c vector_range is not a well formed + /// Vector Expression and access to an element outside of index range of the vector is \b undefined. template BOOST_UBLAS_INLINE const vector_range project (const V &data, typename vector_range::range_type const &r) { // ISSUE was: return vector_range (const_cast (data), r); return vector_range (data, r); - } + } + + /// \brief Return a \c const \c vector_range on a specified vector and const \c range + /// Return a \c const \c vector_range on a specified vector and const \c range. The resulting \c vector_range can be manipulated like a normal vector. + /// If the specified range falls outside that of of the index range of the vector, then the resulting \c vector_range is not a well formed + /// Vector Expression and access to an element outside of index range of the vector is \b undefined. template BOOST_UBLAS_INLINE vector_range project (vector_range &data, const typename vector_range::range_type &r) { return data.project (r); } + + /// \brief Return a \c vector_range on a specified vector and const \c range + /// Return a \c vector_range on a specified vector and const \c range. The resulting \c vector_range can be manipulated like a normal vector. + /// If the specified range falls outside that of of the index range of the vector, then the resulting \c vector_range is not a well formed + /// Vector Expression and access to an element outside of index range of the vector is \b undefined. template BOOST_UBLAS_INLINE const vector_range project (const vector_range &data, const typename vector_range::range_type &r) {