39 #ifndef _CXSC_LX_COMPLEX_HPP_INCLUDED 40 #define _CXSC_LX_COMPLEX_HPP_INCLUDED 44 #include <l_cinterval.hpp> 45 #include <l_complex.hpp> 46 #include "lx_interval.hpp" 64 lx_complex(
void) throw() {}
66 lx_complex(
const real& nr,
const l_real &ar,
const real& ni,
const l_real &ai)
67 throw() : re(lx_real(nr,ar)), im(lx_real(ni,ai)) { }
69 lx_complex(
const real& n,
const real &a)
70 throw() : re(lx_real(n,a)), im(lx_real(0.0)) { }
72 lx_complex(
const lx_real &a,
const lx_real &b)
73 throw() : re(a), im(b) { }
75 lx_complex(
const lx_real &a)
throw() : re(a), im(lx_real(0.0)) { }
77 explicit lx_complex(
const l_real &a,
const l_real &b)
78 throw() : re(a), im(b) { }
80 explicit lx_complex(
const l_real &a)
81 throw() : re(a), im(lx_real(0.0)) { }
83 explicit lx_complex(
const real &a)
84 throw() : re(a), im(lx_real(0.0)) { }
86 explicit lx_complex(
const complex &a)
87 throw() : re(Re(a)), im(Im(a)) { }
89 explicit lx_complex(
const l_complex &a)
90 throw() : re(lx_real(0,Re(a))), im(lx_real(0,Im(a))) { }
92 lx_complex(
const real& pr,
const string& sr,
93 const real& pi,
const string& si)
94 throw() : re(lx_real(pr,sr)), im(lx_real(pi,si)) { }
98 lx_complex & operator = (
const lx_real & lr)
throw()
99 { re = lr; im = 0;
return *
this; }
101 lx_complex & operator = (
const l_real & lr)
throw()
102 { re = lr; im = 0;
return *
this; }
104 lx_complex & operator = (
const real & lr)
throw()
105 { re = lr; im = 0;
return *
this; }
107 lx_complex & operator = (
const l_complex & c)
throw()
108 { re = Re(c); im = Im(c);
return *
this; }
110 lx_complex & operator = (
const complex & c)
throw()
111 { re = Re(c); im = Im(c);
return *
this; }
116 friend inline lx_real Re(
const lx_complex&);
118 friend inline lx_real Im(
const lx_complex&);
120 friend inline int StagPrec(
const lx_complex&) throw();
122 friend inline real expoRe(const lx_complex&) throw();
124 friend inline real expoIm(const lx_complex&) throw();
126 friend inline l_real lr_partRe(const lx_complex&) throw();
128 friend inline l_real lr_partIm(const lx_complex&) throw();
131 friend inline lx_complex & SetRe(lx_complex&, const lx_real&);
133 friend inline lx_complex & SetRe(lx_complex&, const l_real&);
135 friend inline lx_complex & SetRe(lx_complex&, const real&);
138 friend inline lx_complex & SetIm(lx_complex&, const lx_real&);
140 friend inline lx_complex & SetIm(lx_complex&, const l_real&);
142 friend inline lx_complex & SetIm(lx_complex&, const real&);
145 friend inline lx_complex conj(const lx_complex& a) throw();
147 friend lx_real
abs (const lx_complex&) throw();
149 friend lx_real abs2 (const lx_complex&) throw();
152 friend inline
bool operator ! (const lx_complex& ) throw();
155 friend inline
bool operator == (const lx_complex&, const lx_complex&)
158 friend inline
bool operator == (const lx_complex&, const l_complex&)
161 friend inline
bool operator == (const lx_complex&, const complex&)
164 friend inline
bool operator == (const l_complex&, const lx_complex&)
167 friend inline
bool operator == (const complex&, const lx_complex&)
170 friend inline
bool operator == (const lx_complex&, const lx_real&) throw();
172 friend inline
bool operator == (const lx_complex&, const l_real&) throw();
174 friend inline
bool operator == (const lx_complex&, const real&) throw();
176 friend inline
bool operator == (const lx_real&, const lx_complex&) throw();
178 friend inline
bool operator == (const l_real&, const lx_complex&) throw();
180 friend inline
bool operator == (const real&, const lx_complex&) throw();
183 friend inline lx_complex operator - (const lx_complex &) throw();
189 friend inline std::ostream& operator << (std::ostream& s, const lx_complex& a)
192 friend inline std::
string & operator << (std::
string &s, const lx_complex& a)
200 friend std::
string & operator >> (std::
string& s, lx_complex& a) throw();
203 friend std::istream & operator >> (std::istream &s, lx_complex &a) throw()
208 std::cout <<
"Real part: {Exponent to base 10, real number} = ?" 211 std::cout <<
"Img. part: {Exponent to base 10, real number} = ?" 213 s >> a.im >> RestoreOpt;
217 skipeolnflag =
false, inpdotflag =
true;
218 c = skipwhitespaces (s);
219 if (inpdotflag && c !=
')')
226 friend inline lx_complex operator + (
const lx_complex&,
const lx_complex&)
229 friend inline lx_complex operator + (const lx_complex&, const lx_real&) throw();
231 friend inline lx_complex operator + (const lx_real&, const lx_complex&) throw();
233 friend inline lx_complex operator + (const lx_complex&, const l_real&) throw();
235 friend inline lx_complex operator + (const l_real&, const lx_complex&) throw();
237 friend inline lx_complex operator + (const lx_complex&, const real&) throw();
239 friend inline lx_complex operator + (const real&, const lx_complex&) throw();
242 friend inline lx_complex operator * (const lx_complex&, const lx_complex&)
246 friend inline lx_complex operator / (const lx_complex&, const lx_complex&)
255 inline std::ostream& operator << (std::ostream& s, const lx_complex&)
257 inline std::
string & operator << (std::
string& s, const lx_complex&)
262 inline lx_real Re(const lx_complex&);
263 inline lx_real Im(const lx_complex&);
264 inline
int StagPrec(const lx_complex&) throw();
265 inline real expoRe(const lx_complex&) throw();
266 inline real expoIm(const lx_complex&) throw();
267 inline l_real lr_partRe(const lx_complex&) throw();
268 inline l_real lr_partIm(const lx_complex&) throw();
270 inline lx_complex & SetRe(lx_complex&, const lx_real&);
271 inline lx_complex & SetRe(lx_complex&, const l_real&);
272 inline lx_complex & SetRe(lx_complex&, const real&);
274 inline lx_complex & SetIm(lx_complex&, const lx_real&);
275 inline lx_complex & SetIm(lx_complex&, const l_real&);
276 inline lx_complex & SetIm(lx_complex&, const real&);
278 inline lx_complex conj(const lx_complex&) throw();
280 lx_real
abs (const lx_complex&) throw();
281 lx_real abs2 (const lx_complex&) throw();
283 inline
bool operator == (const lx_complex&, const lx_complex&) throw();
285 inline
bool operator == (const lx_complex&, const l_complex&) throw();
286 inline
bool operator == (const lx_complex&, const complex&) throw();
287 inline
bool operator == (const l_complex&, const lx_complex&) throw();
288 inline
bool operator == (const complex&, const lx_complex&) throw();
290 inline
bool operator == (const lx_complex&, const lx_real&) throw();
291 inline
bool operator == (const lx_complex&, const l_real&) throw();
292 inline
bool operator == (const lx_complex&, const real&) throw();
293 inline
bool operator == (const lx_real&, const lx_complex&) throw();
294 inline
bool operator == (const l_real&, const lx_complex&) throw();
295 inline
bool operator == (const real&, const lx_complex&) throw();
300 inline
bool operator != (const lx_complex&, const lx_complex&) throw();
302 inline
bool operator != (const lx_complex&, const l_complex&) throw();
304 inline
bool operator != (const lx_complex&, const complex&) throw();
306 inline
bool operator != (const l_complex&, const lx_complex&) throw();
308 inline
bool operator != (const complex&, const lx_complex&) throw();
311 inline
bool operator != (const lx_complex&, const lx_real&) throw();
313 inline
bool operator != (const lx_complex&, const l_real&) throw();
315 inline
bool operator != (const lx_complex&, const real&) throw();
317 inline
bool operator != (const lx_real&, const lx_complex&) throw();
319 inline
bool operator != (const l_real&, const lx_complex&) throw();
321 inline
bool operator != (const real&, const lx_complex&) throw();
323 inline lx_complex operator - (const lx_complex &) throw();
327 inline std::ostream& operator << (std::ostream& s, const lx_complex& a)
329 inline std::
string & operator << (std::
string& s, const lx_complex& a)
337 std::
string & operator >> (std::
string& s, lx_complex& a) throw();
344 void operator >> (const std::
string &s, lx_complex &a) throw();
346 void operator >> (const
char *s, lx_complex& a) throw();
351 inline lx_complex operator + (const lx_complex&) throw();
354 inline lx_complex operator + (const lx_complex&, const l_complex&) throw();
356 inline lx_complex operator + (const lx_complex&, const complex&) throw();
358 inline lx_complex operator + (const l_complex&, const lx_complex&) throw();
360 inline lx_complex operator + (const complex&, const lx_complex&) throw();
362 inline lx_complex operator + (const lx_complex&, const lx_real&) throw();
364 inline lx_complex operator + (const lx_real&, const lx_complex&) throw();
366 inline lx_complex operator + (const lx_complex&, const l_real&) throw();
368 inline lx_complex operator + (const l_real&, const lx_complex&) throw();
370 inline lx_complex operator + (const lx_complex&, const real&) throw();
372 inline lx_complex operator + (const real&, const lx_complex&) throw();
375 inline lx_complex & operator +=(lx_complex &, const lx_complex &) throw();
377 inline lx_complex & operator +=(lx_complex &, const l_complex &) throw();
379 inline lx_complex & operator +=(lx_complex &, const complex &) throw();
381 inline lx_complex & operator +=(lx_complex &, const lx_real &) throw();
383 inline lx_complex & operator +=(lx_complex &, const l_real &) throw();
385 inline lx_complex & operator +=(lx_complex &, const real &) throw();
388 inline lx_complex operator - (const lx_complex&, const lx_complex&) throw();
390 inline lx_complex operator - (const lx_complex&, const l_complex&) throw();
392 inline lx_complex operator - (const lx_complex&, const complex&) throw();
394 inline lx_complex operator - (const l_complex&, const lx_complex&) throw();
396 inline lx_complex operator - (const complex&, const lx_complex&) throw();
398 inline lx_complex operator - (const lx_complex&, const lx_real&) throw();
400 inline lx_complex operator - (const lx_complex&, const l_real&) throw();
402 inline lx_complex operator - (const lx_complex&, const real&) throw();
404 inline lx_complex operator - (const lx_real&, const lx_complex&) throw();
406 inline lx_complex operator - (const l_real&, const lx_complex&) throw();
408 inline lx_complex operator - (const real&, const lx_complex&) throw();
411 inline lx_complex & operator -=(lx_complex &, const lx_complex &) throw();
413 inline lx_complex & operator -=(lx_complex &, const l_complex &) throw();
415 inline lx_complex & operator -=(lx_complex &, const complex &) throw();
417 inline lx_complex & operator -=(lx_complex &, const lx_real &) throw();
419 inline lx_complex & operator -=(lx_complex &, const l_real &) throw();
421 inline lx_complex & operator -=(lx_complex &, const real &) throw();
424 inline lx_complex operator * (const lx_complex&, const lx_complex&) throw();
426 inline lx_complex operator * (const lx_complex&, const l_complex&) throw();
428 inline lx_complex operator * (const lx_complex&, const complex&) throw();
430 inline lx_complex operator * (const l_complex&, const lx_complex&) throw();
432 inline lx_complex operator * (const complex&, const lx_complex&) throw();
434 inline lx_complex operator * (const lx_complex&, const lx_real&) throw();
436 inline lx_complex operator * (const lx_complex&, const l_real&) throw();
438 inline lx_complex operator * (const lx_complex&, const real&) throw();
440 inline lx_complex operator * (const lx_real&, const lx_complex&) throw();
442 inline lx_complex operator * (const l_real&, const lx_complex&) throw();
444 inline lx_complex operator * (const real&, const lx_complex&) throw();
447 inline lx_complex & operator *=(lx_complex &, const lx_complex &) throw();
449 inline lx_complex & operator *=(lx_complex &, const l_complex &) throw();
451 inline lx_complex & operator *=(lx_complex &, const complex &) throw();
453 inline lx_complex & operator *=(lx_complex &, const lx_real &) throw();
455 inline lx_complex & operator *=(lx_complex &, const l_real &) throw();
457 inline lx_complex & operator *=(lx_complex &, const real &) throw();
460 inline lx_complex operator / (const lx_complex&, const lx_complex&) throw();
462 inline lx_complex operator / (const lx_complex&, const l_complex&) throw();
464 inline lx_complex operator / (const lx_complex&, const complex&) throw();
466 inline lx_complex operator / (const l_complex&, const lx_complex&) throw();
468 inline lx_complex operator / (const complex&, const lx_complex&) throw();
470 inline lx_complex operator / (const lx_complex&, const lx_real&) throw();
472 inline lx_complex operator / (const lx_complex&, const l_real&) throw();
474 inline lx_complex operator / (const lx_complex&, const real&) throw();
476 inline lx_complex operator / (const lx_real&, const lx_complex&) throw();
478 inline lx_complex operator / (const l_real&, const lx_complex&) throw();
480 inline lx_complex operator / (const real&, const lx_complex&) throw();
483 inline lx_complex & operator /=(lx_complex &, const lx_complex &) throw();
485 inline lx_complex & operator /=(lx_complex &, const l_complex &) throw();
487 inline lx_complex & operator /=(lx_complex &, const complex &) throw();
489 inline lx_complex & operator /=(lx_complex &, const lx_real &) throw();
491 inline lx_complex & operator /=(lx_complex &, const l_real &) throw();
493 inline lx_complex & operator /=(lx_complex &, const real &) throw();
502 lx_complex
sqr(const lx_complex&) throw();
504 lx_complex
sqrt(const lx_complex&) throw();
506 lx_complex
sqrt(const lx_complex& ,
int) throw();
508 lx_complex
exp(const lx_complex&) throw();
510 lx_complex
exp2(const lx_complex&) throw();
512 lx_complex
exp10(const lx_complex&) throw();
514 lx_complex
sin(const lx_complex&) throw();
516 lx_complex
cos(const lx_complex&) throw();
518 lx_complex
tan(const lx_complex&) throw();
520 lx_complex
cot(const lx_complex&) throw();
522 lx_complex
asin(const lx_complex&) throw();
524 lx_complex
acos(const lx_complex&) throw();
526 lx_complex
atan(const lx_complex&) throw();
528 lx_complex
acot(const lx_complex&) throw();
530 lx_complex
sinh(const lx_complex&) throw();
532 lx_complex
cosh(const lx_complex&) throw();
534 lx_complex
tanh(const lx_complex&) throw();
536 lx_complex
coth(const lx_complex&) throw();
538 lx_complex
asinh(const lx_complex&) throw();
540 lx_complex
acosh(const lx_complex&) throw();
542 lx_complex
atanh(const lx_complex&) throw();
544 lx_complex
acoth(const lx_complex&) throw();
546 std::list<lx_complex>
sqrt_all(const lx_complex&);
548 lx_real
arg(const lx_complex&) throw();
550 lx_real
Arg(const lx_complex&) throw();
552 std::list<lx_complex>
sqrt_all(const lx_complex&,
int);
554 lx_complex
ln(const lx_complex&) throw();
556 lx_complex
log2(const lx_complex&) throw();
558 lx_complex
log10(const lx_complex&) throw();
560 lx_complex
power_fast(const lx_complex&, const real&) throw();
562 lx_complex
power(const lx_complex&, const real&) throw();
564 lx_complex
pow(const lx_complex&, const lx_real&) throw();
566 lx_complex
pow(const lx_complex&, const lx_complex&) throw();
569 lx_complex
sqrt1px2(const lx_complex&) throw();
571 lx_complex
sqrt1mx2(const lx_complex&) throw();
573 lx_complex
sqrtx2m1(const lx_complex&) throw();
575 lx_complex
sqrtp1m1(const lx_complex&) throw();
577 lx_complex
expm1(const lx_complex&) throw();
579 lx_complex
lnp1(const lx_complex&) throw();
583 #include "lx_complex.inl" 585 #endif // _CXSC_LX_COMPLEX_HPP_INCLUDED cinterval sqrtx2m1(const cinterval &z)
Calculates .
cinterval sqrt1px2(const cinterval &z)
Calculates .
cinterval log2(const cinterval &z)
Calculates .
cinterval ln(const cinterval &z)
Calculates .
cinterval sin(const cinterval &z)
Calculates .
cinterval cot(const cinterval &z)
Calculates .
The namespace cxsc, providing all functionality of the class library C-XSC.
cinterval acot(const cinterval &z)
Calculates .
cinterval atan(const cinterval &z)
Calculates .
cinterval acos(const cinterval &z)
Calculates .
cinterval sqr(const cinterval &z)
Calculates .
cinterval expm1(const cinterval &z)
Calculates .
cinterval tanh(const cinterval &z)
Calculates .
cinterval asinh(const cinterval &z)
Calculates .
cinterval log10(const cinterval &z)
Calculates .
cinterval sqrt1mx2(const cinterval &z)
Calculates .
cinterval lnp1(const cinterval &z)
Calculates .
std::list< cinterval > sqrt_all(const cinterval &z)
Calculates and returns all possible solutions.
cinterval sqrt(const cinterval &z)
Calculates .
cinterval cos(const cinterval &z)
Calculates .
cinterval atanh(const cinterval &z)
Calculates .
cinterval power_fast(const cinterval &z, int n)
Calculates .
cinterval exp10(const cinterval &z)
Calculates .
cinterval sqrtp1m1(const cinterval &z)
Calculates .
cinterval exp(const cinterval &z)
Calculates .
cinterval cosh(const cinterval &z)
Calculates .
cinterval tan(const cinterval &z)
Calculates .
cinterval sinh(const cinterval &z)
Calculates .
cinterval exp2(const cinterval &z)
Calculates .
interval Arg(const cinterval &z)
Calculates .
cinterval asin(const cinterval &z)
Calculates .
cinterval acoth(const cinterval &z)
Calculates .
cinterval coth(const cinterval &z)
Calculates .
cinterval pow(const cinterval &z, const interval &p)
Calculates .
interval arg(const cinterval &z)
Calculates .
cinterval power(const cinterval &z, int n)
Calculates .
ivector abs(const cimatrix_subv &mv)
Returns the absolute value of the matrix.
cinterval acosh(const cinterval &z)
Calculates .