Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
/**
* -*- c++ -*-
*
* \file c_array.hpp
*
* \brief provides specializations of matrix and vector traits 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_TRAITS_C_ARRAY_HPP
#define BOOST_NUMERIC_UBLAS_TRAITS_C_ARRAY_HPP
#include <boost/numeric/ublas/traits.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 {
}
template < class T, int M, int N >
struct matrix_view_traits < T[M][N] > {
typedef T matrix_type[M][N];
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef row_major_tag orientation_category;
typedef dense_tag storage_category;
typedef T value_type;
typedef const T &const_reference;
typedef const T *const_pointer;
typedef const matrix_reference<const matrix_type> const_closure_type;
typedef T row_type[N];
typedef const row_type *const_iterator1;
typedef const_pointer const_iterator2;
};
template < class T, int M, int N >
struct mutable_matrix_traits < T[M][N] > {
typedef T matrix_type[M][N];
typedef T *reference;
typedef matrix_reference<matrix_type> closure_type;
};
template < class T, int N >
struct vector_view_traits < T[N] > {
typedef T vector_type[N];
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef dense_tag storage_category;
typedef T value_type;
typedef const T &const_reference;
typedef const T *const_pointer;
typedef const vector_reference<const vector_type> const_closure_type;
typedef const_pointer const_iterator;
/// iterator pointing to the first element
static
const_iterator begin(const vector_type & v) {
return & (v[0]);
}
/// iterator pointing behind the last element
static
const_iterator end(const vector_type & v) {
return & (v[N]);
}
};
template < class T, int N >
struct mutable_vector_traits < T[N] > {
typedef T &reference;
typedef T *pointer;
typedef vector_reference< T[N] > closure_type;
};
}}} // Namespace boost::numeric::ublas
#endif

View File

@@ -0,0 +1,127 @@
/**
* -*- c++ -*-
*
* \file const_iterator_type.hpp
*
* \brief Const iterator to a given container type.
*
* 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_TRAITS_CONST_ITERATOR_TYPE_HPP
#define BOOST_NUMERIC_UBLAS_TRAITS_CONST_ITERATOR_TYPE_HPP
#include <boost/numeric/ublas/fwd.hpp>
#include <boost/numeric/ublas/tags.hpp>
#include <boost/numeric/ublas/traits.hpp>
namespace boost { namespace numeric { namespace ublas {
namespace detail {
/**
* \brief Auxiliary class for retrieving the const iterator to the given
* matrix expression according its orientation and to the given dimension tag.
* \tparam MatrixT A model of MatrixExpression.
* \tparam TagT A dimension tag type (e.g., tag::major).
* \tparam OrientationT An orientation category type (e.g., row_major_tag).
*/
template <typename MatrixT, typename TagT, typename OrientationT>
struct const_iterator_type_impl;
/// \brief Specialization of \c const_iterator_type_impl for row-major oriented
/// matrices and over the major dimension.
template <typename MatrixT>
struct const_iterator_type_impl<MatrixT,tag::major,row_major_tag>
{
typedef typename matrix_view_traits<MatrixT>::const_iterator1 type;
};
/// \brief Specialization of \c const_iterator_type_impl for column-major
/// oriented matrices and over the major dimension.
template <typename MatrixT>
struct const_iterator_type_impl<MatrixT,tag::major,column_major_tag>
{
typedef typename matrix_view_traits<MatrixT>::const_iterator2 type;
};
/// \brief Specialization of \c const_iterator_type_impl for row-major oriented
/// matrices and over the minor dimension.
template <typename MatrixT>
struct const_iterator_type_impl<MatrixT,tag::minor,row_major_tag>
{
typedef typename matrix_view_traits<MatrixT>::const_iterator2 type;
};
/// \brief Specialization of \c const_iterator_type_impl for column-major
/// oriented matrices and over the minor dimension.
template <typename MatrixT>
struct const_iterator_type_impl<MatrixT,tag::minor,column_major_tag>
{
typedef typename matrix_view_traits<MatrixT>::const_iterator1 type;
};
} // Namespace detail
/**
* \brief A const iterator for the given container type over the given
* dimension.
* \tparam ContainerT A container expression type.
* \tparam TagT A dimension tag type (e.g., tag::major).
*/
template <typename ContainerT, typename TagT=void>
struct const_iterator_type;
/**
* \brief Specialization of \c const_iterator_type for vector expressions.
* \tparam VectorT A model of VectorExpression type.
*/
template <typename VectorT>
struct const_iterator_type<VectorT, void>
{
typedef typename vector_view_traits<VectorT>::const_iterator type;
};
/**
* \brief Specialization of \c const_iterator_type for matrix expressions and
* over the major dimension.
* \tparam MatrixT A model of MatrixExpression type.
*/
template <typename MatrixT>
struct const_iterator_type<MatrixT,tag::major>
{
typedef typename detail::const_iterator_type_impl<MatrixT,tag::minor,typename matrix_view_traits<MatrixT>::orientation_category>::type type;
};
/**
* \brief Specialization of \c const_iterator_type for matrix expressions and
* over the minor dimension.
* \tparam MatrixT A model of MatrixExpression type.
*/
template <typename MatrixT>
struct const_iterator_type<MatrixT,tag::minor>
{
typedef typename detail::const_iterator_type_impl<MatrixT,tag::minor,typename matrix_view_traits<MatrixT>::orientation_category>::type type;
};
}}} // Namespace boost::numeric::ublas
#endif // BOOST_NUMERIC_UBLAS_TRAITS_CONST_ITERATOR_TYPE_HPP

