24 #if ! defined (octave_oct_cmplx_h) 25 #define octave_oct_cmplx_h 1 27 #include "octave-config.h" 46 #if ! defined (__APPLE__) 49 # define DEF_COMPLEXR_COMP(OP, OPS) \ 50 template <typename T> \ 51 inline bool operator OP (const std::complex<T>& a, \ 52 const std::complex<T>& b) \ 54 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ 55 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ 58 OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \ 59 OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \ 60 if (ay == static_cast<T> (-M_PI)) \ 62 if (by != static_cast<T> (-M_PI)) \ 63 return static_cast<T> (M_PI) OP by; \ 65 else if (by == static_cast<T> (-M_PI)) \ 67 return ay OP static_cast<T> (M_PI); \ 74 template <typename T> \ 75 inline bool operator OP (const std::complex<T>& a, T b) \ 77 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ 78 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ 81 OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \ 82 if (ay == static_cast<T> (-M_PI)) \ 83 return static_cast<T> (M_PI) OP 0; \ 89 template <typename T> \ 90 inline bool operator OP (T a, const std::complex<T>& b) \ 92 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ 93 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ 96 OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \ 97 if (by == static_cast<T> (-M_PI)) \ 98 return 0 OP static_cast<T> (M_PI); \ 117 # define A_PI 3.1415925025939941f 119 # define DEF_COMPLEXR_COMP(OP, OPS) \ 120 template <typename T> \ 121 inline bool operator OP (const std::complex<T>& a, \ 122 const std::complex<T>& b) \ 124 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ 125 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ 128 OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \ 129 OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \ 130 if (ay == static_cast<T> (-M_PI)) \ 132 if (by != static_cast<T> (-M_PI)) \ 133 return static_cast<T> (M_PI) OP by; \ 135 else if (by == static_cast<T> (-M_PI)) \ 137 return ay OP static_cast<T> (M_PI); \ 144 template <typename T> \ 145 inline bool operator OP (const std::complex<T>& a, T b) \ 147 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ 148 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ 151 OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \ 152 if (ay == static_cast<T> (-M_PI)) \ 153 return static_cast<T> (M_PI) OP 0; \ 159 template <typename T> \ 160 inline bool operator OP (T a, const std::complex<T>& b) \ 162 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \ 163 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \ 166 OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \ 167 if (by == static_cast<T> (-M_PI)) \ 168 return 0 OP static_cast<T> (M_PI); \ 175 inline bool operator OP<float> (const std::complex<float>& a, \ 176 const std::complex<float>& b) \ 178 OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \ 179 OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \ 182 OCTAVE_FLOAT_TRUNCATE const float ay = std::arg (a); \ 183 OCTAVE_FLOAT_TRUNCATE const float by = std::arg (b); \ 187 return static_cast<float> (M_PI) OP by; \ 189 else if (by == -A_PI) \ 191 return ay OP static_cast<float> (M_PI); \ 199 inline bool operator OP<float> (const std::complex<float>& a, float b) \ 201 OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \ 202 OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \ 205 OCTAVE_FLOAT_TRUNCATE const float ay = std::arg (a); \ 207 return static_cast<float> (M_PI) OP 0; \ 214 inline bool operator OP<float> (float a, const std::complex<float>& b) \ 216 OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \ 217 OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \ 220 OCTAVE_FLOAT_TRUNCATE const float by = std::arg (b); \ 222 return 0 OP static_cast<float> (M_PI); \ #define DEF_COMPLEXR_COMP(OP, OPS)
std::complex< float > FloatComplex
std::complex< double > Complex