chainlink_complex.h

Go to the documentation of this file.
00001 /****************************************************************************
00002  This file is part of ChainLink
00003  Copyright (C) 2007 Jeremy Magland (Jeremy.Magland@gmail.com)
00004 
00005  ChainLink 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  ChainLink 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 ChainLink; if not, write to the Free Software
00017  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 *****************************************************************************/
00020 
00021 #ifndef CHAINLINK_COMPLEX_H
00022 #define CHAINLINK_COMPLEX_H
00023 
00024 #include <math.h>
00025 #include <stdlib.h>
00026 #include <stdio.h>
00027 
00030 //comment out one of the following lines
00031 //choose floating point or double precision
00037         typedef float real;
00038         //typedef double real;
00039         
00040 //comment out one of the following lines
00041 //on 64-bit systems choose int
00042         typedef long int32;
00043         //typedef int int32;
00044 
00047 struct complex {
00048         real re,im;
00049 };
00050 
00053 complex cplex(real re,real im);
00054 
00055 //operatations on complex numbers
00057 complex operator*(complex X1, complex X2);
00059 complex operator/(complex X1,complex X2);
00061 complex operator+(complex X1, complex X2);
00063 complex operator-(complex X1,complex X2);
00065 complex operator*(complex X1, real X2);
00067 complex operator/(complex X1,real X2);
00069 complex operator+(complex X1, real X2);
00071 complex operator-(complex X1,real X2);
00073 complex operator/(real X1, complex X2);
00075 bool operator==(complex X1, complex X2);
00077 bool operator==(complex X1, real X2);
00079 bool operator==(real X1,complex X2);
00080 
00082 real abs(complex X);
00083 
00085 complex conj(complex X);
00086 
00088 complex exp(complex X);
00089 
00091 complex log(complex X);
00092 
00095 void get_complex_string(char *ret,complex X);
00096 
00099 complex power(const complex &x, const complex &y);
00100 
00101 #endif
00102 
00103 

Generated on Mon Feb 5 12:16:36 2007 for ChainLinkBase by  doxygen 1.5.1-p1