00001 /*************************************************************************** 00002 * Copyright (C) 2006 by Nestor Aguirre * 00003 * nfaguirrec@unal.edu.co * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef GPPCOMPLEX_H 00021 #define GPPCOMPLEX_H 00022 00023 /*********************************** 00024 * gsl Library 00025 */ 00026 #include <gsl/gsl_complex.h> 00027 #include <gsl/gsl_complex_math.h> 00028 00029 //********************************** 00030 00031 /*********************************** 00032 * Project 00033 */ 00034 #include "SawObject.h" 00035 00036 //********************************** 00037 00048 class SawComplex : public SawObject 00049 { 00050 public: 00051 enum{ 00052 CARTESIAN_REPRESENTATION, 00053 POLAR_REPRESENTATION 00054 } ; 00055 00056 SawComplex() ; 00057 SawComplex( double a, double b, int representation = CARTESIAN_REPRESENTATION ) ; 00058 SawComplex( const SawComplex& complex ) ; 00059 SawComplex( double d ) ; 00060 SawComplex& operator = ( double d ) ; 00061 SawComplex& operator = ( const SawComplex& complex ) ; 00062 ~SawComplex() ; 00063 00064 double getReal() const ; 00065 double getImg() const ; 00066 void setReal( double real ) ; 00067 void setImg( double img ) ; 00068 00069 gsl_complex getGSLComplex() const ; 00070 void setGSLComplex( gsl_complex complex ) ; 00071 00072 double getArg() const ; 00073 SawComplex getConjugate() const ; 00074 SawComplex getInverse() const ; 00075 00076 SawComplex operator + ( SawComplex complex ) ; 00077 SawComplex operator - ( SawComplex complex ) ; 00078 SawComplex operator * ( SawComplex complex ) ; 00079 SawComplex operator / ( SawComplex complex ) ; 00080 00081 friend ostream& operator << ( ostream& os, const SawComplex& e ) ; 00082 friend istream& operator >> ( istream& is, SawComplex& e ) ; 00083 00084 static SawComplex sqrt( SawComplex complex ) ; 00085 static SawComplex pow( SawComplex complex, SawComplex a ) ; 00086 static SawComplex pow( SawComplex complex, double a ) ; 00087 static SawComplex exp( SawComplex complex ) ; 00088 static SawComplex log( SawComplex complex ) ; 00089 static SawComplex log10( SawComplex complex ) ; 00090 00091 static SawComplex sin( SawComplex complex ) ; 00092 static SawComplex cos( SawComplex complex ) ; 00093 static SawComplex tan( SawComplex complex ) ; 00094 static SawComplex sec( SawComplex complex ) ; 00095 static SawComplex csc( SawComplex complex ) ; 00096 static SawComplex cot( SawComplex complex ) ; 00097 00098 static SawComplex asin( SawComplex complex ) ; 00099 static SawComplex acos( SawComplex complex ) ; 00100 static SawComplex atan( SawComplex complex ) ; 00101 static SawComplex asec( SawComplex complex ) ; 00102 static SawComplex acsc( SawComplex complex ) ; 00103 static SawComplex acot( SawComplex complex ) ; 00104 00105 static SawComplex sinh( SawComplex complex ) ; 00106 static SawComplex cosh( SawComplex complex ) ; 00107 static SawComplex tanh( SawComplex complex ) ; 00108 static SawComplex sech( SawComplex complex ) ; 00109 static SawComplex csch( SawComplex complex ) ; 00110 static SawComplex coth( SawComplex complex ) ; 00111 00112 static SawComplex asinh( SawComplex complex ) ; 00113 static SawComplex acosh( SawComplex complex ) ; 00114 static SawComplex atanh( SawComplex complex ) ; 00115 static SawComplex asech( SawComplex complex ) ; 00116 static SawComplex acsch( SawComplex complex ) ; 00117 static SawComplex acoth( SawComplex complex ) ; 00118 00119 private: 00120 gsl_complex complex ; 00121 }; 00122 00123 #endif