00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef EIGEN_NUMTRAITS_H
00026 #define EIGEN_NUMTRAITS_H
00027
00049 template<typename T> struct NumTraits;
00050
00051 template<> struct NumTraits<int>
00052 {
00053 typedef int Real;
00054 typedef double FloatingPoint;
00055 enum {
00056 IsComplex = 0,
00057 HasFloatingPoint = 0,
00058 ReadCost = 1,
00059 AddCost = 1,
00060 MulCost = 1
00061 };
00062 };
00063
00064 template<> struct NumTraits<float>
00065 {
00066 typedef float Real;
00067 typedef float FloatingPoint;
00068 enum {
00069 IsComplex = 0,
00070 HasFloatingPoint = 1,
00071 ReadCost = 1,
00072 AddCost = 1,
00073 MulCost = 1
00074 };
00075 };
00076
00077 template<> struct NumTraits<double>
00078 {
00079 typedef double Real;
00080 typedef double FloatingPoint;
00081 enum {
00082 IsComplex = 0,
00083 HasFloatingPoint = 1,
00084 ReadCost = 1,
00085 AddCost = 1,
00086 MulCost = 1
00087 };
00088 };
00089
00090 template<typename _Real> struct NumTraits<std::complex<_Real> >
00091 {
00092 typedef _Real Real;
00093 typedef std::complex<_Real> FloatingPoint;
00094 enum {
00095 IsComplex = 1,
00096 HasFloatingPoint = NumTraits<Real>::HasFloatingPoint,
00097 ReadCost = 2 * NumTraits<_Real>::ReadCost,
00098 AddCost = 2 * NumTraits<Real>::AddCost,
00099 MulCost = 4 * NumTraits<Real>::MulCost + 2 * NumTraits<Real>::AddCost
00100 };
00101 };
00102
00103 template<> struct NumTraits<long long int>
00104 {
00105 typedef long long int Real;
00106 typedef long double FloatingPoint;
00107 enum {
00108 IsComplex = 0,
00109 HasFloatingPoint = 0,
00110 ReadCost = 1,
00111 AddCost = 1,
00112 MulCost = 1
00113 };
00114 };
00115
00116 template<> struct NumTraits<long double>
00117 {
00118 typedef long double Real;
00119 typedef long double FloatingPoint;
00120 enum {
00121 IsComplex = 0,
00122 HasFloatingPoint = 1,
00123 ReadCost = 1,
00124 AddCost = 1,
00125 MulCost = 1
00126 };
00127 };
00128
00129 template<> struct NumTraits<bool>
00130 {
00131 typedef bool Real;
00132 typedef float FloatingPoint;
00133 enum {
00134 IsComplex = 0,
00135 HasFloatingPoint = 0,
00136 ReadCost = 1,
00137 AddCost = 1,
00138 MulCost = 1
00139 };
00140 };
00141
00142 #endif // EIGEN_NUMTRAITS_H