Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

vnl_complex_traits.h

Go to the documentation of this file.
00001 #ifndef vnl_complex_traits_h_
00002 #define vnl_complex_traits_h_
00003 // This is vxl/vnl/vnl_complex_traits.h
00004 
00005 //: \file
00006 //  \brief To allow templated real or complex algorithms to determine appropriate actions of conjugation, complexification etc.
00007 //  \author F. Schaffalitzky, Oxford RRG, 26 Mar 1999
00008 
00009 
00010 //     
00011 //
00012 // Modifications:
00013 // LSB (Manchester) 26/3/01 Documentation tidied 
00014 //
00015 //-----------------------------------------------------------------------------
00016 
00017 #include <vcl_complex.h>
00018 //: To allow templated real or complex algorithms to determine appropriate
00019 //    actions of conjugation, complexification etc.
00020 // Default is real.
00021 template <class T>
00022 class vnl_complex_traits {
00023 public:
00024   //: Whether complex or not
00025   enum { isreal = true };
00026 
00027   //: Complex conjugation
00028   static T conjugate(T x) { return x; }
00029 
00030   //: Complexification
00031   static vcl_complex<T> complexify(T x) { return vcl_complex<T>(x,T(0)); }
00032 };
00033 
00034 //: override for vcl_complex<REAL> :
00035 
00036 // vcl_complex<float>
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 // vcl_complex<double>
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_

Generated at Wed Mar 12 01:13:15 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000