symm_herm_raw.hpp

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2002-2003
00003 //  Toon Knapen, Kresimir Fresl, Joerg Walter
00004 //
00005 // Distributed under the Boost Software License, Version 1.0. 
00006 // (See accompanying file LICENSE_1_0.txt or copy at 
00007 // http://www.boost.org/LICENSE_1_0.txt)
00008 //
00009 
00010 #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_SYMM_HERM_RAW_HPP
00011 #define BOOST_NUMERIC_BINDINGS_TRAITS_SYMM_HERM_RAW_HPP
00012 
00013 #include <boost/numeric/bindings/traits/matrix_raw.hpp> 
00014 #ifndef BOOST_UBLAS_HAVE_BINDINGS
00015 #  include <boost/numeric/ublas/symmetric.hpp> 
00016 #  include <boost/numeric/ublas/hermitian.hpp> 
00017 #endif 
00018 
00019 namespace boost { namespace numeric { namespace bindings { namespace traits {
00020 
00021   namespace ublas = boost::numeric::ublas; 
00022 
00023   template <typename M, typename F>
00024   BOOST_UBLAS_INLINE
00025   int leading_dimension (const ublas::symmetric_adaptor<M, F> &m) {
00026     return bindings::traits::leading_dimension (m.data());
00027   }
00028 
00029   template <typename M, typename F>
00030   BOOST_UBLAS_INLINE
00031   int leading_dimension (const ublas::hermitian_adaptor<M, F> &m) {
00032     return bindings::traits::leading_dimension (m.data());
00033   }
00034 
00035 
00036 
00037   template <typename M, typename F>
00038   BOOST_UBLAS_INLINE
00039   int matrix_storage_size (const ublas::symmetric_adaptor<M, F> &m) {
00040     return matrix_storage_size (m.data()); 
00041   }
00042 
00043   template <typename M, typename F>
00044   BOOST_UBLAS_INLINE
00045   int matrix_storage_size (const ublas::hermitian_adaptor<M, F> &m) {
00046     return matrix_storage_size (m.data()); 
00047   }
00048 
00049   template<typename T, typename F1, typename F2, typename A>
00050   BOOST_UBLAS_INLINE
00051   int matrix_storage_size (const ublas::symmetric_matrix<T,F1,F2,A> &m) {
00052     return (int) ((m.size1() * (m.size1() + 1)) / 2); 
00053   }
00054 
00055   template<typename T, typename F1, typename F2, typename A>
00056   BOOST_UBLAS_INLINE
00057   int matrix_storage_size (const ublas::hermitian_matrix<T,F1,F2,A> &m) {
00058     return (int) ((m.size1() * (m.size1() + 1)) / 2); 
00059   }
00060 
00061 
00062 
00063 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
00064   template<typename T, typename F1, typename F2, typename A>
00065   BOOST_UBLAS_INLINE
00066   typename ublas::symmetric_matrix<T,F1,F2,A>::const_pointer 
00067   matrix_storage (const ublas::symmetric_matrix<T,F1,F2,A> &m) {
00068     return &m.data().begin()[0];
00069   }
00070 #endif
00071   // We need data_const() mostly due to MSVC 6.0.
00072   // But how shall we write portable code otherwise?
00073   template<typename T, typename F1, typename F2, typename A>
00074   BOOST_UBLAS_INLINE
00075   typename ublas::symmetric_matrix<T,F1,F2,A>::const_pointer 
00076   matrix_storage_const (const ublas::symmetric_matrix<T,F1,F2,A> &m) {
00077     return &m.data().begin()[0];
00078   }
00079   template<typename T, typename F1, typename F2, typename A>
00080   BOOST_UBLAS_INLINE
00081   typename ublas::symmetric_matrix<T,F1,F2,A>::pointer 
00082   matrix_storage (ublas::symmetric_matrix<T,F1,F2,A> &m) {
00083     return &m.data().begin()[0];
00084   }
00085 
00086 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
00087   template <typename M, typename F>
00088   BOOST_UBLAS_INLINE
00089   typename M::const_pointer 
00090   matrix_storage (const ublas::symmetric_adaptor<M, F> &m) {
00091     return matrix_storage (m.data()); 
00092   }
00093 #endif
00094   // We need data_const() mostly due to MSVC 6.0.
00095   // But how shall we write portable code otherwise?
00096   template <typename M, typename F>
00097   BOOST_UBLAS_INLINE
00098   typename M::const_pointer 
00099   matrix_storage_const (const ublas::symmetric_adaptor<M, F> &m) {
00100     return matrix_storage_const (m.data()); 
00101   }
00102   template <typename M, typename F>
00103   BOOST_UBLAS_INLINE
00104   typename M::pointer matrix_storage (ublas::symmetric_adaptor<M, F> &m) {
00105     return matrix_storage (m.data()); 
00106   }
00107 
00108 
00109 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
00110   template<typename T, typename F1, typename F2, typename A>
00111   BOOST_UBLAS_INLINE
00112   typename ublas::hermitian_matrix<T,F1,F2,A>::const_pointer 
00113   matrix_storage (const ublas::hermitian_matrix<T,F1,F2,A> &m) {
00114     return &m.data().begin()[0];
00115   }
00116 #endif
00117   // We need data_const() mostly due to MSVC 6.0.
00118   // But how shall we write portable code otherwise?
00119   template<typename T, typename F1, typename F2, typename A>
00120   BOOST_UBLAS_INLINE
00121   typename ublas::hermitian_matrix<T,F1,F2,A>::const_pointer 
00122   matrix_storage_const (const ublas::hermitian_matrix<T,F1,F2,A> &m) {
00123     return &m.data().begin()[0];
00124   }
00125   template<typename T, typename F1, typename F2, typename A>
00126   BOOST_UBLAS_INLINE
00127   typename ublas::hermitian_matrix<T,F1,F2,A>::pointer 
00128   matrix_storage (ublas::hermitian_matrix<T,F1,F2,A> &m) {
00129     return &m.data().begin()[0];
00130   }
00131 
00132 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
00133   template <typename M, typename F>
00134   BOOST_UBLAS_INLINE
00135   typename M::const_pointer 
00136   matrix_storage (const ublas::hermitian_adaptor<M, F> &m) {
00137     return matrix_storage (m.data()); 
00138   }
00139 #endif
00140   // We need data_const() mostly due to MSVC 6.0.
00141   // But how shall we write portable code otherwise?
00142   template <typename M, typename F>
00143   BOOST_UBLAS_INLINE
00144   typename M::const_pointer 
00145   matrix_storage_const (const ublas::hermitian_adaptor<M, F> &m) {
00146     return matrix_storage_const (m.data()); 
00147   }
00148   template <typename M, typename F>
00149   BOOST_UBLAS_INLINE
00150   typename M::pointer matrix_storage (ublas::hermitian_adaptor<M, F> &m) {
00151     return matrix_storage (m.data()); 
00152   }
00153 
00154   namespace detail {
00155 
00156     inline char m_uplo_tag (ublas::upper_tag const&) { return 'U'; } 
00157     inline char m_uplo_tag (ublas::lower_tag const&) { return 'L'; } 
00158 
00159   }
00160 
00161   template <typename SymmM> 
00162   inline 
00163   char matrix_uplo_tag (SymmM&) {
00164       typedef typename SymmM::packed_category uplo_t; 
00165       return detail::m_uplo_tag (uplo_t());
00166   }
00167   
00168 
00169 }}}}
00170 
00171 #endif

Generated on Wed Nov 23 19:00:42 2011 for FreeCAD by  doxygen 1.6.1