11 #ifndef TBCI_STD_CPLX_H
12 #define TBCI_STD_CPLX_H
14 #include "tbci/basics.h"
15 #ifndef HAVE_NO_NEW_HEADERS_BUG
23 # define CPLX(t) CPLX__ complex<t>
24 # define CPLXR(t,a,r) CPLX__ complex<t> a (r)
25 # define CPLXRI(t,a,r,i) CPLX__ complex<t> a (r,i)
26 # define CPLXC(t,a,c) CPLX__ complex<t> a (c)
27 # define CPLXVRI(t,r,i) (CPLX__ complex<t>(r,i))
35 #ifndef TEMPLATED_FABSSQR // We do need it as the fabssqr() in basics.h is templated!
39 {
return (a.real()*a.real() + a.imag()*a.imag()); }
43 #ifndef HAVE_STDCPLX_FABS
56 {
return (a.imag() == 0 && a.real() == d); }
75 {
return CPLX__ complex<T> (z.real(), -z.imag()); }
80 #if !defined(NO_NS) && !defined(HAVE_IGNORE_STD_NS_BUG) && defined(HAVE_LIBC_GLOBAL_NS_BUG) && (!defined(HAVE_CPP_GLOBAL_NS_BUG) || !defined(HAVE_CPLX_GLOBAL_NS_BUG))
81 # define NEED_CPLX_TO_CSTD 1
84 #ifdef NEED_CPLX_TO_CSTD
107 template <typename T>
108 inline bool operator > (
const CPLX__ complex<T>& a,
const CPLX__ complex<T>&
b)
112 template <typename T>
113 inline bool operator >= (
const CPLX__ complex<T>& a,
const CPLX__ complex<T>& b)
117 template <typename T>
118 inline bool operator < (
const CPLX__ complex<T>& a,
const CPLX__ complex<T>& b)
122 template <typename T>
123 inline bool operator <= (
const CPLX__ complex<T>& a,
const CPLX__ complex<T>& b)
130 #ifdef HAVE_MISS_STDCPLX_FANCY_FN_BUG
132 template <typename T>
139 template <typename T>
146 template <typename T>
153 template <typename T>
156 CPLX__ complex<T>
arg = (1.0 +
x) / (1.0 - x);
161 #ifdef MISS_STDCPLX_TAN_BUG
163 template <typename T>
170 template <typename T>
176 #ifdef HAVE_MISS_STDCPLX_LOG10_BUG
178 template <typename T>
182 return log(x)*InvLn10;
189 #ifdef NEED_IMAG_UNIT
190 const CPLXRI(
double,Imag_unit,0.0,1.0);
194 #ifdef HAVE_MISS_CPLX_IO_BUG
196 template <
typename T>
197 STD__ ostream& operator << (STD__ ostream& os, const CPLX__ complex<T>&
v)
199 return os <<
"(" <<
v.real() <<
"," <<
v.imag() <<
")";
203 template <
typename T>
206 char bra;
T re, im = 0;
210 v =
CPLX__ complex<T> (re, im);
216 STD__ cerr <<
"Error parsing complex!" <<
STD__ endl;
217 v =
CPLX__ complex<T> (re, im);
223 STD__ cerr <<
"Error parsing complex!" <<
STD__ endl;
224 v =
CPLX__ complex<T> (re, im);
#define SPECIALIZE_MEMALLOC(TYPE)
TBCI__ cplx< T > asin(const TBCI__ cplx< T > &z)
const Vector< T > const Vector< T > & x
TBCI__ cplx< T > tan(const TBCI__ cplx< T > &z)
STD__ istream & operator>>(STD__ istream &istr, BdMatrix< T > &mat)
TBCI__ cplx< T > log(const TBCI__ cplx< T > &z)
TBCI__ cplx< T > cos(const TBCI__ cplx< T > &z)
#define SPEC_TBCI_TRAITS_ALWAYS_COPY(TYPE)
TBCI__ cplx< T > atan(const TBCI__ cplx< T > &z)
#define NAMESPACE_CSTD_END
#define CPLXRI(t, a, r, i)
#define SPEC_TBCI_TRAITS_LOOP_COPY(TYPE)
TBCI__ cplx< T > atanh(const TBCI__ cplx< T > &z)
const Vector< T > Vector< T > Vector< T > Vector< T > Vector< T > & z
TBCI__ cplx< T > log10(const TBCI__ cplx< T > &z)
T arg(const TBCI__ cplx< T > &c)
TBCI__ cplx< T > tanh(const TBCI__ cplx< T > &z)
#define SPECIALIZE_MEMALLOC2(TYPE, SHTP)
TBCI__ cplx< T > sin(const TBCI__ cplx< T > &z)
TBCI__ cplx< T > exp(const TBCI__ cplx< T > &z)
int conj(const int arg)
conj for elementary types
#define NAMESPACE_CPLX_END
double fabssqr(const double a)
bool operator==(const F_BandMatrix< T > &m1, const F_BandMatrix< T > &m2)
TBCI__ cplx< T > sinh(const TBCI__ cplx< T > &z)
const unsigned TMatrix< T > const Matrix< T > * a
const Vector< T > Vector< T > Vector< T > Vector< T > Vector< T > Vector< T > Vector< T > Vector< T > long int int char v
< find minimun of func on grid with resolution res
TBCI__ cplx< T > cosh(const TBCI__ cplx< T > &z)
TBCI__ cplx< T > acos(const TBCI__ cplx< T > &z)