00001 /*-*-c++-*-**************************************************************** 00002 * lacomplex.h Helper file for complex numbers 00003 ------------------- 00004 begin : 2004-01-14 00005 copyright : (C) 2004 by Christian Stimming 00006 email : stimming@tuhh.de 00007 ***************************************************************************/ 00008 00009 // This library is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License as published by the Free Software Foundation; either 00012 // version 2, or (at your option) any later version. 00013 00014 // This library is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU Lesser General Public License for more details. 00018 00019 // You should have received a copy of the GNU Lesser General 00020 // Public License along with this library; see the file COPYING. 00021 // If not, write to the Free Software Foundation, 59 Temple Place 00022 // - Suite 330, Boston, MA 02111-1307, USA. 00023 00024 #ifndef _LACOMPLEX_H 00025 #define _LACOMPLEX_H 00026 00044 // Include the version number defines 00045 #include <laversion.h> 00046 00047 // Include the FORTRAN definitions from LAPACK++ 00048 #include <f2c.h> 00049 00050 00051 // //////////////////////////////////////////////////////////// 00052 00055 #ifdef LA_COMPLEX_SUPPORT 00056 00062 typedef doublecomplex COMPLEX; 00063 00064 // As opposed to the FORTRAN "COMPLEX", include now the 00065 // std::complex<double> type. 00066 #include <complex> 00067 // And finally include the la::complex<double> which is a copy of 00068 // std::complex<double> with additional type conversions. 00069 #include <lacomplex> 00070 00084 typedef la::complex<double> LaComplex; 00085 00088 inline std::ostream& 00089 operator<<(std::ostream& __os, const COMPLEX& __x) 00090 { 00091 return __os << LaComplex(__x); 00092 } 00093 00095 inline bool operator==(const COMPLEX& _a, const COMPLEX& _b) 00096 { 00097 return _a.r == _b.r && _a.i == _b.i; 00098 } 00100 inline bool operator!=(const COMPLEX& _a, const COMPLEX& _b) 00101 { 00102 return _a.r != _b.r || _a.i != _b.i; 00103 } 00104 00105 #endif /* LA_COMPLEX_SUPPORT */ 00106 00107 // //////////////////////////////////////////////////////////// 00108 00109 #endif // _LACOMPLEX_H