Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:43:03

0001 /**
0002  * -*- c++ -*-
0003  *
0004  * \file c_array.hpp
0005  *
0006  * \brief provides specializations of matrix and vector traits for c arrays and c matrices.
0007  *
0008  * Copyright (c) 2009, Gunter Winkler
0009  *
0010  * Distributed under the Boost Software License, Version 1.0. (See
0011  * accompanying file LICENSE_1_0.txt or copy at
0012  * http://www.boost.org/LICENSE_1_0.txt)
0013  *
0014  * \author Gunter Winkler (guwi17 at gmx dot de)
0015  */
0016 
0017 #ifndef BOOST_NUMERIC_UBLAS_TRAITS_C_ARRAY_HPP
0018 #define BOOST_NUMERIC_UBLAS_TRAITS_C_ARRAY_HPP
0019 
0020 
0021 #include <boost/numeric/ublas/traits.hpp>
0022 #include <boost/numeric/ublas/traits/const_iterator_type.hpp>
0023 #include <boost/numeric/ublas/traits/iterator_type.hpp>
0024 
0025 namespace boost { namespace numeric { namespace ublas {
0026 
0027     namespace detail {
0028 
0029     
0030     
0031     }
0032 
0033 
0034     template < class T, int M, int N > 
0035     struct matrix_view_traits < T[M][N] > {
0036         typedef T              matrix_type[M][N];
0037 
0038         typedef std::size_t          size_type;
0039         typedef std::ptrdiff_t       difference_type;
0040 
0041         typedef row_major_tag  orientation_category;
0042         typedef dense_tag      storage_category;
0043   
0044         typedef T            value_type;
0045         typedef const T      &const_reference;
0046         typedef const T      *const_pointer;
0047   
0048         typedef const matrix_reference<const matrix_type>    const_closure_type;
0049 
0050         typedef T row_type[N];
0051 
0052         typedef const row_type *const_iterator1;
0053         typedef const_pointer  const_iterator2;
0054 
0055     };
0056 
0057     template < class T, int M, int N > 
0058     struct mutable_matrix_traits < T[M][N] > {
0059         typedef T            matrix_type[M][N];
0060 
0061         typedef T            *reference;
0062   
0063         typedef matrix_reference<matrix_type>                closure_type;
0064 
0065     };
0066 
0067     template < class T, int N  > 
0068     struct vector_view_traits < T[N] > {
0069         typedef T              vector_type[N];
0070 
0071         typedef std::size_t          size_type;
0072         typedef std::ptrdiff_t       difference_type;
0073 
0074         typedef dense_tag      storage_category;
0075   
0076         typedef T            value_type;
0077         typedef const T      &const_reference;
0078         typedef const T      *const_pointer;
0079   
0080         typedef const vector_reference<const vector_type>    const_closure_type;
0081 
0082         typedef const_pointer const_iterator;
0083 
0084         /// iterator pointing to the first element
0085         static
0086         const_iterator begin(const vector_type & v) {
0087             return & (v[0]);
0088         }
0089         /// iterator pointing behind the last element
0090         static
0091         const_iterator end(const vector_type & v) {
0092             return & (v[N]);
0093         }
0094     };
0095 
0096     template < class T, int N  > 
0097     struct mutable_vector_traits < T[N] >  {
0098   
0099         typedef T &reference;
0100         typedef T *pointer;
0101         typedef vector_reference< T[N] > closure_type;
0102 
0103     };
0104 
0105 
0106 
0107 
0108 }}} // Namespace boost::numeric::ublas
0109 
0110 #endif