ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
traits.hpp
Go to the documentation of this file.
1 #ifndef __MAQUIS_TYPES_TRAITS_HPP__
2 #define __MAQUIS_TYPES_TRAITS_HPP__
3 
4 #include <alps/numeric/matrix/matrix_traits.hpp>
5 
6 namespace maquis { namespace traits {
7 
8  template<class T> struct scalar_type { typedef typename T::value_type type; };
9  template<class T> struct real_type { typedef typename real_type<typename T::value_type>::type type; };
10  template<> struct real_type<double> { typedef double type; };
11  template<class T> struct real_type<std::complex<T> > { typedef T type; };
12  template<class T> struct real_identity { static const T value; };
13  template<class T> struct imag_identity { static const T value; };
14  template<class T> struct real_identity<std::complex<T> > { static const std::complex<T> value; };
15  template<class T> struct imag_identity<std::complex<T> > { static const std::complex<T> value; };
16  template<class T> const T real_identity<T>::value = 1;
17  template<class T> const T imag_identity<T>::value = 1;
18  template<class T> const std::complex<T> real_identity<std::complex<T> >::value = std::complex<T>(1,0);
19  template<class T> const std::complex<T> imag_identity<std::complex<T> >::value = std::complex<T>(0,1);
20 
21  template <class Matrix> struct transpose_view { typedef Matrix type; };
22 
23 } }
24 
25 #endif
T::value_type type
Definition: traits.hpp:8
static const std::complex< T > value
Definition: traits.hpp:14
real_type< typename T::value_type >::type type
Definition: traits.hpp:9
static const std::complex< T > value
Definition: traits.hpp:15