Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBcomplex.hxx

Go to the documentation of this file.
00001 #ifndef _CTBcomplex_HXX
00002 #define _CTBcomplex_HXX 1
00003 
00008 /*----------------------------------------------------------------------------*/
00009 /* C Tool Box: Designed and implemented by:                                   */
00010 /*    Walter F.J. Mueller   Gesellschaft fuer Schwerionenforschung (GSI)      */
00011 /*                          Postfach 110552, D-64220 Darmstadt, Germany       */
00012 /*                  Email:  W.F.J.Mueller@gsi.de                              */
00013 /*                  WWW:    http://www-kp3.gsi.de/www/kp3/people/mueller.html */
00014 /*------------------------------------------+---------------------------------*/
00015 
00016 #include "CTBprintfS.hxx"
00017 
00018 template <class T>
00019 class CTBcomplex {
00020   public:
00021                     CTBcomplex(T f_re = 0.0, T f_im = 0.0);
00022 
00023     T&              Re();
00024     const T&        Re() const;
00025 
00026     T&              Im();
00027     const T&        Im() const;
00028 
00029     void            Re(T f_re);
00030     void            Im(T f_im);
00031 
00032     T               Abs() const;
00033     T               Arg() const;
00034 
00035     bool            IsReal() const;
00036     bool            IsImaginary() const;
00037 
00038     CTBcomplex<T>   Conj() const;
00039     CTBcomplex<T>   TimesI() const;
00040 
00041     CTBcomplex<T>   Sqrt() const;
00042     CTBcomplex<T>   Exp() const;
00043     CTBcomplex<T>   Log() const;
00044 
00045     CTBcomplex<T>   Sin() const;
00046     CTBcomplex<T>   Cos() const;
00047     CTBcomplex<T>   Tan() const;
00048     CTBcomplex<T>   Asin() const;
00049     CTBcomplex<T>   Acos() const;
00050     CTBcomplex<T>   Atan() const;
00051 
00052     CTBcomplex<T>   Sinh() const;
00053     CTBcomplex<T>   Cosh() const;
00054     CTBcomplex<T>   Tanh() const;
00055     CTBcomplex<T>   Asinh() const;
00056     CTBcomplex<T>   Acosh() const;
00057     CTBcomplex<T>   Atanh() const;
00058 
00059     CTBcomplex<T>   Pow(int i_y) const;
00060     CTBcomplex<T>   Pow(const CTBcomplex<T>& z_y) const;
00061 
00062     CTBcomplex<T>   Divide(const CTBcomplex<T>& z_den) const;
00063     CTBcomplex<T>   Invert(T f_nom) const;
00064 
00065     void            ToStream(ostream& os) const;
00066     void            FromStream(istream& is);
00067 
00068     CTBcomplex<T>&  operator=(T f_r);
00069 
00070     bool            operator!() const;
00071                     operator void* () const;
00072 
00073     CTBcomplex<T>   operator+() const;
00074     CTBcomplex<T>   operator-() const;
00075 
00076     CTBcomplex<T>&  operator+=(const CTBcomplex<T>& z);
00077     CTBcomplex<T>&  operator+=(T f_r);
00078 
00079     CTBcomplex<T>&  operator-=(const CTBcomplex<T>& z);
00080     CTBcomplex<T>&  operator-=(T f_r);
00081 
00082     CTBcomplex<T>&  operator*=(const CTBcomplex<T>& z);
00083     CTBcomplex<T>&  operator*=(T f_r);
00084 
00085     CTBcomplex<T>&  operator/=(const CTBcomplex<T>& z);
00086     CTBcomplex<T>&  operator/=(T f_r);
00087 
00088   private:
00089 
00090     T               mf_re;
00091     T               mf_im;
00092 };
00093 
00094 typedef CTBcomplex<float>  CTBcomplex_f;    
00095 typedef CTBcomplex<double> CTBcomplex_d;    
00096 
00097 template <class T>
00098     CTBcomplex<T>   operator+(const CTBcomplex<T>& lhs,
00099                               const CTBcomplex<T>& rhs);
00100 template <class T>
00101     CTBcomplex<T>   operator+(const CTBcomplex<T>& lhs, T f_rhs);
00102 template <class T>
00103     CTBcomplex<T>   operator+(T f_lhs, const CTBcomplex<T>& rhs);
00104 
00105 template <class T>
00106     CTBcomplex<T>   operator-(const CTBcomplex<T>& lhs,
00107                               const CTBcomplex<T>& rhs);
00108 template <class T>
00109     CTBcomplex<T>   operator-(const CTBcomplex<T>& lhs, T f_rhs);
00110 template <class T>
00111     CTBcomplex<T>   operator-(T f_lhs, const CTBcomplex<T>& rhs);
00112 
00113 template <class T>
00114     CTBcomplex<T>   operator*(const CTBcomplex<T>& lhs,
00115                               const CTBcomplex<T>& rhs);
00116 template <class T>
00117     CTBcomplex<T>   operator*(const CTBcomplex<T>& lhs, T f_rhs);
00118 template <class T>
00119     CTBcomplex<T>   operator*(T f_lhs, const CTBcomplex<T>& rhs);
00120 
00121 template <class T>
00122     CTBcomplex<T>   operator/(const CTBcomplex<T>& lhs,
00123                               const CTBcomplex<T>& rhs);
00124 template <class T>
00125     CTBcomplex<T>   operator/(const CTBcomplex<T>& lhs, T f_rhs);
00126 template <class T>
00127     CTBcomplex<T>   operator/(T f_lhs, const CTBcomplex<T>& rhs);
00128 
00129 template <class T>
00130     bool            operator==(const CTBcomplex<T>& lhs,
00131                                const CTBcomplex<T>& rhs);
00132 template <class T>
00133     bool            operator==(const CTBcomplex<T>& lhs, T f_rhs);
00134 template <class T>
00135     bool            operator==(T f_lhs, const CTBcomplex<T>& rhs);
00136 
00137 template <class T>
00138     ostream&        operator<<(ostream& os, const CTBcomplex<T>& obj);
00139 template <class T>
00140     istream&        operator>>(istream& is, CTBcomplex<T>& obj);
00141 
00142 template <class T>
00143     T               CTBabs(const CTBcomplex<T>& z);
00144 
00145 template <class T>
00146     T               CTBabsm(const CTBcomplex<T>& z);
00147 
00148 template <class T>
00149     T               CTBabs2(const CTBcomplex<T>& z);
00150 
00151 template <class T>
00152     T               CTBarg(const CTBcomplex<T>& z);
00153 
00154 template <class T>
00155     T               CTBreal(const CTBcomplex<T>& z);
00156 
00157 template <class T>
00158     T               CTBimag(const CTBcomplex<T>& z);
00159 
00160 template <class T>
00161     CTBcomplex<T>   CTBconj(const CTBcomplex<T>& z);
00162 template <class T>
00163     CTBcomplex<T>   CTBtimesI(const CTBcomplex<T>& z);
00164 
00165 template <class T>
00166     CTBcomplex<T>   CTBsqrt(const CTBcomplex<T>& z);
00167 
00168 template <class T>
00169     CTBcomplex<T>   CTBexp(const CTBcomplex<T>& z);
00170 template <class T>
00171     CTBcomplex<T>   CTBlog(const CTBcomplex<T>& z);
00172 
00173 template <class T>
00174     CTBcomplex<T>   CTBsin(const CTBcomplex<T>& z);
00175 template <class T>
00176     CTBcomplex<T>   CTBcos(const CTBcomplex<T>& z);
00177 template <class T>
00178     CTBcomplex<T>   CTBtan(const CTBcomplex<T>& z);
00179 
00180 template <class T>
00181     CTBcomplex<T>   CTBasin(const CTBcomplex<T>& z);
00182 template <class T>
00183     CTBcomplex<T>   CTBacos(const CTBcomplex<T>& z);
00184 template <class T>
00185     CTBcomplex<T>   CTBatan(const CTBcomplex<T>& z);
00186 
00187 template <class T>
00188     CTBcomplex<T>   CTBsinh(const CTBcomplex<T>& z);
00189 template <class T>
00190     CTBcomplex<T>   CTBcosh(const CTBcomplex<T>& z);
00191 template <class T>
00192     CTBcomplex<T>   CTBtanh(const CTBcomplex<T>& z);
00193 
00194 template <class T>
00195     CTBcomplex<T>   CTBasinh(const CTBcomplex<T>& z);
00196 template <class T>
00197     CTBcomplex<T>   CTBacosh(const CTBcomplex<T>& z);
00198 template <class T>
00199     CTBcomplex<T>   CTBatanh(const CTBcomplex<T>& z);
00200 
00201 template <class T>
00202     CTBcomplex<T>   CTBpow(const CTBcomplex<T>& z_x, int i_y);
00203 template <class T>
00204     CTBcomplex<T>   CTBpow(const CTBcomplex<T>& z_x, const CTBcomplex<T>& z_y);
00205 
00206 template <class T>
00207 CTBprintfS<CTBcomplex<T> > CTBprintf(CTBcomplex<T> value, 
00208                                     const char* c_format=0, 
00209                                     int i_width=0, int i_precision=0);
00210 
00211 #include "CTBcomplex.icc"
00212 
00213 #endif

Generated at Fri Oct 24 18:11:27 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001