00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef TJCOMPLEX_H
00020 #define TJCOMPLEX_H
00021
00022
00023 #include <tjutils/tjutils.h>
00024 #include <tjutils/tjstring.h>
00025
00026
00035 STD_string ctos(const STD_complex& z);
00036
00040 STD_complex stoc(const STD_string& s);
00041
00042
00044
00045
00046 inline STD_complex float2real(float a) {return STD_complex(a,0.0f);}
00047 inline STD_complex float2imag(float b) {return STD_complex(0.0f,b);}
00048 inline float creal(STD_complex c) {return c.real();}
00049 inline float cimag(STD_complex c) {return c.imag();}
00050 inline float cabs(STD_complex c) {return float(sqrt(c.real()*c.real()+c.imag()*c.imag()));}
00051 inline float phase(STD_complex c) {return STD_arg(c);}
00052 inline STD_complex logc(STD_complex c) {return STD_log(c);}
00053 inline STD_complex expc(STD_complex c) {return STD_exp(c);}
00054 inline STD_complex conjc(STD_complex c) {return STD_conj(c);}
00055
00056
00057
00061 inline bool operator < (const STD_complex& c1, const STD_complex& c2) {return STD_abs(c1)<STD_abs(c2);}
00062
00066 inline bool operator > (const STD_complex& c1, const STD_complex& c2) {return STD_abs(c1)>STD_abs(c2);}
00067
00068
00069
00072 #endif
00073
00074