$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

plbComplex.h

Go to the documentation of this file.
00001 /* This file is part of the Palabos library.
00002  *
00003  * Copyright (C) 2011 FlowKit Sarl
00004  * Avenue de Chailly 23
00005  * 1012 Lausanne, Switzerland
00006  * E-mail contact: contact@flowkit.com
00007  *
00008  * The most recent release of Palabos can be downloaded at 
00009  * <http://www.palabos.org/>
00010  *
00011  * The library Palabos is free software: you can redistribute it and/or
00012  * modify it under the terms of the GNU Affero General Public License as
00013  * published by the Free Software Foundation, either version 3 of the
00014  * License, or (at your option) any later version.
00015  *
00016  * The library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Affero General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Affero General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 #ifndef PLB_COMPLEX_H
00026 #define PLB_COMPLEX_H
00027 
00028 namespace plb {
00029 
00030 template<typename T>
00031 class Complex {
00032 public:
00033     Complex();
00034     Complex(T Re_);
00035     Complex(T Re_, T Imag_);
00036     template<typename U> operator U() const;
00037     T real() const;
00038     T imaginary() const;
00039     T modulus() const;
00040     T sqrModulus() const;
00041     Complex<T> conjugate() const;
00042     T argument() const;
00043     Complex<T> intpow(int n) const;
00044     Complex<T>& operator+=(Complex<T> const& rhs);
00045     template<typename U> Complex<T>& operator+=(U rhs);
00046     Complex<T>& operator-=(Complex<T> const& rhs);
00047     template<typename U> Complex<T>& operator-=(U rhs);
00048     Complex<T> operator-() const;
00049     Complex<T>& operator*=(Complex<T> const& rhs);
00050     template<typename U> Complex<T>& operator*=(U rhs);
00051     Complex<T>& operator/=(Complex<T> const& rhs);
00052     template<typename U> Complex<T>& operator/=(U rhs);
00053 private:
00054     T Re, Imag;
00055     static T pi;
00056 };
00057 
00058 template<typename T>
00059 Complex<T> operator+(Complex<T> const& arg1, Complex<T> const& arg2);
00060 
00061 template<typename T, typename U>
00062 Complex<T> operator+(Complex<T> const& arg1, U arg2);
00063 
00064 template<typename T, typename U>
00065 Complex<U> operator+(T arg1, Complex<U> const& arg2);
00066 
00067 
00068 template<typename T>
00069 Complex<T> operator-(Complex<T> const& arg1, Complex<T> const& arg2);
00070 
00071 template<typename T, typename U>
00072 Complex<T> operator-(Complex<T> const& arg1, U arg2);
00073 
00074 template<typename T, typename U>
00075 Complex<U> operator-(T arg1, Complex<U> const& arg2);
00076 
00077 
00078 template<typename T>
00079 Complex<T> operator*(Complex<T> const& arg1, Complex<T> const& arg2);
00080 
00081 template<typename T, typename U>
00082 Complex<T> operator*(Complex<T> const& arg1, U arg2);
00083 
00084 template<typename T, typename U>
00085 Complex<U> operator*(T arg1, Complex<U> const& arg2);
00086 
00087 
00088 template<typename T>
00089 Complex<T> operator/(Complex<T> const& arg1, Complex<T> const& arg2);
00090 
00091 template<typename T, typename U>
00092 Complex<T> operator/(Complex<T> const& arg1, U arg2);
00093 
00094 template<typename T, typename U>
00095 Complex<U> operator/(T arg1, Complex<U> const& arg2);
00096 
00097 }  // namespace plb
00098 
00099 #endif  // PLB_COMPLEX_H