View File

@@ -0,0 +1,126 @@
/**
* -*- c++ -*-
*
* \file iterator_type.hpp
*
* \brief Iterator to a given container type.
*
* 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_TRAITS_ITERATOR_TYPE_HPP
#define BOOST_NUMERIC_UBLAS_TRAITS_ITERATOR_TYPE_HPP
#include <boost/numeric/ublas/fwd.hpp>
#include <boost/numeric/ublas/traits.hpp>
#include <boost/numeric/ublas/tags.hpp>
namespace boost { namespace numeric { namespace ublas {
namespace detail {
/**
* \brief Auxiliary class for retrieving the iterator to the given
* matrix expression according its orientation and to the given dimension tag.
* \tparam MatrixT A model of MatrixExpression.
* \tparam TagT A dimension tag type (e.g., tag::major).
* \tparam OrientationT An orientation category type (e.g., row_major_tag).
*/
template <typename MatrixT, typename TagT, typename OrientationT>
struct iterator_type_impl;
/// \brief Specialization of \c iterator_type_impl for row-major oriented
/// matrices and over the major dimension.
template <typename MatrixT>
struct iterator_type_impl<MatrixT,tag::major,row_major_tag>
{
typedef typename matrix_traits<MatrixT>::iterator1 type;
};
/// \brief Specialization of \c iterator_type_impl for column-major oriented
/// matrices and over the major dimension.
template <typename MatrixT>
struct iterator_type_impl<MatrixT,tag::major,column_major_tag>
{
typedef typename matrix_traits<MatrixT>::iterator2 type;
};
/// \brief Specialization of \c iterator_type_impl for row-major oriented
/// matrices and over the minor dimension.
template <typename MatrixT>
struct iterator_type_impl<MatrixT,tag::minor,row_major_tag>
{
typedef typename matrix_traits<MatrixT>::iterator2 type;
};
/// \brief Specialization of \c iterator_type_impl for column-major oriented
/// matrices and over the minor dimension.
template <typename MatrixT>
struct iterator_type_impl<MatrixT,tag::minor,column_major_tag>
{
typedef typename matrix_traits<MatrixT>::iterator1 type;
};
} // Namespace detail
/**
* \brief A iterator for the given container type over the given dimension.
* \tparam ContainerT A container expression type.
* \tparam TagT A dimension tag type (e.g., tag::major).
*/
template <typename ContainerT, typename TagT=void>
struct iterator_type;
/**
* \brief Specialization of \c iterator_type for vector expressions.
* \tparam VectorT A model of VectorExpression type.
*/
template <typename VectorT>
struct iterator_type<VectorT, void>
{
typedef typename vector_traits<VectorT>::iterator type;
};
/**
* \brief Specialization of \c iterator_type for matrix expressions and
* over the major dimension.
* \tparam MatrixT A model of MatrixExpression type.
*/
template <typename MatrixT>
struct iterator_type<MatrixT,tag::major>
{
typedef typename detail::iterator_type_impl<MatrixT,tag::major,typename matrix_traits<MatrixT>::orientation_category>::type type;
};
/**
* \brief Specialization of \c iterator_type for matrix expressions and
* over the minor dimension.
* \tparam MatrixT A model of MatrixExpression type.
*/
template <typename MatrixT>
struct iterator_type<MatrixT,tag::minor>
{
typedef typename detail::iterator_type_impl<MatrixT,tag::minor,typename matrix_traits<MatrixT>::orientation_category>::type type;
};
}}} // Namespace boost::numeric::ublas
#endif // BOOST_NUMERIC_UBLAS_TRAITS_ITERATOR_TYPE_HPP