00001 #ifndef vnl_complex_traits_h_
00002 #define vnl_complex_traits_h_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <vcl_complex.h>
00018
00019
00020
00021 template <class T>
00022 class vnl_complex_traits {
00023 public:
00024
00025 enum { isreal = true };
00026
00027
00028 static T conjugate(T x) { return x; }
00029
00030
00031 static vcl_complex<T> complexify(T x) { return vcl_complex<T>(x,T(0)); }
00032 };
00033
00034
00035
00036
00037 VCL_DEFINE_SPECIALIZATION
00038 class vnl_complex_traits< vcl_complex<float> > {
00039 public:
00040 enum { isreal = false };
00041 static vcl_complex<float> conjugate(vcl_complex<float> z)
00042 { return vcl_complex<float>(z.real(), -z.imag()); }
00043 static vcl_complex<float> complexify(vcl_complex<float> z)
00044 { return z; }
00045 };
00046
00047
00048 VCL_DEFINE_SPECIALIZATION
00049 class vnl_complex_traits< vcl_complex<double> > {
00050 public:
00051 enum { isreal = false };
00052 static vcl_complex<double> conjugate(vcl_complex<double> z)
00053 { return vcl_complex<double>(z.real(), -z.imag()); }
00054 static vcl_complex<double> complexify(vcl_complex<double> z)
00055 { return z; }
00056 };
00057
00058 #endif // vnl_complex_traits_h_