Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //
0002 //  Copyright (c) 2002-2003
0003 //  Toon Knapen, Kresimir Fresl, Joerg Walter
0004 //
0005 //  Distributed under the Boost Software License, Version 1.0. (See
0006 //  accompanying file LICENSE_1_0.txt or copy at
0007 //  http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 //
0010 
0011 #ifndef _BOOST_UBLAS_RAW_
0012 #define _BOOST_UBLAS_RAW_
0013 
0014 namespace boost { namespace numeric { namespace ublas { namespace raw {
0015 
0016     // We need data_const() mostly due to MSVC 6.0.
0017     // But how shall we write portable code otherwise?
0018 
0019     template < typename V >
0020     BOOST_UBLAS_INLINE
0021     int size( const V &v ) ;
0022 
0023     template < typename V >
0024     BOOST_UBLAS_INLINE
0025     int size( const vector_reference<V> &v ) ;
0026 
0027     template < typename M >
0028     BOOST_UBLAS_INLINE
0029     int size1( const M &m ) ;
0030     template < typename M >
0031     BOOST_UBLAS_INLINE
0032     int size2( const M &m ) ;
0033 
0034     template < typename M >
0035     BOOST_UBLAS_INLINE
0036     int size1( const matrix_reference<M> &m ) ;
0037     template < typename M >
0038     BOOST_UBLAS_INLINE
0039     int size2( const matrix_reference<M> &m ) ;
0040 
0041     template < typename M >
0042     BOOST_UBLAS_INLINE
0043     int leading_dimension( const M &m, row_major_tag ) ;
0044     template < typename M >
0045     BOOST_UBLAS_INLINE
0046     int leading_dimension( const M &m, column_major_tag ) ;
0047     template < typename M >
0048     BOOST_UBLAS_INLINE
0049     int leading_dimension( const M &m ) ;
0050 
0051     template < typename M >
0052     BOOST_UBLAS_INLINE
0053     int leading_dimension( const matrix_reference<M> &m ) ;
0054 
0055     template < typename V >
0056     BOOST_UBLAS_INLINE
0057     int stride( const V &v ) ;
0058 
0059     template < typename V >
0060     BOOST_UBLAS_INLINE
0061     int stride( const vector_range<V> &v ) ;
0062     template < typename V >
0063     BOOST_UBLAS_INLINE
0064     int stride( const vector_slice<V> &v ) ;
0065 
0066     template < typename M >
0067     BOOST_UBLAS_INLINE
0068     int stride( const matrix_row<M> &v ) ;
0069     template < typename M >
0070     BOOST_UBLAS_INLINE
0071     int stride( const matrix_column<M> &v ) ;
0072 
0073     template < typename M >
0074     BOOST_UBLAS_INLINE
0075     int stride1( const M &m ) ;
0076     template < typename M >
0077     BOOST_UBLAS_INLINE
0078     int stride2( const M &m ) ;
0079 
0080     template < typename M >
0081     BOOST_UBLAS_INLINE
0082     int stride1( const matrix_reference<M> &m ) ;
0083     template < typename M >
0084     BOOST_UBLAS_INLINE
0085     int stride2( const matrix_reference<M> &m ) ;
0086 
0087     template < typename T, std::size_t M, std::size_t N >
0088     BOOST_UBLAS_INLINE
0089     int stride1( const c_matrix<T, M, N> &m ) ;
0090     template < typename T, std::size_t M, std::size_t N >
0091     BOOST_UBLAS_INLINE
0092     int stride2( const c_matrix<T, M, N> &m ) ;
0093 
0094     template < typename M >
0095     BOOST_UBLAS_INLINE
0096     int stride1( const matrix_range<M> &m ) ;
0097     template < typename M >
0098     BOOST_UBLAS_INLINE
0099     int stride1( const matrix_slice<M> &m ) ;
0100     template < typename M >
0101     BOOST_UBLAS_INLINE
0102     int stride2( const matrix_range<M> &m ) ;
0103     template < typename M >
0104     BOOST_UBLAS_INLINE
0105     int stride2( const matrix_slice<M> &m ) ;
0106 
0107     template < typename MV >
0108     BOOST_UBLAS_INLINE
0109     typename MV::array_type::array_type::const_pointer data( const MV &mv ) ;
0110     template < typename MV >
0111     BOOST_UBLAS_INLINE
0112     typename MV::array_type::array_type::const_pointer data_const( const MV &mv ) ;
0113     template < typename MV >
0114     BOOST_UBLAS_INLINE
0115     typename MV::array_type::pointer data( MV &mv ) ;
0116 
0117     template < typename V >
0118     BOOST_UBLAS_INLINE
0119     typename V::array_type::array_type::const_pointer data( const vector_reference<V> &v ) ;
0120     template < typename V >
0121     BOOST_UBLAS_INLINE
0122     typename V::array_type::array_type::const_pointer data_const( const vector_reference<V> &v ) ;
0123     template < typename V >
0124     BOOST_UBLAS_INLINE
0125     typename V::array_type::pointer data( vector_reference<V> &v ) ;
0126 
0127     template < typename T, std::size_t N >
0128     BOOST_UBLAS_INLINE
0129     typename c_vector<T, N>::array_type::array_type::const_pointer data( const c_vector<T, N> &v ) ;
0130     template < typename T, std::size_t N >
0131     BOOST_UBLAS_INLINE
0132     typename c_vector<T, N>::array_type::array_type::const_pointer data_const( const c_vector<T, N> &v ) ;
0133     template < typename T, std::size_t N >
0134     BOOST_UBLAS_INLINE
0135     typename c_vector<T, N>::pointer data( c_vector<T, N> &v ) ;
0136 
0137     template < typename V >
0138     BOOST_UBLAS_INLINE
0139     typename V::array_type::array_type::const_pointer data( const vector_range<V> &v ) ;
0140     template < typename V >
0141     BOOST_UBLAS_INLINE
0142     typename V::array_type::array_type::const_pointer data( const vector_slice<V> &v ) ;
0143     template < typename V >
0144     BOOST_UBLAS_INLINE
0145     typename V::array_type::array_type::const_pointer data_const( const vector_range<V> &v ) ;
0146     template < typename V >
0147     BOOST_UBLAS_INLINE
0148     typename V::array_type::array_type::const_pointer data_const( const vector_slice<V> &v ) ;
0149     template < typename V >
0150     BOOST_UBLAS_INLINE
0151     typename V::array_type::pointer data( vector_range<V> &v ) ;
0152     template < typename V >
0153     BOOST_UBLAS_INLINE
0154     typename V::array_type::pointer data( vector_slice<V> &v ) ;
0155 
0156     template < typename M >
0157     BOOST_UBLAS_INLINE
0158     typename M::array_type::array_type::const_pointer data( const matrix_reference<M> &m ) ;
0159     template < typename M >
0160     BOOST_UBLAS_INLINE
0161     typename M::array_type::array_type::const_pointer data_const( const matrix_reference<M> &m ) ;
0162     template < typename M >
0163     BOOST_UBLAS_INLINE
0164     typename M::array_type::pointer data( matrix_reference<M> &m ) ;
0165 
0166     template < typename T, std::size_t M, std::size_t N >
0167     BOOST_UBLAS_INLINE
0168     typename c_matrix<T, M, N>::array_type::array_type::const_pointer data( const c_matrix<T, M, N> &m ) ;
0169     template < typename T, std::size_t M, std::size_t N >
0170     BOOST_UBLAS_INLINE
0171     typename c_matrix<T, M, N>::array_type::array_type::const_pointer data_const( const c_matrix<T, M, N> &m ) ;
0172     template < typename T, std::size_t M, std::size_t N >
0173     BOOST_UBLAS_INLINE
0174     typename c_matrix<T, M, N>::pointer data( c_matrix<T, M, N> &m ) ;
0175 
0176     template < typename M >
0177     BOOST_UBLAS_INLINE
0178     typename M::array_type::array_type::const_pointer data( const matrix_row<M> &v ) ;
0179     template < typename M >
0180     BOOST_UBLAS_INLINE
0181     typename M::array_type::array_type::const_pointer data( const matrix_column<M> &v ) ;
0182     template < typename M >
0183     BOOST_UBLAS_INLINE
0184     typename M::array_type::array_type::const_pointer data_const( const matrix_row<M> &v ) ;
0185     template < typename M >
0186     BOOST_UBLAS_INLINE
0187     typename M::array_type::array_type::const_pointer data_const( const matrix_column<M> &v ) ;
0188     template < typename M >
0189     BOOST_UBLAS_INLINE
0190     typename M::array_type::pointer data( matrix_row<M> &v ) ;
0191     template < typename M >
0192     BOOST_UBLAS_INLINE
0193     typename M::array_type::pointer data( matrix_column<M> &v ) ;
0194 
0195     template < typename M >
0196     BOOST_UBLAS_INLINE
0197     typename M::array_type::array_type::const_pointer data( const matrix_range<M> &m ) ;
0198     template < typename M >
0199     BOOST_UBLAS_INLINE
0200     typename M::array_type::array_type::const_pointer data( const matrix_slice<M> &m ) ;
0201     template < typename M >
0202     BOOST_UBLAS_INLINE
0203     typename M::array_type::array_type::const_pointer data_const( const matrix_range<M> &m ) ;
0204     template < typename M >
0205     BOOST_UBLAS_INLINE
0206     typename M::array_type::array_type::const_pointer data_const( const matrix_slice<M> &m ) ;
0207     template < typename M >
0208     BOOST_UBLAS_INLINE
0209     typename M::array_type::pointer data( matrix_range<M> &m ) ;
0210     template < typename M >
0211     BOOST_UBLAS_INLINE
0212     typename M::array_type::pointer data( matrix_slice<M> &m ) ;
0213 
0214     template < typename MV >
0215     BOOST_UBLAS_INLINE
0216     typename MV::array_type::array_type::const_pointer base( const MV &mv ) ;
0217 
0218     template < typename MV >
0219     BOOST_UBLAS_INLINE
0220     typename MV::array_type::array_type::const_pointer base_const( const MV &mv ) ;
0221     template < typename MV >
0222     BOOST_UBLAS_INLINE
0223     typename MV::array_type::pointer base( MV &mv ) ;
0224 
0225     template < typename V >
0226     BOOST_UBLAS_INLINE
0227     typename V::array_type::array_type::const_pointer base( const vector_reference<V> &v ) ;
0228     template < typename V >
0229     BOOST_UBLAS_INLINE
0230     typename V::array_type::array_type::const_pointer base_const( const vector_reference<V> &v ) ;
0231     template < typename V >
0232     BOOST_UBLAS_INLINE
0233     typename V::array_type::pointer base( vector_reference<V> &v ) ;
0234 
0235     template < typename T, std::size_t N >
0236     BOOST_UBLAS_INLINE
0237     typename c_vector<T, N>::array_type::array_type::const_pointer base( const c_vector<T, N> &v ) ;
0238     template < typename T, std::size_t N >
0239     BOOST_UBLAS_INLINE
0240     typename c_vector<T, N>::array_type::array_type::const_pointer base_const( const c_vector<T, N> &v ) ;
0241     template < typename T, std::size_t N >
0242     BOOST_UBLAS_INLINE
0243     typename c_vector<T, N>::pointer base( c_vector<T, N> &v ) ;
0244 
0245     template < typename V >
0246     BOOST_UBLAS_INLINE
0247     typename V::array_type::array_type::const_pointer base( const vector_range<V> &v ) ;
0248     template < typename V >
0249     BOOST_UBLAS_INLINE
0250     typename V::array_type::array_type::const_pointer base( const vector_slice<V> &v ) ;
0251     template < typename V >
0252     BOOST_UBLAS_INLINE
0253     typename V::array_type::array_type::const_pointer base_const( const vector_range<V> &v ) ;
0254     template < typename V >
0255     BOOST_UBLAS_INLINE
0256     typename V::array_type::array_type::const_pointer base_const( const vector_slice<V> &v ) ;
0257     template < typename V >
0258     BOOST_UBLAS_INLINE
0259     typename V::array_type::pointer base( vector_range<V> &v ) ;
0260     template < typename V >
0261     BOOST_UBLAS_INLINE
0262     typename V::array_type::pointer base( vector_slice<V> &v ) ;
0263 
0264     template < typename M >
0265     BOOST_UBLAS_INLINE
0266     typename M::array_type::array_type::const_pointer base( const matrix_reference<M> &m ) ;
0267     template < typename M >
0268     BOOST_UBLAS_INLINE
0269     typename M::array_type::array_type::const_pointer base_const( const matrix_reference<M> &m ) ;
0270     template < typename M >
0271     BOOST_UBLAS_INLINE
0272     typename M::array_type::pointer base( matrix_reference<M> &m ) ;
0273 
0274     template < typename T, std::size_t M, std::size_t N >
0275     BOOST_UBLAS_INLINE
0276     typename c_matrix<T, M, N>::array_type::array_type::const_pointer base( const c_matrix<T, M, N> &m ) ;
0277     template < typename T, std::size_t M, std::size_t N >
0278     BOOST_UBLAS_INLINE
0279     typename c_matrix<T, M, N>::array_type::array_type::const_pointer base_const( const c_matrix<T, M, N> &m ) ;
0280     template < typename T, std::size_t M, std::size_t N >
0281     BOOST_UBLAS_INLINE
0282     typename c_matrix<T, M, N>::pointer base( c_matrix<T, M, N> &m ) ;
0283 
0284     template < typename M >
0285     BOOST_UBLAS_INLINE
0286     typename M::array_type::array_type::const_pointer base( const matrix_row<M> &v ) ;
0287     template < typename M >
0288     BOOST_UBLAS_INLINE
0289     typename M::array_type::array_type::const_pointer base( const matrix_column<M> &v ) ;
0290     template < typename M >
0291     BOOST_UBLAS_INLINE
0292     typename M::array_type::array_type::const_pointer base_const( const matrix_row<M> &v ) ;
0293     template < typename M >
0294     BOOST_UBLAS_INLINE
0295     typename M::array_type::array_type::const_pointer base_const( const matrix_column<M> &v ) ;
0296     template < typename M >
0297     BOOST_UBLAS_INLINE
0298     typename M::array_type::pointer base( matrix_row<M> &v ) ;
0299     template < typename M >
0300     BOOST_UBLAS_INLINE
0301     typename M::array_type::pointer base( matrix_column<M> &v ) ;
0302 
0303     template < typename M >
0304     BOOST_UBLAS_INLINE
0305     typename M::array_type::array_type::const_pointer base( const matrix_range<M> &m ) ;
0306     template < typename M >
0307     BOOST_UBLAS_INLINE
0308     typename M::array_type::array_type::const_pointer base( const matrix_slice<M> &m ) ;
0309     template < typename M >
0310     BOOST_UBLAS_INLINE
0311     typename M::array_type::array_type::const_pointer base_const( const matrix_range<M> &m ) ;
0312     template < typename M >
0313     BOOST_UBLAS_INLINE
0314     typename M::array_type::array_type::const_pointer base_const( const matrix_slice<M> &m ) ;
0315     template < typename M >
0316     BOOST_UBLAS_INLINE
0317     typename M::array_type::pointer base( matrix_range<M> &m ) ;
0318     template < typename M >
0319     BOOST_UBLAS_INLINE
0320     typename M::array_type::pointer base( matrix_slice<M> &m ) ;
0321 
0322     template < typename MV >
0323     BOOST_UBLAS_INLINE
0324     typename MV::size_type start( const MV &mv ) ;
0325 
0326     template < typename V >
0327     BOOST_UBLAS_INLINE
0328     typename V::size_type start( const vector_range<V> &v ) ;
0329     template < typename V >
0330     BOOST_UBLAS_INLINE
0331     typename V::size_type start( const vector_slice<V> &v ) ;
0332 
0333     template < typename M >
0334     BOOST_UBLAS_INLINE
0335     typename M::size_type start( const matrix_row<M> &v ) ;
0336     template < typename M >
0337     BOOST_UBLAS_INLINE
0338     typename M::size_type start( const matrix_column<M> &v ) ;
0339 
0340     template < typename M >
0341     BOOST_UBLAS_INLINE
0342     typename M::size_type start( const matrix_range<M> &m ) ;
0343     template < typename M >
0344     BOOST_UBLAS_INLINE
0345     typename M::size_type start( const matrix_slice<M> &m ) ;
0346 
0347 
0348 
0349     template < typename V >
0350     BOOST_UBLAS_INLINE
0351     int size( const V &v ) {
0352         return v.size() ;
0353     }
0354 
0355     template < typename V >
0356     BOOST_UBLAS_INLINE
0357     int size( const vector_reference<V> &v ) {
0358         return size( v ) ;
0359     }
0360 
0361     template < typename M >
0362     BOOST_UBLAS_INLINE
0363     int size1( const M &m ) {
0364         return m.size1() ;
0365     }
0366     template < typename M >
0367     BOOST_UBLAS_INLINE
0368     int size2( const M &m ) {
0369         return m.size2() ;
0370     }
0371 
0372     template < typename M >
0373     BOOST_UBLAS_INLINE
0374     int size1( const matrix_reference<M> &m ) {
0375         return size1( m.expression() ) ;
0376     }
0377     template < typename M >
0378     BOOST_UBLAS_INLINE
0379     int size2( const matrix_reference<M> &m ) {
0380         return size2( m.expression() ) ;
0381     }
0382 
0383     template < typename M >
0384     BOOST_UBLAS_INLINE
0385     int leading_dimension( const M &m, row_major_tag ) {
0386         return m.size2() ;
0387     }
0388     template < typename M >
0389     BOOST_UBLAS_INLINE
0390     int leading_dimension( const M &m, column_major_tag ) {
0391         return m.size1() ;
0392     }
0393     template < typename M >
0394     BOOST_UBLAS_INLINE
0395     int leading_dimension( const M &m ) {
0396         return leading_dimension( m, typename M::orientation_category() ) ;
0397     }
0398 
0399     template < typename M >
0400     BOOST_UBLAS_INLINE
0401     int leading_dimension( const matrix_reference<M> &m ) {
0402         return leading_dimension( m.expression() ) ;
0403     }
0404 
0405     template < typename V >
0406     BOOST_UBLAS_INLINE
0407     int stride( const V &v ) {
0408         return 1 ;
0409     }
0410 
0411     template < typename V >
0412     BOOST_UBLAS_INLINE
0413     int stride( const vector_range<V> &v ) {
0414         return stride( v.data() ) ;
0415     }
0416     template < typename V >
0417     BOOST_UBLAS_INLINE
0418     int stride( const vector_slice<V> &v ) {
0419         return v.stride() * stride( v.data() ) ;
0420     }
0421 
0422     template < typename M >
0423     BOOST_UBLAS_INLINE
0424     int stride( const matrix_row<M> &v ) {
0425         return stride2( v.data() ) ;
0426     }
0427     template < typename M >
0428     BOOST_UBLAS_INLINE
0429     int stride( const matrix_column<M> &v ) {
0430         return stride1( v.data() ) ;
0431     }
0432 
0433     template < typename M >
0434     BOOST_UBLAS_INLINE
0435     int stride1( const M &m ) {
0436         typedef typename M::functor_type functor_type;
0437         return functor_type::one1( m.size1(), m.size2() ) ;
0438     }
0439     template < typename M >
0440     BOOST_UBLAS_INLINE
0441     int stride2( const M &m ) {
0442         typedef typename M::functor_type functor_type;
0443         return functor_type::one2( m.size1(), m.size2() ) ;
0444     }
0445 
0446     template < typename M >
0447     BOOST_UBLAS_INLINE
0448     int stride1( const matrix_reference<M> &m ) {
0449         return stride1( m.expression() ) ;
0450     }
0451     template < typename M >
0452     BOOST_UBLAS_INLINE
0453     int stride2( const matrix_reference<M> &m ) {
0454         return stride2( m.expression() ) ;
0455     }
0456 
0457     template < typename T, std::size_t M, std::size_t N >
0458     BOOST_UBLAS_INLINE
0459     int stride1( const c_matrix<T, M, N> &m ) {
0460         return N ;
0461     }
0462     template < typename T, std::size_t M, std::size_t N >
0463     BOOST_UBLAS_INLINE
0464     int stride2( const c_matrix<T, M, N> &m ) {
0465         return 1 ;
0466     }
0467 
0468     template < typename M >
0469     BOOST_UBLAS_INLINE
0470     int stride1( const matrix_range<M> &m ) {
0471         return stride1( m.data() ) ;
0472     }
0473     template < typename M >
0474     BOOST_UBLAS_INLINE
0475     int stride1( const matrix_slice<M> &m ) {
0476         return m.stride1() * stride1( m.data() ) ;
0477     }
0478     template < typename M >
0479     BOOST_UBLAS_INLINE
0480     int stride2( const matrix_range<M> &m ) {
0481         return stride2( m.data() ) ;
0482     }
0483     template < typename M >
0484     BOOST_UBLAS_INLINE
0485     int stride2( const matrix_slice<M> &m ) {
0486         return m.stride2() * stride2( m.data() ) ;
0487     }
0488 
0489     template < typename MV >
0490     BOOST_UBLAS_INLINE
0491     typename MV::array_type::array_type::array_type::const_pointer data( const MV &mv ) {
0492         return &mv.data().begin()[0] ;
0493     }
0494     template < typename MV >
0495     BOOST_UBLAS_INLINE
0496     typename MV::array_type::array_type::const_pointer data_const( const MV &mv ) {
0497         return &mv.data().begin()[0] ;
0498     }
0499     template < typename MV >
0500     BOOST_UBLAS_INLINE
0501     typename MV::array_type::pointer data( MV &mv ) {
0502         return &mv.data().begin()[0] ;
0503     }
0504 
0505 
0506     template < typename V >
0507     BOOST_UBLAS_INLINE
0508     typename V::array_type::array_type::const_pointer data( const vector_reference<V> &v ) {
0509         return data( v.expression () ) ;
0510     }
0511     template < typename V >
0512     BOOST_UBLAS_INLINE
0513     typename V::array_type::array_type::const_pointer data_const( const vector_reference<V> &v ) {
0514         return data_const( v.expression () ) ;
0515     }
0516     template < typename V >
0517     BOOST_UBLAS_INLINE
0518     typename V::array_type::pointer data( vector_reference<V> &v ) {
0519         return data( v.expression () ) ;
0520     }
0521 
0522     template < typename T, std::size_t N >
0523     BOOST_UBLAS_INLINE
0524     typename c_vector<T, N>::array_type::array_type::const_pointer data( const c_vector<T, N> &v ) {
0525         return v.data() ;
0526     }
0527     template < typename T, std::size_t N >
0528     BOOST_UBLAS_INLINE
0529     typename c_vector<T, N>::array_type::array_type::const_pointer data_const( const c_vector<T, N> &v ) {
0530         return v.data() ;
0531     }
0532     template < typename T, std::size_t N >
0533     BOOST_UBLAS_INLINE
0534     typename c_vector<T, N>::pointer data( c_vector<T, N> &v ) {
0535         return v.data() ;
0536     }
0537 
0538     template < typename V >
0539     BOOST_UBLAS_INLINE
0540     typename V::array_type::array_type::const_pointer data( const vector_range<V> &v ) {
0541         return data( v.data() ) + v.start() * stride (v.data() ) ;
0542     }
0543     template < typename V >
0544     BOOST_UBLAS_INLINE
0545     typename V::array_type::array_type::const_pointer data( const vector_slice<V> &v ) {
0546         return data( v.data() ) + v.start() * stride (v.data() ) ;
0547     }
0548     template < typename V >
0549     BOOST_UBLAS_INLINE
0550     typename V::array_type::array_type::const_pointer data_const( const vector_range<V> &v ) {
0551         return data_const( v.data() ) + v.start() * stride (v.data() ) ;
0552     }
0553     template < typename V >
0554     BOOST_UBLAS_INLINE
0555     typename V::array_type::const_pointer data_const( const vector_slice<V> &v ) {
0556         return data_const( v.data() ) + v.start() * stride (v.data() ) ;
0557     }
0558     template < typename V >
0559     BOOST_UBLAS_INLINE
0560     typename V::array_type::pointer data( vector_range<V> &v ) {
0561         return data( v.data() ) + v.start() * stride (v.data() ) ;
0562     }
0563     template < typename V >
0564     BOOST_UBLAS_INLINE
0565     typename V::array_type::pointer data( vector_slice<V> &v ) {
0566         return data( v.data() ) + v.start() * stride (v.data() ) ;
0567     }
0568 
0569     template < typename M >
0570     BOOST_UBLAS_INLINE
0571     typename M::array_type::const_pointer data( const matrix_reference<M> &m ) {
0572         return data( m.expression () ) ;
0573     }
0574     template < typename M >
0575     BOOST_UBLAS_INLINE
0576     typename M::array_type::const_pointer data_const( const matrix_reference<M> &m ) {
0577         return data_const( m.expression () ) ;
0578     }
0579     template < typename M >
0580     BOOST_UBLAS_INLINE
0581     typename M::array_type::pointer data( matrix_reference<M> &m ) {
0582         return data( m.expression () ) ;
0583     }
0584 
0585     template < typename T, std::size_t M, std::size_t N >
0586     BOOST_UBLAS_INLINE
0587     typename c_matrix<T, M, N>::array_type::const_pointer data( const c_matrix<T, M, N> &m ) {
0588         return m.data() ;
0589     }
0590     template < typename T, std::size_t M, std::size_t N >
0591     BOOST_UBLAS_INLINE
0592     typename c_matrix<T, M, N>::array_type::const_pointer data_const( const c_matrix<T, M, N> &m ) {
0593         return m.data() ;
0594     }
0595     template < typename T, std::size_t M, std::size_t N >
0596     BOOST_UBLAS_INLINE
0597     typename c_matrix<T, M, N>::pointer data( c_matrix<T, M, N> &m ) {
0598         return m.data() ;
0599     }
0600 
0601     template < typename M >
0602     BOOST_UBLAS_INLINE
0603     typename M::array_type::const_pointer data( const matrix_row<M> &v ) {
0604         return data( v.data() ) + v.index() * stride1( v.data() ) ;
0605     }
0606     template < typename M >
0607     BOOST_UBLAS_INLINE
0608     typename M::array_type::const_pointer data( const matrix_column<M> &v ) {
0609         return data( v.data() ) + v.index() * stride2( v.data() ) ;
0610     }
0611     template < typename M >
0612     BOOST_UBLAS_INLINE
0613     typename M::array_type::const_pointer data_const( const matrix_row<M> &v ) {
0614         return data_const( v.data() ) + v.index() * stride1( v.data() ) ;
0615     }
0616     template < typename M >
0617     BOOST_UBLAS_INLINE
0618     typename M::array_type::const_pointer data_const( const matrix_column<M> &v ) {
0619         return data_const( v.data() ) + v.index() * stride2( v.data() ) ;
0620     }
0621     template < typename M >
0622     BOOST_UBLAS_INLINE
0623     typename M::array_type::pointer data( matrix_row<M> &v ) {
0624         return data( v.data() ) + v.index() * stride1( v.data() ) ;
0625     }
0626     template < typename M >
0627     BOOST_UBLAS_INLINE
0628     typename M::array_type::pointer data( matrix_column<M> &v ) {
0629         return data( v.data() ) + v.index() * stride2( v.data() ) ;
0630     }
0631 
0632     template < typename M >
0633     BOOST_UBLAS_INLINE
0634     typename M::array_type::const_pointer data( const matrix_range<M> &m ) {
0635         return data( m.data() ) + m.start1() * stride1( m.data () ) + m.start2() * stride2( m.data () ) ;
0636     }
0637     template < typename M >
0638     BOOST_UBLAS_INLINE
0639     typename M::array_type::const_pointer data( const matrix_slice<M> &m ) {
0640         return data( m.data() ) + m.start1() * stride1( m.data () ) + m.start2() * stride2( m.data () ) ;
0641     }
0642     template < typename M >
0643     BOOST_UBLAS_INLINE
0644     typename M::array_type::const_pointer data_const( const matrix_range<M> &m ) {
0645         return data_const( m.data() ) + m.start1() * stride1( m.data () ) + m.start2() * stride2( m.data () ) ;
0646     }
0647     template < typename M >
0648     BOOST_UBLAS_INLINE
0649     typename M::array_type::const_pointer data_const( const matrix_slice<M> &m ) {
0650         return data_const( m.data() ) + m.start1() * stride1( m.data () ) + m.start2() * stride2( m.data () ) ;
0651     }
0652     template < typename M >
0653     BOOST_UBLAS_INLINE
0654     typename M::array_type::pointer data( matrix_range<M> &m ) {
0655         return data( m.data() ) + m.start1() * stride1( m.data () ) + m.start2() * stride2( m.data () ) ;
0656     }
0657     template < typename M >
0658     BOOST_UBLAS_INLINE
0659     typename M::array_type::pointer data( matrix_slice<M> &m ) {
0660         return data( m.data() ) + m.start1() * stride1( m.data () ) + m.start2() * stride2( m.data () ) ;
0661     }
0662 
0663 
0664     template < typename MV >
0665     BOOST_UBLAS_INLINE
0666     typename MV::array_type::const_pointer base( const MV &mv ) {
0667         return &mv.data().begin()[0] ;
0668     }
0669     template < typename MV >
0670     BOOST_UBLAS_INLINE
0671     typename MV::array_type::const_pointer base_const( const MV &mv ) {
0672         return &mv.data().begin()[0] ;
0673     }
0674     template < typename MV >
0675     BOOST_UBLAS_INLINE
0676     typename MV::array_type::pointer base( MV &mv ) {
0677         return &mv.data().begin()[0] ;
0678     }
0679 
0680     template < typename V >
0681     BOOST_UBLAS_INLINE
0682     typename V::array_type::const_pointer base( const vector_reference<V> &v ) {
0683         return base( v.expression () ) ;
0684     }
0685     template < typename V >
0686     BOOST_UBLAS_INLINE
0687     typename V::array_type::const_pointer base_const( const vector_reference<V> &v ) {
0688         return base_const( v.expression () ) ;
0689     }
0690     template < typename V >
0691     BOOST_UBLAS_INLINE
0692     typename V::array_type::pointer base( vector_reference<V> &v ) {
0693         return base( v.expression () ) ;
0694     }
0695 
0696     template < typename T, std::size_t N >
0697     BOOST_UBLAS_INLINE
0698     typename c_vector<T, N>::array_type::const_pointer base( const c_vector<T, N> &v ) {
0699         return v.data() ;
0700     }
0701     template < typename T, std::size_t N >
0702     BOOST_UBLAS_INLINE
0703     typename c_vector<T, N>::array_type::const_pointer base_const( const c_vector<T, N> &v ) {
0704         return v.data() ;
0705     }
0706     template < typename T, std::size_t N >
0707     BOOST_UBLAS_INLINE
0708     typename c_vector<T, N>::pointer base( c_vector<T, N> &v ) {
0709         return v.data() ;
0710     }
0711 
0712     template < typename V >
0713     BOOST_UBLAS_INLINE
0714     typename V::array_type::const_pointer base( const vector_range<V> &v ) {
0715         return base( v.data() ) ;
0716     }
0717     template < typename V >
0718     BOOST_UBLAS_INLINE
0719     typename V::array_type::const_pointer base( const vector_slice<V> &v ) {
0720         return base( v.data() ) ;
0721     }
0722     template < typename V >
0723     BOOST_UBLAS_INLINE
0724     typename V::array_type::const_pointer base_const( const vector_range<V> &v ) {
0725         return base_const( v.data() ) ;
0726     }
0727     template < typename V >
0728     BOOST_UBLAS_INLINE
0729     typename V::array_type::const_pointer base_const( const vector_slice<V> &v ) {
0730         return base_const( v.data() ) ;
0731     }
0732     template < typename V >
0733     BOOST_UBLAS_INLINE
0734     typename V::array_type::pointer base( vector_range<V> &v ) {
0735         return base( v.data() ) ;
0736     }
0737     template < typename V >
0738     BOOST_UBLAS_INLINE
0739     typename V::array_type::pointer base( vector_slice<V> &v ) {
0740         return base( v.data() ) ;
0741     }
0742 
0743     template < typename M >
0744     BOOST_UBLAS_INLINE
0745     typename M::array_type::const_pointer base( const matrix_reference<M> &m ) {
0746         return base( m.expression () ) ;
0747     }
0748     template < typename M >
0749     BOOST_UBLAS_INLINE
0750     typename M::array_type::const_pointer base_const( const matrix_reference<M> &m ) {
0751         return base_const( m.expression () ) ;
0752     }
0753     template < typename M >
0754     BOOST_UBLAS_INLINE
0755     typename M::array_type::pointer base( matrix_reference<M> &m ) {
0756         return base( m.expression () ) ;
0757     }
0758 
0759     template < typename T, std::size_t M, std::size_t N >
0760     BOOST_UBLAS_INLINE
0761     typename c_matrix<T, M, N>::array_type::const_pointer base( const c_matrix<T, M, N> &m ) {
0762         return m.data() ;
0763     }
0764     template < typename T, std::size_t M, std::size_t N >
0765     BOOST_UBLAS_INLINE
0766     typename c_matrix<T, M, N>::array_type::const_pointer base_const( const c_matrix<T, M, N> &m ) {
0767         return m.data() ;
0768     }
0769     template < typename T, std::size_t M, std::size_t N >
0770     BOOST_UBLAS_INLINE
0771     typename c_matrix<T, M, N>::pointer base( c_matrix<T, M, N> &m ) {
0772         return m.data() ;
0773     }
0774 
0775     template < typename M >
0776     BOOST_UBLAS_INLINE
0777     typename M::array_type::const_pointer base( const matrix_row<M> &v ) {
0778         return base( v.data() ) ;
0779     }
0780     template < typename M >
0781     BOOST_UBLAS_INLINE
0782     typename M::array_type::const_pointer base( const matrix_column<M> &v ) {
0783         return base( v.data() ) ;
0784     }
0785     template < typename M >
0786     BOOST_UBLAS_INLINE
0787     typename M::array_type::const_pointer base_const( const matrix_row<M> &v ) {
0788         return base_const( v.data() ) ;
0789     }
0790     template < typename M >
0791     BOOST_UBLAS_INLINE
0792     typename M::array_type::const_pointer base_const( const matrix_column<M> &v ) {
0793         return base_const( v.data() ) ;
0794     }
0795     template < typename M >
0796     BOOST_UBLAS_INLINE
0797     typename M::array_type::pointer base( matrix_row<M> &v ) {
0798         return base( v.data() ) ;
0799     }
0800     template < typename M >
0801     BOOST_UBLAS_INLINE
0802     typename M::array_type::pointer base( matrix_column<M> &v ) {
0803         return base( v.data() ) ;
0804     }
0805 
0806     template < typename M >
0807     BOOST_UBLAS_INLINE
0808     typename M::array_type::const_pointer base( const matrix_range<M> &m ) {
0809         return base( m.data() ) ;
0810     }
0811     template < typename M >
0812     BOOST_UBLAS_INLINE
0813     typename M::array_type::const_pointer base( const matrix_slice<M> &m ) {
0814         return base( m.data() ) ;
0815     }
0816     template < typename M >
0817     BOOST_UBLAS_INLINE
0818     typename M::array_type::const_pointer base_const( const matrix_range<M> &m ) {
0819         return base_const( m.data() ) ;
0820     }
0821     template < typename M >
0822     BOOST_UBLAS_INLINE
0823     typename M::array_type::const_pointer base_const( const matrix_slice<M> &m ) {
0824         return base_const( m.data() ) ;
0825     }
0826     template < typename M >
0827     BOOST_UBLAS_INLINE
0828     typename M::array_type::pointer base( matrix_range<M> &m ) {
0829         return base( m.data() ) ;
0830     }
0831     template < typename M >
0832     BOOST_UBLAS_INLINE
0833     typename M::array_type::pointer base( matrix_slice<M> &m ) {
0834         return base( m.data() ) ;
0835     }
0836 
0837     template < typename MV >
0838     BOOST_UBLAS_INLINE
0839     typename MV::size_type start( const MV &mv ) {
0840         return 0 ;
0841     }
0842 
0843     template < typename V >
0844     BOOST_UBLAS_INLINE
0845     typename V::size_type start( const vector_range<V> &v ) {
0846         return v.start() * stride (v.data() ) ;
0847     }
0848     template < typename V >
0849     BOOST_UBLAS_INLINE
0850     typename V::size_type start( const vector_slice<V> &v ) {
0851         return v.start() * stride (v.data() ) ;
0852     }
0853 
0854     template < typename M >
0855     BOOST_UBLAS_INLINE
0856     typename M::size_type start( const matrix_row<M> &v ) {
0857         return v.index() * stride1( v.data() ) ;
0858     }
0859     template < typename M >
0860     BOOST_UBLAS_INLINE
0861     typename M::size_type start( const matrix_column<M> &v ) {
0862         return v.index() * stride2( v.data() ) ;
0863     }
0864 
0865     template < typename M >
0866     BOOST_UBLAS_INLINE
0867     typename M::size_type start( const matrix_range<M> &m ) {
0868         return m.start1() * stride1( m.data () ) + m.start2() * stride2( m.data () ) ;
0869     }
0870     template < typename M >
0871     BOOST_UBLAS_INLINE
0872     typename M::size_type start( const matrix_slice<M> &m ) {
0873         return m.start1() * stride1( m.data () ) + m.start2() * stride2( m.data () ) ;
0874     }
0875 
0876 }}}}
0877 
0878 #endif