You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
108 lines
2.7 KiB
108 lines
2.7 KiB
#ifndef COMPLEX_H
|
|
#define COMPLEX_H
|
|
#include "dgtd-performance.hpp"
|
|
using namespace std;
|
|
|
|
#include <complex>
|
|
#define Complex complex<fp_t>
|
|
|
|
#define ZERO 1.0e-20
|
|
|
|
inline
|
|
complex<double> operator+(const complex<double> &a, const float &b)
|
|
{ return a + (double)b; }
|
|
|
|
inline
|
|
complex<double> operator+(const float &a, const complex<double> &b)
|
|
{ return (double)a + b; }
|
|
|
|
inline
|
|
complex<float> operator+(const complex<float> &a, const double &b)
|
|
{ return a + (float)b; }
|
|
|
|
inline
|
|
complex<float> operator+(const double &a, const complex<float> &b)
|
|
{ return (float)a + b; }
|
|
|
|
inline
|
|
complex<double> operator-(const complex<double> &a, const float &b)
|
|
{ return a - (double)b; }
|
|
|
|
inline
|
|
complex<double> operator-(const float &a, const complex<double> &b)
|
|
{ return (double)a - b; }
|
|
|
|
inline
|
|
complex<float> operator-(const complex<float> &a, const double &b)
|
|
{ return a - (float)b; }
|
|
|
|
inline
|
|
complex<float> operator-(const double &a, const complex<float> &b)
|
|
{ return (float)a - b; }
|
|
|
|
inline
|
|
complex<double> operator*(const complex<double> &a, const float &b)
|
|
{ return a * (double)b; }
|
|
|
|
inline
|
|
complex<double> operator*(const float &a, const complex<double> &b)
|
|
{ return (double)a * b; }
|
|
|
|
inline
|
|
complex<float> operator*(const complex<float> &a, const double &b)
|
|
{ return a * (float)b; }
|
|
|
|
inline
|
|
complex<float> operator*(const double &a, const complex<float> &b)
|
|
{ return (float)a * b; }
|
|
|
|
inline
|
|
complex<double> operator/(const complex<double> &a, const float &b)
|
|
{ return a / (double)b; }
|
|
|
|
inline
|
|
complex<double> operator/(const float &a, const complex<double> &b)
|
|
{ return (double)a / b; }
|
|
|
|
inline
|
|
complex<float> operator/(const complex<float> &a, const double &b)
|
|
{ return a / (float)b; }
|
|
|
|
inline
|
|
complex<float> operator/(const double &a, const complex<float> &b)
|
|
{ return (float)a / b; }
|
|
|
|
inline
|
|
complex<double> operator+(const complex<double> &a, const complex<float> &b)
|
|
{ return a + complex<double>(b); }
|
|
|
|
inline
|
|
complex<double> operator+(const complex<float> &a, const complex<double> &b)
|
|
{ return complex<double>(a) + b; }
|
|
|
|
inline
|
|
complex<double> operator-(const complex<double> &a, const complex<float> &b)
|
|
{ return a - complex<double>(b); }
|
|
|
|
inline
|
|
complex<double> operator-(const complex<float> &a, const complex<double> &b)
|
|
{ return complex<double>(a) + b; }
|
|
|
|
inline
|
|
complex<double> operator*(const complex<double> &a, const complex<float> &b)
|
|
{ return a * complex<double>(b); }
|
|
|
|
inline
|
|
complex<double> operator*(const complex<float> &a, const complex<double> &b)
|
|
{ return complex<double>(a) * b; }
|
|
|
|
inline
|
|
complex<double> operator/(const complex<double> &a, const complex<float> &b)
|
|
{ return a / complex<double>(b); }
|
|
|
|
inline
|
|
complex<double> operator/(const complex<float> &a, const complex<double> &b)
|
|
{ return complex<double>(a) / b; }
|
|
|
|
#endif
|
|
|
|
|