annotate DEPENDENCIES/generic/include/boost/numeric/ublas/operation/end.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /**
Chris@16 2 * -*- c++ -*-
Chris@16 3 *
Chris@16 4 * \file end.hpp
Chris@16 5 *
Chris@16 6 * \brief The \c end operation.
Chris@16 7 *
Chris@16 8 * Copyright (c) 2009, Marco Guazzone
Chris@16 9 *
Chris@16 10 * Distributed under the Boost Software License, Version 1.0. (See
Chris@16 11 * accompanying file LICENSE_1_0.txt or copy at
Chris@16 12 * http://www.boost.org/LICENSE_1_0.txt)
Chris@16 13 *
Chris@16 14 * \author Marco Guazzone, marco.guazzone@gmail.com
Chris@16 15 */
Chris@16 16
Chris@16 17
Chris@16 18 #ifndef BOOST_NUMERIC_UBLAS_OPERATION_END_HPP
Chris@16 19 #define BOOST_NUMERIC_UBLAS_OPERATION_END_HPP
Chris@16 20
Chris@16 21
Chris@16 22 #include <boost/numeric/ublas/expression_types.hpp>
Chris@16 23 #include <boost/numeric/ublas/fwd.hpp>
Chris@16 24 #include <boost/numeric/ublas/traits/const_iterator_type.hpp>
Chris@16 25 #include <boost/numeric/ublas/traits/iterator_type.hpp>
Chris@16 26
Chris@16 27
Chris@16 28 namespace boost { namespace numeric { namespace ublas {
Chris@16 29
Chris@16 30 namespace detail {
Chris@16 31
Chris@16 32 /**
Chris@16 33 * \brief Auxiliary class for implementing the \c end operation.
Chris@16 34 * \tparam CategoryT The expression category type (e.g., vector_tag).
Chris@16 35 * \tparam TagT The dimension type tag (e.g., tag::major).
Chris@16 36 * \tparam OrientationT The orientation category type (e.g., row_major_tag).
Chris@16 37 */
Chris@16 38 template <typename CategoryT, typename TagT=void, typename OrientationT=void>
Chris@16 39 struct end_impl;
Chris@16 40
Chris@16 41
Chris@16 42 /// \brief Specialization of \c end_impl for iterating vector expressions.
Chris@16 43 template <>
Chris@16 44 struct end_impl<vector_tag,void,void>
Chris@16 45 {
Chris@16 46 /**
Chris@16 47 * \brief Return an iterator to the last element of the given vector
Chris@16 48 * expression.
Chris@16 49 * \tparam ExprT A model of VectorExpression type.
Chris@16 50 * \param e A vector expression.
Chris@16 51 * \return An iterator over the given vector expression.
Chris@16 52 */
Chris@16 53 template <typename ExprT>
Chris@16 54 static typename ExprT::iterator apply(ExprT& e)
Chris@16 55 {
Chris@16 56 return e.end();
Chris@16 57 }
Chris@16 58
Chris@16 59
Chris@16 60 /**
Chris@16 61 * \brief Return a const iterator to the last element of the given vector
Chris@16 62 * expression.
Chris@16 63 * \tparam ExprT A model of VectorExpression type.
Chris@16 64 * \param e A vector expression.
Chris@16 65 * \return A const iterator to the first element of the given vector
Chris@16 66 * expression.
Chris@16 67 */
Chris@16 68 template <typename ExprT>
Chris@16 69 static typename ExprT::const_iterator apply(ExprT const& e)
Chris@16 70 {
Chris@16 71 return e.end();
Chris@16 72 }
Chris@16 73 };
Chris@16 74
Chris@16 75
Chris@16 76 /// \brief Specialization of \c end_impl for iterating matrix expressions with a
Chris@16 77 /// row-major orientation over the major dimension.
Chris@16 78 template <>
Chris@16 79 struct end_impl<matrix_tag,tag::major,row_major_tag>
Chris@16 80 {
Chris@16 81 /**
Chris@16 82 * \brief Return an iterator to the last element of the given row-major
Chris@16 83 * matrix expression over the major dimension.
Chris@16 84 * \tparam ExprT A model of MatrixExpression type.
Chris@16 85 * \param e A matrix expression.
Chris@16 86 * \return An iterator over the major dimension of the given matrix
Chris@16 87 * expression.
Chris@16 88 */
Chris@16 89 template <typename ExprT>
Chris@16 90 static typename ExprT::iterator1 apply(ExprT& e)
Chris@16 91 {
Chris@16 92 return e.end1();
Chris@16 93 }
Chris@16 94
Chris@16 95
Chris@16 96 /**
Chris@16 97 * \brief Return a const iterator to the last element of the given row-major
Chris@16 98 * matrix expression over the major dimension.
Chris@16 99 * \tparam ExprT A model of MatrixExpression type.
Chris@16 100 * \param e A matrix expression.
Chris@16 101 * \return A const iterator over the major dimension of the given matrix
Chris@16 102 * expression.
Chris@16 103 */
Chris@16 104 template <typename ExprT>
Chris@16 105 static typename ExprT::const_iterator1 apply(ExprT const& e)
Chris@16 106 {
Chris@16 107 return e.end1();
Chris@16 108 }
Chris@16 109 };
Chris@16 110
Chris@16 111
Chris@16 112 /// \brief Specialization of \c end_impl for iterating matrix expressions with a
Chris@16 113 /// column-major orientation over the major dimension.
Chris@16 114 template <>
Chris@16 115 struct end_impl<matrix_tag,tag::major,column_major_tag>
Chris@16 116 {
Chris@16 117 /**
Chris@16 118 * \brief Return an iterator to the last element of the given column-major
Chris@16 119 * matrix expression over the major dimension.
Chris@16 120 * \tparam ExprT A model of MatrixExpression type.
Chris@16 121 * \param e A matrix expression.
Chris@16 122 * \return An iterator over the major dimension of the given matrix
Chris@16 123 * expression.
Chris@16 124 */
Chris@16 125 template <typename ExprT>
Chris@16 126 static typename ExprT::iterator2 apply(ExprT& e)
Chris@16 127 {
Chris@16 128 return e.end2();
Chris@16 129 }
Chris@16 130
Chris@16 131
Chris@16 132 /**
Chris@16 133 * \brief Return a const iterator to the last element of the given
Chris@16 134 * column-major matrix expression over the major dimension.
Chris@16 135 * \tparam ExprT A model of MatrixExpression type.
Chris@16 136 * \param e A matrix expression.
Chris@16 137 * \return A const iterator over the major dimension of the given matrix
Chris@16 138 * expression.
Chris@16 139 */
Chris@16 140 template <typename ExprT>
Chris@16 141 static typename ExprT::const_iterator2 apply(ExprT const& e)
Chris@16 142 {
Chris@16 143 return e.end2();
Chris@16 144 }
Chris@16 145 };
Chris@16 146
Chris@16 147
Chris@16 148 /// \brief Specialization of \c end_impl for iterating matrix expressions with a
Chris@16 149 /// row-major orientation over the minor dimension.
Chris@16 150 template <>
Chris@16 151 struct end_impl<matrix_tag,tag::minor,row_major_tag>
Chris@16 152 {
Chris@16 153 /**
Chris@16 154 * \brief Return an iterator to the last element of the given row-major
Chris@16 155 * matrix expression over the minor dimension.
Chris@16 156 * \tparam ExprT A model of MatrixExpression type.
Chris@16 157 * \param e A matrix expression.
Chris@16 158 * \return An iterator over the minor dimension of the given matrix
Chris@16 159 * expression.
Chris@16 160 */
Chris@16 161 template <typename ExprT>
Chris@16 162 static typename ExprT::iterator2 apply(ExprT& e)
Chris@16 163 {
Chris@16 164 return e.end2();
Chris@16 165 }
Chris@16 166
Chris@16 167
Chris@16 168 /**
Chris@16 169 * \brief Return a const iterator to the last element of the given
Chris@16 170 * row-minor matrix expression over the major dimension.
Chris@16 171 * \tparam ExprT A model of MatrixExpression type.
Chris@16 172 * \param e A matrix expression.
Chris@16 173 * \return A const iterator over the minor dimension of the given matrix
Chris@16 174 * expression.
Chris@16 175 */
Chris@16 176 template <typename ExprT>
Chris@16 177 static typename ExprT::const_iterator2 apply(ExprT const& e)
Chris@16 178 {
Chris@16 179 return e.end2();
Chris@16 180 }
Chris@16 181 };
Chris@16 182
Chris@16 183
Chris@16 184 /// \brief Specialization of \c end_impl for iterating matrix expressions with a
Chris@16 185 /// column-major orientation over the minor dimension.
Chris@16 186 template <>
Chris@16 187 struct end_impl<matrix_tag,tag::minor,column_major_tag>
Chris@16 188 {
Chris@16 189 /**
Chris@16 190 * \brief Return an iterator to the last element of the given column-major
Chris@16 191 * matrix expression over the minor dimension.
Chris@16 192 * \tparam ExprT A model of MatrixExpression type.
Chris@16 193 * \param e A matrix expression.
Chris@16 194 * \return An iterator over the minor dimension of the given matrix
Chris@16 195 * expression.
Chris@16 196 */
Chris@16 197 template <typename ExprT>
Chris@16 198 static typename ExprT::iterator1 apply(ExprT& e)
Chris@16 199 {
Chris@16 200 return e.end1();
Chris@16 201 }
Chris@16 202
Chris@16 203
Chris@16 204 /**
Chris@16 205 * \brief Return a const iterator to the last element of the given
Chris@16 206 * column-minor matrix expression over the major dimension.
Chris@16 207 * \tparam ExprT A model of MatrixExpression type.
Chris@16 208 * \param e A matrix expression.
Chris@16 209 * \return A const iterator over the minor dimension of the given matrix
Chris@16 210 * expression.
Chris@16 211 */
Chris@16 212 template <typename ExprT>
Chris@16 213 static typename ExprT::const_iterator1 apply(ExprT const& e)
Chris@16 214 {
Chris@16 215 return e.end1();
Chris@16 216 }
Chris@16 217 };
Chris@16 218
Chris@16 219 } // Namespace detail
Chris@16 220
Chris@16 221
Chris@16 222 /**
Chris@16 223 * \brief An iterator to the last element of the given vector expression.
Chris@16 224 * \tparam ExprT A model of VectorExpression type.
Chris@16 225 * \param e A vector expression.
Chris@16 226 * \return An iterator to the last element of the given vector expression.
Chris@16 227 */
Chris@16 228 template <typename ExprT>
Chris@16 229 BOOST_UBLAS_INLINE
Chris@16 230 typename ExprT::iterator end(vector_expression<ExprT>& e)
Chris@16 231 {
Chris@16 232 return detail::end_impl<typename ExprT::type_category>::apply(e());
Chris@16 233 }
Chris@16 234
Chris@16 235
Chris@16 236 /**
Chris@16 237 * \brief A const iterator to the last element of the given vector expression.
Chris@16 238 * \tparam ExprT A model of VectorExpression type.
Chris@16 239 * \param e A vector expression.
Chris@16 240 * \return A const iterator to the last element of the given vector expression.
Chris@16 241 */
Chris@16 242 template <typename ExprT>
Chris@16 243 BOOST_UBLAS_INLINE
Chris@16 244 typename ExprT::const_iterator end(vector_expression<ExprT> const& e)
Chris@16 245 {
Chris@16 246 return detail::end_impl<typename ExprT::type_category>::apply(e());
Chris@16 247 }
Chris@16 248
Chris@16 249
Chris@16 250 /**
Chris@16 251 * \brief An iterator to the last element of the given matrix expression
Chris@16 252 * according to its orientation.
Chris@16 253 * \tparam DimTagT A dimension tag type (e.g., tag::major).
Chris@16 254 * \tparam ExprT A model of MatrixExpression type.
Chris@16 255 * \param e A matrix expression.
Chris@16 256 * \return An iterator to the last element of the given matrix expression
Chris@16 257 * according to its orientation.
Chris@16 258 */
Chris@16 259 template <typename TagT, typename ExprT>
Chris@16 260 BOOST_UBLAS_INLINE
Chris@16 261 typename iterator_type<ExprT,TagT>::type end(matrix_expression<ExprT>& e)
Chris@16 262 {
Chris@16 263 return detail::end_impl<typename ExprT::type_category, TagT, typename ExprT::orientation_category>::apply(e());
Chris@16 264 }
Chris@16 265
Chris@16 266
Chris@16 267 /**
Chris@16 268 * \brief A const iterator to the last element of the given matrix expression
Chris@16 269 * according to its orientation.
Chris@16 270 * \tparam TagT A dimension tag type (e.g., tag::major).
Chris@16 271 * \tparam ExprT A model of MatrixExpression type.
Chris@16 272 * \param e A matrix expression.
Chris@16 273 * \return A const iterator to the last element of the given matrix expression
Chris@16 274 * according to its orientation.
Chris@16 275 */
Chris@16 276 template <typename TagT, typename ExprT>
Chris@16 277 BOOST_UBLAS_INLINE
Chris@16 278 typename const_iterator_type<ExprT,TagT>::type end(matrix_expression<ExprT> const& e)
Chris@16 279 {
Chris@16 280 return detail::end_impl<typename ExprT::type_category, TagT, typename ExprT::orientation_category>::apply(e());
Chris@16 281 }
Chris@16 282
Chris@16 283
Chris@16 284 /**
Chris@16 285 * \brief An iterator to the last element over the dual dimension of the given
Chris@16 286 * iterator.
Chris@16 287 * \tparam IteratorT A model of Iterator type.
Chris@16 288 * \param it An iterator.
Chris@16 289 * \return An iterator to the last element over the dual dimension of the given
Chris@16 290 * iterator.
Chris@16 291 */
Chris@16 292 template <typename IteratorT>
Chris@16 293 BOOST_UBLAS_INLINE
Chris@16 294 typename IteratorT::dual_iterator_type end(IteratorT& it)
Chris@16 295 {
Chris@16 296 return it.end();
Chris@16 297 }
Chris@16 298
Chris@16 299
Chris@16 300 /**
Chris@16 301 * \brief A const iterator to the last element over the dual dimension of the
Chris@16 302 * given iterator.
Chris@16 303 * \tparam IteratorT A model of Iterator type.
Chris@16 304 * \param it An iterator.
Chris@16 305 * \return A const iterator to the last element over the dual dimension of the
Chris@16 306 * given iterator.
Chris@16 307 */
Chris@16 308 template <typename IteratorT>
Chris@16 309 BOOST_UBLAS_INLINE
Chris@16 310 typename IteratorT::dual_iterator_type end(IteratorT const& it)
Chris@16 311 {
Chris@16 312 return it.end();
Chris@16 313 }
Chris@16 314
Chris@16 315 }}} // Namespace boost::numeric::ublas
Chris@16 316
Chris@16 317
Chris@16 318 #endif // BOOST_NUMERIC_UBLAS_OPERATION_END_HPP