00001
00002
00003
00004
00005
00006
00007
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
00072
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
00095
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
00118
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
00141
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