Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00016
00017
00018
00021
00022 template<typename T1, typename T2>
00023 struct upgrade_val
00024 {
00025 typedef typename promote_type<T1,T2>::result T1_result;
00026 typedef typename promote_type<T1,T2>::result T2_result;
00027
00028 arma_inline
00029 static
00030 typename promote_type<T1,T2>::result
00031 apply(const T1 x)
00032 {
00033 typedef typename promote_type<T1,T2>::result out_type;
00034 return out_type(x);
00035 }
00036
00037 arma_inline
00038 static
00039 typename promote_type<T1,T2>::result
00040 apply(const T2 x)
00041 {
00042 typedef typename promote_type<T1,T2>::result out_type;
00043 return out_type(x);
00044 }
00045
00046 };
00047
00048
00049
00050 template<typename T>
00051 struct upgrade_val<T,T>
00052 {
00053 typedef T T1_result;
00054 typedef T T2_result;
00055
00056 arma_inline static const T& apply(const T& x) { return x; }
00057 };
00058
00059
00062
00063 template<typename T, typename T2>
00064 struct upgrade_val< std::complex<T>, T2 >
00065 {
00066 typedef std::complex<T> T1_result;
00067 typedef T T2_result;
00068
00069 arma_inline static const std::complex<T>& apply(const std::complex<T>& x) { return x; }
00070 arma_inline static T apply(const T2 x) { return T(x); }
00071 };
00072
00073
00074
00075 template<typename T1, typename T>
00076 struct upgrade_val< T1, std::complex<T> >
00077 {
00078 typedef T T1_result;
00079 typedef std::complex<T> T2_result;
00080
00081 arma_inline static T apply(const T1 x) { return T(x); }
00082 arma_inline static const std::complex<T>& apply(const std::complex<T>& x) { return x; }
00083 };
00084
00085
00087 template<>
00088 struct upgrade_val< std::complex<float>, double >
00089 {
00090 typedef std::complex<double> T1_result;
00091 typedef double T2_result;
00092
00093 arma_inline static const std::complex<double> apply(const std::complex<float>& x) { return std::complex<double>(x); }
00094 arma_inline static double apply(const double x) { return x; }
00095 };
00096
00097
00098 template<>
00099 struct upgrade_val< double, std::complex<float> >
00100 {
00101 typedef double T1_result;
00102 typedef std::complex<float> T2_result;
00103
00104 arma_inline static double apply(const double x) { return x; }
00105 arma_inline static const std::complex<double> apply(const std::complex<float>& x) { return std::complex<double>(x); }
00106 };
00107
00108
00110 template<>
00111 struct upgrade_val< std::complex<float>, std::complex<double> >
00112 {
00113 typedef std::complex<double> T1_result;
00114 typedef std::complex<double> T2_result;
00115
00116 arma_inline static const std::complex<double> apply(const std::complex<float>& x) { return std::complex<double>(x); }
00117 arma_inline static const std::complex<double>& apply(const std::complex<double>& x) { return x; }
00118 };
00119
00120
00121 template<>
00122 struct upgrade_val< std::complex<double>, std::complex<float> >
00123 {
00124 typedef std::complex<double> T1_result;
00125 typedef std::complex<double> T2_result;
00126
00127 arma_inline static const std::complex<double>& apply(const std::complex<double>& x) { return x; }
00128 arma_inline static const std::complex<double> apply(const std::complex<float>& x) { return std::complex<double>(x); }
00129 };
00130
00131
00133 template<>
00134 struct upgrade_val< std::complex<double>, float >
00135 {
00136 typedef std::complex<double> T1_result;
00137 typedef double T2_result;
00138
00139 arma_inline static const std::complex<double>& apply(const std::complex<double>& x) { return x; }
00140 arma_inline static double apply(const float x) { return double(x); }
00141 };
00142
00143
00144 template<>
00145 struct upgrade_val< float, std::complex<double> >
00146 {
00147 typedef double T1_result;
00148 typedef std::complex<double> T2_result;
00149
00150 arma_inline static double apply(const float x) { return double(x); }
00151 arma_inline static const std::complex<double>& apply(const std::complex<double>& x) { return x; }
00152 };
00153
00154
00155