00001 /* 00002 * 00003 * Copyright (c) Kresimir Fresl 2002 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 * Author acknowledges the support of the Faculty of Civil Engineering, 00010 * University of Zagreb, Croatia. 00011 * 00012 */ 00013 00014 #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_SYMM_HERM_TRAITS_HPP 00015 #define BOOST_NUMERIC_BINDINGS_TRAITS_SYMM_HERM_TRAITS_HPP 00016 00017 #include <boost/numeric/bindings/traits/type.hpp> 00018 #include <boost/numeric/bindings/traits/traits.hpp> 00019 #include <boost/static_assert.hpp> 00020 00021 #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 00022 00023 namespace boost { namespace numeric { namespace bindings { namespace traits { 00024 00025 namespace detail { 00026 00027 // select symmetric or hermitian matrix structure 00028 00029 template <typename T> 00030 struct symm_herm_t {}; 00031 template<> 00032 struct symm_herm_t<float> { 00033 typedef symmetric_t type; 00034 }; 00035 template<> 00036 struct symm_herm_t<double> { 00037 typedef symmetric_t type; 00038 }; 00039 template<> 00040 struct symm_herm_t<complex_f> { 00041 typedef hermitian_t type; 00042 }; 00043 template<> 00044 struct symm_herm_t<complex_d> { 00045 typedef hermitian_t type; 00046 }; 00047 00048 template <typename T> 00049 struct symm_herm_pack_t {}; 00050 template<> 00051 struct symm_herm_pack_t<float> { 00052 typedef symmetric_packed_t type; 00053 }; 00054 template<> 00055 struct symm_herm_pack_t<double> { 00056 typedef symmetric_packed_t type; 00057 }; 00058 template<> 00059 struct symm_herm_pack_t<complex_f> { 00060 typedef hermitian_packed_t type; 00061 }; 00062 template<> 00063 struct symm_herm_pack_t<complex_d> { 00064 typedef hermitian_packed_t type; 00065 }; 00066 00067 00068 template <class T, class S> 00069 struct symm_herm_compatible { 00070 BOOST_STATIC_CONSTANT( bool, value=false ) ; 00071 }; 00072 00073 template <class T> 00074 struct symm_herm_compatible< T, hermitian_t > { 00075 BOOST_STATIC_CONSTANT( bool, value=true ) ; 00076 }; 00077 00078 template <class T> 00079 struct symm_herm_compatible< T, symmetric_t > { 00080 BOOST_STATIC_CONSTANT( bool, value=true ) ; 00081 }; 00082 00083 template <class T> 00084 struct symm_herm_compatible< std::complex<T>, symmetric_t > { 00085 BOOST_STATIC_CONSTANT( bool, value=false ) ; 00086 }; 00087 00088 } 00089 00090 }}}} 00091 00092 #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 00093 00094 #endif // BOOST_NUMERIC_BINDINGS_TRAITS_SYMM_HERM_TRAITS_HPP