Added boost header
This commit is contained in:
318
test/external/boost/numeric/ublas/operation/begin.hpp
vendored
Normal file
318
test/external/boost/numeric/ublas/operation/begin.hpp
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
/**
|
||||
* -*- c++ -*-
|
||||
*
|
||||
* \file begin.hpp
|
||||
*
|
||||
* \brief The \c begin operation.
|
||||
*
|
||||
* Copyright (c) 2009, Marco Guazzone
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* \author Marco Guazzone, marco.guazzone@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_UBLAS_OPERATION_BEGIN_HPP
|
||||
#define BOOST_NUMERIC_UBLAS_OPERATION_BEGIN_HPP
|
||||
|
||||
|
||||
#include <boost/numeric/ublas/expression_types.hpp>
|
||||
#include <boost/numeric/ublas/fwd.hpp>
|
||||
#include <boost/numeric/ublas/traits/const_iterator_type.hpp>
|
||||
#include <boost/numeric/ublas/traits/iterator_type.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
namespace detail {
|
||||
|
||||
/**
|
||||
* \brief Auxiliary class for implementing the \c begin operation.
|
||||
* \tparam CategoryT The expression category type (e.g., vector_tag).
|
||||
* \tparam TagT The dimension type tag (e.g., tag::major).
|
||||
* \tparam OrientationT The orientation category type (e.g., row_major_tag).
|
||||
*/
|
||||
template <typename CategoryT, typename TagT=void, typename OrientationT=void>
|
||||
struct begin_impl;
|
||||
|
||||
|
||||
/// \brief Specialization of \c begin_impl for iterating vector expressions.
|
||||
template <>
|
||||
struct begin_impl<vector_tag,void,void>
|
||||
{
|
||||
/**
|
||||
* \brief Return an iterator to the first element of the given vector
|
||||
* expression.
|
||||
* \tparam ExprT A model of VectorExpression type.
|
||||
* \param e A vector expression.
|
||||
* \return An iterator over the given vector expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::iterator apply(ExprT& e)
|
||||
{
|
||||
return e.begin();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return a const iterator to the first element of the given vector
|
||||
* expression.
|
||||
* \tparam ExprT A model of VectorExpression type.
|
||||
* \param e A vector expression.
|
||||
* \return A const iterator to the first element of the given vector
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::const_iterator apply(ExprT const& e)
|
||||
{
|
||||
return e.begin();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c begin_impl for iterating matrix expressions with
|
||||
/// a row-major orientation over the major dimension.
|
||||
template <>
|
||||
struct begin_impl<matrix_tag,tag::major,row_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Return an iterator to the first element of the given row-major
|
||||
* matrix expression over the major dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return An iterator over the major dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::iterator1 apply(ExprT& e)
|
||||
{
|
||||
return e.begin1();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return a const iterator to the first element of the given
|
||||
* row-major matrix expression over the major dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return A const iterator over the major dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::const_iterator1 apply(ExprT const& e)
|
||||
{
|
||||
return e.begin1();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c begin_impl for iterating matrix expressions with
|
||||
/// a column-major orientation over the major dimension.
|
||||
template <>
|
||||
struct begin_impl<matrix_tag,tag::major,column_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Return an iterator to the first element of the given column-major
|
||||
* matrix expression over the major dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return An iterator over the major dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::iterator2 apply(ExprT& e)
|
||||
{
|
||||
return e.begin2();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return a const iterator to the first element of the given
|
||||
* column-major matrix expression over the major dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return A const iterator over the major dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::const_iterator2 apply(ExprT const& e)
|
||||
{
|
||||
return e.begin2();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c begin_impl for iterating matrix expressions with
|
||||
/// a row-major orientation over the minor dimension.
|
||||
template <>
|
||||
struct begin_impl<matrix_tag,tag::minor,row_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Return an iterator to the first element of the given row-major
|
||||
* matrix expression over the minor dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return An iterator over the minor dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::iterator2 apply(ExprT& e)
|
||||
{
|
||||
return e.begin2();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return a const iterator to the first element of the given
|
||||
* row-major matrix expression over the minor dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return A const iterator over the minor dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::const_iterator2 apply(ExprT const& e)
|
||||
{
|
||||
return e.begin2();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// \brief Specialization of \c begin_impl for iterating matrix expressions with
|
||||
/// a column-major orientation over the minor dimension.
|
||||
template <>
|
||||
struct begin_impl<matrix_tag,tag::minor,column_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Return an iterator to the first element of the given column-major
|
||||
* matrix expression over the minor dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return An iterator over the minor dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::iterator1 apply(ExprT& e)
|
||||
{
|
||||
return e.begin1();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return a const iterator to the first element of the given
|
||||
* column-major matrix expression over the minor dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return A const iterator over the minor dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::const_iterator1 apply(ExprT const& e)
|
||||
{
|
||||
return e.begin1();
|
||||
}
|
||||
};
|
||||
|
||||
} // Namespace detail
|
||||
|
||||
|
||||
/**
|
||||
* \brief An iterator to the first element of the given vector expression.
|
||||
* \tparam ExprT A model of VectorExpression type.
|
||||
* \param e A vector expression.
|
||||
* \return An iterator to the first element of the given vector expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename ExprT::iterator begin(vector_expression<ExprT>& e)
|
||||
{
|
||||
return detail::begin_impl<typename ExprT::type_category>::apply(e());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief A const iterator to the first element of the given vector expression.
|
||||
* \tparam ExprT A model of VectorExpression type.
|
||||
* \param e A vector expression.
|
||||
* \return A const iterator to the first element of the given vector expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename ExprT::const_iterator begin(vector_expression<ExprT> const& e)
|
||||
{
|
||||
return detail::begin_impl<typename ExprT::type_category>::apply(e());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief An iterator to the first element of the given matrix expression
|
||||
* according to its orientation.
|
||||
* \tparam DimTagT A dimension tag type (e.g., tag::major).
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return An iterator to the first element of the given matrix expression
|
||||
* according to its orientation.
|
||||
*/
|
||||
template <typename TagT, typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename iterator_type<ExprT,TagT>::type begin(matrix_expression<ExprT>& e)
|
||||
{
|
||||
return detail::begin_impl<typename ExprT::type_category, TagT, typename ExprT::orientation_category>::apply(e());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief A const iterator to the first element of the given matrix expression
|
||||
* according to its orientation.
|
||||
* \tparam TagT A dimension tag type (e.g., tag::major).
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return A const iterator to the first element of the given matrix expression
|
||||
* according to its orientation.
|
||||
*/
|
||||
template <typename TagT, typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename const_iterator_type<ExprT,TagT>::type begin(matrix_expression<ExprT> const& e)
|
||||
{
|
||||
return detail::begin_impl<typename ExprT::type_category, TagT, typename ExprT::orientation_category>::apply(e());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief An iterator to the first element over the dual dimension of the given
|
||||
* iterator.
|
||||
* \tparam IteratorT A model of Iterator type.
|
||||
* \param it An iterator.
|
||||
* \return An iterator to the first element over the dual dimension of the given
|
||||
* iterator.
|
||||
*/
|
||||
template <typename IteratorT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename IteratorT::dual_iterator_type begin(IteratorT& it)
|
||||
{
|
||||
return it.begin();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief A const iterator to the first element over the dual dimension of the
|
||||
* given iterator.
|
||||
* \tparam IteratorT A model of Iterator type.
|
||||
* \param it An iterator.
|
||||
* \return A const iterator to the first element over the dual dimension of the
|
||||
* given iterator.
|
||||
*/
|
||||
template <typename IteratorT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename IteratorT::dual_iterator_type begin(IteratorT const& it)
|
||||
{
|
||||
return it.begin();
|
||||
}
|
||||
|
||||
}}} // Namespace boost::numeric::ublas
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_UBLAS_OPERATION_BEGIN_HPP
|
||||
41
test/external/boost/numeric/ublas/operation/c_array.hpp
vendored
Normal file
41
test/external/boost/numeric/ublas/operation/c_array.hpp
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* -*- c++ -*-
|
||||
*
|
||||
* \file c_array.hpp
|
||||
*
|
||||
* \brief provides specializations of matrix and vector operations for c arrays and c matrices.
|
||||
*
|
||||
* Copyright (c) 2009, Gunter Winkler
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* \author Gunter Winkler (guwi17 at gmx dot de)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_UBLAS_OPERATION_C_ARRAY_HPP
|
||||
#define BOOST_NUMERIC_UBLAS_OPERATION_C_ARRAY_HPP
|
||||
|
||||
#include <boost/numeric/ublas/traits/c_array.hpp>
|
||||
|
||||
namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
namespace detail {
|
||||
|
||||
|
||||
|
||||
} // namespace boost::numeric::ublas::detail
|
||||
|
||||
|
||||
template <typename T>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename ExprT::const_iterator begin(vector_expression<ExprT> const& e)
|
||||
{
|
||||
return detail::begin_impl<typename ExprT::type_category>::apply(e());
|
||||
}
|
||||
|
||||
|
||||
}}} // Namespace boost::numeric::ublas
|
||||
|
||||
#endif
|
||||
318
test/external/boost/numeric/ublas/operation/end.hpp
vendored
Normal file
318
test/external/boost/numeric/ublas/operation/end.hpp
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
/**
|
||||
* -*- c++ -*-
|
||||
*
|
||||
* \file end.hpp
|
||||
*
|
||||
* \brief The \c end operation.
|
||||
*
|
||||
* Copyright (c) 2009, Marco Guazzone
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* \author Marco Guazzone, marco.guazzone@gmail.com
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_UBLAS_OPERATION_END_HPP
|
||||
#define BOOST_NUMERIC_UBLAS_OPERATION_END_HPP
|
||||
|
||||
|
||||
#include <boost/numeric/ublas/expression_types.hpp>
|
||||
#include <boost/numeric/ublas/fwd.hpp>
|
||||
#include <boost/numeric/ublas/traits/const_iterator_type.hpp>
|
||||
#include <boost/numeric/ublas/traits/iterator_type.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
namespace detail {
|
||||
|
||||
/**
|
||||
* \brief Auxiliary class for implementing the \c end operation.
|
||||
* \tparam CategoryT The expression category type (e.g., vector_tag).
|
||||
* \tparam TagT The dimension type tag (e.g., tag::major).
|
||||
* \tparam OrientationT The orientation category type (e.g., row_major_tag).
|
||||
*/
|
||||
template <typename CategoryT, typename TagT=void, typename OrientationT=void>
|
||||
struct end_impl;
|
||||
|
||||
|
||||
/// \brief Specialization of \c end_impl for iterating vector expressions.
|
||||
template <>
|
||||
struct end_impl<vector_tag,void,void>
|
||||
{
|
||||
/**
|
||||
* \brief Return an iterator to the last element of the given vector
|
||||
* expression.
|
||||
* \tparam ExprT A model of VectorExpression type.
|
||||
* \param e A vector expression.
|
||||
* \return An iterator over the given vector expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::iterator apply(ExprT& e)
|
||||
{
|
||||
return e.end();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return a const iterator to the last element of the given vector
|
||||
* expression.
|
||||
* \tparam ExprT A model of VectorExpression type.
|
||||
* \param e A vector expression.
|
||||
* \return A const iterator to the first element of the given vector
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::const_iterator apply(ExprT const& e)
|
||||
{
|
||||
return e.end();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c end_impl for iterating matrix expressions with a
|
||||
/// row-major orientation over the major dimension.
|
||||
template <>
|
||||
struct end_impl<matrix_tag,tag::major,row_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Return an iterator to the last element of the given row-major
|
||||
* matrix expression over the major dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return An iterator over the major dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::iterator1 apply(ExprT& e)
|
||||
{
|
||||
return e.end1();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return a const iterator to the last element of the given row-major
|
||||
* matrix expression over the major dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return A const iterator over the major dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::const_iterator1 apply(ExprT const& e)
|
||||
{
|
||||
return e.end1();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c end_impl for iterating matrix expressions with a
|
||||
/// column-major orientation over the major dimension.
|
||||
template <>
|
||||
struct end_impl<matrix_tag,tag::major,column_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Return an iterator to the last element of the given column-major
|
||||
* matrix expression over the major dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return An iterator over the major dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::iterator2 apply(ExprT& e)
|
||||
{
|
||||
return e.end2();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return a const iterator to the last element of the given
|
||||
* column-major matrix expression over the major dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return A const iterator over the major dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::const_iterator2 apply(ExprT const& e)
|
||||
{
|
||||
return e.end2();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c end_impl for iterating matrix expressions with a
|
||||
/// row-major orientation over the minor dimension.
|
||||
template <>
|
||||
struct end_impl<matrix_tag,tag::minor,row_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Return an iterator to the last element of the given row-major
|
||||
* matrix expression over the minor dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return An iterator over the minor dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::iterator2 apply(ExprT& e)
|
||||
{
|
||||
return e.end2();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return a const iterator to the last element of the given
|
||||
* row-minor matrix expression over the major dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return A const iterator over the minor dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::const_iterator2 apply(ExprT const& e)
|
||||
{
|
||||
return e.end2();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c end_impl for iterating matrix expressions with a
|
||||
/// column-major orientation over the minor dimension.
|
||||
template <>
|
||||
struct end_impl<matrix_tag,tag::minor,column_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Return an iterator to the last element of the given column-major
|
||||
* matrix expression over the minor dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return An iterator over the minor dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::iterator1 apply(ExprT& e)
|
||||
{
|
||||
return e.end1();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return a const iterator to the last element of the given
|
||||
* column-minor matrix expression over the major dimension.
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return A const iterator over the minor dimension of the given matrix
|
||||
* expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
static typename ExprT::const_iterator1 apply(ExprT const& e)
|
||||
{
|
||||
return e.end1();
|
||||
}
|
||||
};
|
||||
|
||||
} // Namespace detail
|
||||
|
||||
|
||||
/**
|
||||
* \brief An iterator to the last element of the given vector expression.
|
||||
* \tparam ExprT A model of VectorExpression type.
|
||||
* \param e A vector expression.
|
||||
* \return An iterator to the last element of the given vector expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename ExprT::iterator end(vector_expression<ExprT>& e)
|
||||
{
|
||||
return detail::end_impl<typename ExprT::type_category>::apply(e());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief A const iterator to the last element of the given vector expression.
|
||||
* \tparam ExprT A model of VectorExpression type.
|
||||
* \param e A vector expression.
|
||||
* \return A const iterator to the last element of the given vector expression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename ExprT::const_iterator end(vector_expression<ExprT> const& e)
|
||||
{
|
||||
return detail::end_impl<typename ExprT::type_category>::apply(e());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief An iterator to the last element of the given matrix expression
|
||||
* according to its orientation.
|
||||
* \tparam DimTagT A dimension tag type (e.g., tag::major).
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return An iterator to the last element of the given matrix expression
|
||||
* according to its orientation.
|
||||
*/
|
||||
template <typename TagT, typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename iterator_type<ExprT,TagT>::type end(matrix_expression<ExprT>& e)
|
||||
{
|
||||
return detail::end_impl<typename ExprT::type_category, TagT, typename ExprT::orientation_category>::apply(e());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief A const iterator to the last element of the given matrix expression
|
||||
* according to its orientation.
|
||||
* \tparam TagT A dimension tag type (e.g., tag::major).
|
||||
* \tparam ExprT A model of MatrixExpression type.
|
||||
* \param e A matrix expression.
|
||||
* \return A const iterator to the last element of the given matrix expression
|
||||
* according to its orientation.
|
||||
*/
|
||||
template <typename TagT, typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename const_iterator_type<ExprT,TagT>::type end(matrix_expression<ExprT> const& e)
|
||||
{
|
||||
return detail::end_impl<typename ExprT::type_category, TagT, typename ExprT::orientation_category>::apply(e());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief An iterator to the last element over the dual dimension of the given
|
||||
* iterator.
|
||||
* \tparam IteratorT A model of Iterator type.
|
||||
* \param it An iterator.
|
||||
* \return An iterator to the last element over the dual dimension of the given
|
||||
* iterator.
|
||||
*/
|
||||
template <typename IteratorT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename IteratorT::dual_iterator_type end(IteratorT& it)
|
||||
{
|
||||
return it.end();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief A const iterator to the last element over the dual dimension of the
|
||||
* given iterator.
|
||||
* \tparam IteratorT A model of Iterator type.
|
||||
* \param it An iterator.
|
||||
* \return A const iterator to the last element over the dual dimension of the
|
||||
* given iterator.
|
||||
*/
|
||||
template <typename IteratorT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename IteratorT::dual_iterator_type end(IteratorT const& it)
|
||||
{
|
||||
return it.end();
|
||||
}
|
||||
|
||||
}}} // Namespace boost::numeric::ublas
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_UBLAS_OPERATION_END_HPP
|
||||
43
test/external/boost/numeric/ublas/operation/num_columns.hpp
vendored
Normal file
43
test/external/boost/numeric/ublas/operation/num_columns.hpp
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* -*- c++ -*-
|
||||
*
|
||||
* \file num_columns.hpp
|
||||
*
|
||||
* \brief The \c num_columns operation.
|
||||
*
|
||||
* Copyright (c) 2009, Marco Guazzone
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* \author Marco Guazzone, marco.guazzone@gmail.com
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_NUMERIC_UBLAS_OPERATION_NUM_COLUMNS_HPP
|
||||
#define BOOST_NUMERIC_UBLAS_OPERATION_NUM_COLUMNS_HPP
|
||||
|
||||
|
||||
#include <boost/numeric/ublas/detail/config.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
/**
|
||||
* \brief Return the number of columns.
|
||||
* \tparam MatrixExprT A type which models the matrix expression concept.
|
||||
* \param m A matrix expression.
|
||||
* \return The number of columns.
|
||||
*/
|
||||
template <typename MatrixExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename MatrixExprT::size_type num_columns(MatrixExprT const& m)
|
||||
{
|
||||
return m.size2();
|
||||
}
|
||||
|
||||
}}} // Namespace boost::numeric::ublas
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_UBLAS_OPERATION_NUM_COLUMNS_HPP
|
||||
42
test/external/boost/numeric/ublas/operation/num_rows.hpp
vendored
Normal file
42
test/external/boost/numeric/ublas/operation/num_rows.hpp
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* -*- c++ -*-
|
||||
*
|
||||
* \file num_rows.hpp
|
||||
*
|
||||
* \brief The \c num_rows operation.
|
||||
*
|
||||
* Copyright (c) 2009, Marco Guazzone
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* \author Marco Guazzone, marco.guazzone@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_UBLAS_OPERATION_NUM_ROWS_HPP
|
||||
#define BOOST_NUMERIC_UBLAS_OPERATION_NUM_ROWS_HPP
|
||||
|
||||
|
||||
#include <boost/numeric/ublas/detail/config.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
/**
|
||||
* \brief Return the number of rows.
|
||||
* \tparam MatrixExprT A type which models the matrix expression concept.
|
||||
* \param m A matrix expression.
|
||||
* \return The number of rows.
|
||||
*/
|
||||
template <typename MatrixExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename MatrixExprT::size_type num_rows(MatrixExprT const& m)
|
||||
{
|
||||
return m.size1();
|
||||
}
|
||||
|
||||
}}} // Namespace boost::numeric::ublas
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_UBLAS_OPERATION_NUM_ROWS_HPP
|
||||
350
test/external/boost/numeric/ublas/operation/size.hpp
vendored
Normal file
350
test/external/boost/numeric/ublas/operation/size.hpp
vendored
Normal file
@@ -0,0 +1,350 @@
|
||||
/**
|
||||
* \file size.hpp
|
||||
*
|
||||
* \brief The family of \c size operations.
|
||||
*
|
||||
* Copyright (c) 2009-2010, Marco Guazzone
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* \author Marco Guazzone, marco.guazzone@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef BOOST_NUMERIC_UBLAS_OPERATION_SIZE_HPP
|
||||
#define BOOST_NUMERIC_UBLAS_OPERATION_SIZE_HPP
|
||||
|
||||
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/numeric/ublas/detail/config.hpp>
|
||||
#include <boost/numeric/ublas/expression_types.hpp>
|
||||
#include <boost/numeric/ublas/fwd.hpp>
|
||||
#include <boost/numeric/ublas/tags.hpp>
|
||||
#include <boost/numeric/ublas/traits.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
namespace boost { namespace numeric { namespace ublas {
|
||||
|
||||
namespace detail { namespace /*<unnamed>*/ {
|
||||
|
||||
/// Define a \c has_size_type trait class.
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(size_type)
|
||||
|
||||
|
||||
/**
|
||||
* \brief Wrapper type-traits used in \c boost::lazy_enabled_if for getting the
|
||||
* size type (see below).
|
||||
* \tparam VectorT A vector type.
|
||||
*/
|
||||
template <typename VectorT>
|
||||
struct vector_size_type
|
||||
{
|
||||
/// The size type.
|
||||
typedef typename vector_traits<VectorT>::size_type type;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Wrapper type-traits used in \c boost::lazy_enabled_if for getting the
|
||||
* size type (see below).
|
||||
* \tparam MatrixT A matrix type.
|
||||
*/
|
||||
template <typename MatrixT>
|
||||
struct matrix_size_type
|
||||
{
|
||||
/// The size type.
|
||||
typedef typename matrix_traits<MatrixT>::size_type type;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Auxiliary class for computing the size of the given dimension for
|
||||
* a container of the given category.
|
||||
* \tparam Dim The dimension number (starting from 1).
|
||||
* \tparam CategoryT The category type (e.g., vector_tag).
|
||||
*/
|
||||
template <std::size_t Dim, typename CategoryT>
|
||||
struct size_by_dim_impl;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Auxiliary class for computing the size of the given dimension for
|
||||
* a container of the given category and with the given orientation.
|
||||
* \tparam Dim The dimension number (starting from 1).
|
||||
* \tparam CategoryT The category type (e.g., vector_tag).
|
||||
* \tparam OrientationT The orientation category type (e.g., row_major_tag).
|
||||
*/
|
||||
template <typename TagT, typename CategoryT, typename OrientationT>
|
||||
struct size_by_tag_impl;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Specialization of \c size_by_dim_impl for computing the size of a
|
||||
* vector.
|
||||
*/
|
||||
template <>
|
||||
struct size_by_dim_impl<1, vector_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Compute the size of the given vector.
|
||||
* \tparam ExprT A vector expression type.
|
||||
* \pre ExprT must be a model of VectorExpression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
static typename vector_traits<ExprT>::size_type apply(vector_expression<ExprT> const& ve)
|
||||
{
|
||||
return ve().size();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Specialization of \c size_by_dim_impl for computing the number of
|
||||
* rows of a matrix
|
||||
*/
|
||||
template <>
|
||||
struct size_by_dim_impl<1, matrix_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Compute the number of rows of the given matrix.
|
||||
* \tparam ExprT A matrix expression type.
|
||||
* \pre ExprT must be a model of MatrixExpression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
|
||||
{
|
||||
return me().size1();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Specialization of \c size_by_dim_impl for computing the number of
|
||||
* columns of a matrix
|
||||
*/
|
||||
template <>
|
||||
struct size_by_dim_impl<2, matrix_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Compute the number of columns of the given matrix.
|
||||
* \tparam ExprT A matrix expression type.
|
||||
* \pre ExprT must be a model of MatrixExpression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
|
||||
{
|
||||
return me().size2();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Specialization of \c size_by_tag_impl for computing the size of the
|
||||
* major dimension of a row-major oriented matrix.
|
||||
*/
|
||||
template <>
|
||||
struct size_by_tag_impl<tag::major, matrix_tag, row_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Compute the number of rows of the given matrix.
|
||||
* \tparam ExprT A matrix expression type.
|
||||
* \pre ExprT must be a model of MatrixExpression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
|
||||
{
|
||||
return me().size1();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Specialization of \c size_by_tag_impl for computing the size of the
|
||||
* minor dimension of a row-major oriented matrix.
|
||||
*/
|
||||
template <>
|
||||
struct size_by_tag_impl<tag::minor, matrix_tag, row_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Compute the number of columns of the given matrix.
|
||||
* \tparam ExprT A matrix expression type.
|
||||
* \pre ExprT must be a model of MatrixExpression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
|
||||
{
|
||||
return me().size2();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Specialization of \c size_by_tag_impl for computing the size of the
|
||||
* leading dimension of a row-major oriented matrix.
|
||||
*/
|
||||
template <>
|
||||
struct size_by_tag_impl<tag::leading, matrix_tag, row_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Compute the number of columns of the given matrix.
|
||||
* \tparam ExprT A matrix expression type.
|
||||
* \pre ExprT must be a model of MatrixExpression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
|
||||
{
|
||||
return me().size2();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c size_by_tag_impl for computing the size of the
|
||||
/// major dimension of a column-major oriented matrix.
|
||||
template <>
|
||||
struct size_by_tag_impl<tag::major, matrix_tag, column_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Compute the number of columns of the given matrix.
|
||||
* \tparam ExprT A matrix expression type.
|
||||
* \pre ExprT must be a model of MatrixExpression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
|
||||
{
|
||||
return me().size2();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c size_by_tag_impl for computing the size of the
|
||||
/// minor dimension of a column-major oriented matrix.
|
||||
template <>
|
||||
struct size_by_tag_impl<tag::minor, matrix_tag, column_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Compute the number of rows of the given matrix.
|
||||
* \tparam ExprT A matrix expression type.
|
||||
* \pre ExprT must be a model of MatrixExpression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
|
||||
{
|
||||
return me().size1();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c size_by_tag_impl for computing the size of the
|
||||
/// leading dimension of a column-major oriented matrix.
|
||||
template <>
|
||||
struct size_by_tag_impl<tag::leading, matrix_tag, column_major_tag>
|
||||
{
|
||||
/**
|
||||
* \brief Compute the number of rows of the given matrix.
|
||||
* \tparam ExprT A matrix expression type.
|
||||
* \pre ExprT must be a model of MatrixExpression.
|
||||
*/
|
||||
template <typename ExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
static typename matrix_traits<ExprT>::size_type apply(matrix_expression<ExprT> const& me)
|
||||
{
|
||||
return me().size1();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Specialization of \c size_by_tag_impl for computing the size of the
|
||||
/// given dimension of a unknown oriented expression.
|
||||
template <typename TagT, typename CategoryT>
|
||||
struct size_by_tag_impl<TagT, CategoryT, unknown_orientation_tag>: size_by_tag_impl<TagT, CategoryT, row_major_tag>
|
||||
{
|
||||
// Empty
|
||||
};
|
||||
|
||||
}} // Namespace detail::<unnamed>
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return the number of columns.
|
||||
* \tparam VectorExprT A type which models the vector expression concept.
|
||||
* \param ve A vector expression.
|
||||
* \return The length of the input vector expression.
|
||||
*/
|
||||
template <typename VectorExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename ::boost::lazy_enable_if_c<
|
||||
detail::has_size_type<VectorExprT>::value,
|
||||
detail::vector_size_type<VectorExprT>
|
||||
>::type size(vector_expression<VectorExprT> const& ve)
|
||||
{
|
||||
return ve().size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return the size of the given dimension for the given vector
|
||||
* expression.
|
||||
* \tparam Dim The dimension number (starting from 1).
|
||||
* \tparam VectorExprT A vector expression type.
|
||||
* \param ve A vector expression.
|
||||
* \return The length of the input vector expression.
|
||||
*/
|
||||
template <std::size_t Dim, typename VectorExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename vector_traits<VectorExprT>::size_type size(vector_expression<VectorExprT> const& ve)
|
||||
{
|
||||
return detail::size_by_dim_impl<Dim, vector_tag>::template apply(ve);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return the size of the given dimension for the given matrix
|
||||
* expression.
|
||||
* \tparam Dim The dimension number (starting from 1).
|
||||
* \tparam MatrixExprT A matrix expression type.
|
||||
* \param e A matrix expression.
|
||||
* \return The size of the input matrix expression associated to the dimension
|
||||
* \a Dim.
|
||||
*/
|
||||
template <std::size_t Dim, typename MatrixExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename matrix_traits<MatrixExprT>::size_type size(matrix_expression<MatrixExprT> const& me)
|
||||
{
|
||||
return detail::size_by_dim_impl<Dim, matrix_tag>::template apply(me);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return the size of the given dimension tag for the given matrix
|
||||
* expression.
|
||||
* \tparam TagT The dimension tag type (e.g., tag::major).
|
||||
* \tparam MatrixExprT A matrix expression type.
|
||||
* \param e A matrix expression.
|
||||
* \return The size of the input matrix expression associated to the dimension
|
||||
* tag \a TagT.
|
||||
*/
|
||||
template <typename TagT, typename MatrixExprT>
|
||||
BOOST_UBLAS_INLINE
|
||||
typename ::boost::lazy_enable_if_c<
|
||||
detail::has_size_type<MatrixExprT>::value,
|
||||
detail::matrix_size_type<MatrixExprT>
|
||||
>::type size(matrix_expression<MatrixExprT> const& me)
|
||||
{
|
||||
return detail::size_by_tag_impl<TagT, matrix_tag, typename matrix_traits<MatrixExprT>::orientation_category>::template apply(me);
|
||||
}
|
||||
|
||||
}}} // Namespace boost::numeric::ublas
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_UBLAS_OPERATION_SIZE_HPP
|
||||
Reference in New Issue
Block a user