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)
noexcept {}
66 lx_complex(
const real& nr,
const l_real &ar,
const real& ni,
const l_real &ai)
67 noexcept : re(lx_real(nr,ar)), im(lx_real(ni,ai)) { }
69 lx_complex(
const real& n,
const real &a)
70 noexcept : re(lx_real(n,a)), im(lx_real(0.0)) { }
72 lx_complex(
const lx_real &a,
const lx_real &b)
73 noexcept : re(a), im(b) { }
75 lx_complex(
const lx_real &a) noexcept : re(a), im(lx_real(0.0)) { }
77 explicit lx_complex(
const l_real &a,
const l_real &b)
78 noexcept : re(a), im(b) { }
80 explicit lx_complex(
const l_real &a)
81 noexcept : re(a), im(lx_real(0.0)) { }
83 explicit lx_complex(
const real &a)
84 noexcept : re(a), im(lx_real(0.0)) { }
86 explicit lx_complex(
const complex &a)
87 noexcept : re(Re(a)), im(Im(a)) { }
89 explicit lx_complex(
const l_complex &a)
90 noexcept : 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 noexcept : re(lx_real(pr,sr)), im(lx_real(pi,si)) { }
98 lx_complex & operator = (
const lx_real & lr)
noexcept
99 { re = lr; im = 0;
return *
this; }
101 lx_complex & operator = (
const l_real & lr)
noexcept
102 { re = lr; im = 0;
return *
this; }
104 lx_complex & operator = (
const real & lr)
noexcept
105 { re = lr; im = 0;
return *
this; }
107 lx_complex & operator = (
const l_complex & c)
noexcept
108 { re = Re(c); im = Im(c);
return *
this; }
110 lx_complex & operator = (
const complex & c)
noexcept
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&)
noexcept;
122 friend inline real expoRe(
const lx_complex&)
noexcept;
124 friend inline real expoIm(
const lx_complex&)
noexcept;
126 friend inline l_real lr_partRe(
const lx_complex&)
noexcept;
128 friend inline l_real lr_partIm(
const lx_complex&)
noexcept;
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)
noexcept;
147 friend lx_real abs (
const lx_complex&)
noexcept;
149 friend lx_real abs2 (
const lx_complex&)
noexcept;
152 friend inline bool operator ! (
const lx_complex& )
noexcept;
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&)
noexcept;
172 friend inline bool operator == (
const lx_complex&,
const l_real&)
noexcept;
174 friend inline bool operator == (
const lx_complex&,
const real&)
noexcept;
176 friend inline bool operator == (
const lx_real&,
const lx_complex&)
noexcept;
178 friend inline bool operator == (
const l_real&,
const lx_complex&)
noexcept;
180 friend inline bool operator == (
const real&,
const lx_complex&)
noexcept;
183 friend inline lx_complex operator - (
const lx_complex &)
noexcept;
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)
noexcept;
203friend std::istream & operator >> (std::istream &s, lx_complex &a)
noexcept
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&)
noexcept;
231 friend inline lx_complex operator + (
const lx_real&,
const lx_complex&)
noexcept;
233 friend inline lx_complex operator + (
const lx_complex&,
const l_real&)
noexcept;
235 friend inline lx_complex operator + (
const l_real&,
const lx_complex&)
noexcept;
237 friend inline lx_complex operator + (
const lx_complex&,
const real&)
noexcept;
239 friend inline lx_complex operator + (
const real&,
const lx_complex&)
noexcept;
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&)
noexcept;
265 inline real expoRe(
const lx_complex&)
noexcept;
266 inline real expoIm(
const lx_complex&)
noexcept;
267 inline l_real lr_partRe(
const lx_complex&)
noexcept;
268 inline l_real lr_partIm(
const lx_complex&)
noexcept;
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&)
noexcept;
280 lx_real
abs (
const lx_complex&)
noexcept;
281 lx_real abs2 (
const lx_complex&)
noexcept;
283 inline bool operator == (
const lx_complex&,
const lx_complex&)
noexcept;
285 inline bool operator == (
const lx_complex&,
const l_complex&)
noexcept;
286 inline bool operator == (
const lx_complex&,
const complex&)
noexcept;
287 inline bool operator == (
const l_complex&,
const lx_complex&)
noexcept;
288 inline bool operator == (
const complex&,
const lx_complex&)
noexcept;
290 inline bool operator == (
const lx_complex&,
const lx_real&)
noexcept;
291 inline bool operator == (
const lx_complex&,
const l_real&)
noexcept;
292 inline bool operator == (
const lx_complex&,
const real&)
noexcept;
293 inline bool operator == (
const lx_real&,
const lx_complex&)
noexcept;
294 inline bool operator == (
const l_real&,
const lx_complex&)
noexcept;
295 inline bool operator == (
const real&,
const lx_complex&)
noexcept;
300 inline bool operator != (
const lx_complex&,
const lx_complex&)
noexcept;
302 inline bool operator != (
const lx_complex&,
const l_complex&)
noexcept;
304 inline bool operator != (
const lx_complex&,
const complex&)
noexcept;
306 inline bool operator != (
const l_complex&,
const lx_complex&)
noexcept;
308 inline bool operator != (
const complex&,
const lx_complex&)
noexcept;
311 inline bool operator != (
const lx_complex&,
const lx_real&)
noexcept;
313 inline bool operator != (
const lx_complex&,
const l_real&)
noexcept;
315 inline bool operator != (
const lx_complex&,
const real&)
noexcept;
317 inline bool operator != (
const lx_real&,
const lx_complex&)
noexcept;
319 inline bool operator != (
const l_real&,
const lx_complex&)
noexcept;
321 inline bool operator != (
const real&,
const lx_complex&)
noexcept;
323 inline lx_complex operator - (
const lx_complex &)
noexcept;
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)
noexcept;
344 void operator >> (
const std::string &s, lx_complex &a)
noexcept;
346 void operator >> (
const char *s, lx_complex& a)
noexcept;
351 inline lx_complex operator + (
const lx_complex&)
noexcept;
354 inline lx_complex operator + (
const lx_complex&,
const l_complex&)
noexcept;
356 inline lx_complex operator + (
const lx_complex&,
const complex&)
noexcept;
358 inline lx_complex operator + (
const l_complex&,
const lx_complex&)
noexcept;
360 inline lx_complex operator + (
const complex&,
const lx_complex&)
noexcept;
362 inline lx_complex operator + (
const lx_complex&,
const lx_real&)
noexcept;
364 inline lx_complex operator + (
const lx_real&,
const lx_complex&)
noexcept;
366 inline lx_complex operator + (
const lx_complex&,
const l_real&)
noexcept;
368 inline lx_complex operator + (
const l_real&,
const lx_complex&)
noexcept;
370 inline lx_complex operator + (
const lx_complex&,
const real&)
noexcept;
372 inline lx_complex operator + (
const real&,
const lx_complex&)
noexcept;
375 inline lx_complex &
operator +=(lx_complex &,
const lx_complex &)
noexcept;
377 inline lx_complex &
operator +=(lx_complex &,
const l_complex &)
noexcept;
379 inline lx_complex &
operator +=(lx_complex &,
const complex &)
noexcept;
381 inline lx_complex &
operator +=(lx_complex &,
const lx_real &)
noexcept;
383 inline lx_complex &
operator +=(lx_complex &,
const l_real &)
noexcept;
385 inline lx_complex &
operator +=(lx_complex &,
const real &)
noexcept;
388 inline lx_complex operator - (
const lx_complex&,
const lx_complex&)
noexcept;
390 inline lx_complex operator - (
const lx_complex&,
const l_complex&)
noexcept;
392 inline lx_complex operator - (
const lx_complex&,
const complex&)
noexcept;
394 inline lx_complex operator - (
const l_complex&,
const lx_complex&)
noexcept;
396 inline lx_complex operator - (
const complex&,
const lx_complex&)
noexcept;
398 inline lx_complex operator - (
const lx_complex&,
const lx_real&)
noexcept;
400 inline lx_complex operator - (
const lx_complex&,
const l_real&)
noexcept;
402 inline lx_complex operator - (
const lx_complex&,
const real&)
noexcept;
404 inline lx_complex operator - (
const lx_real&,
const lx_complex&)
noexcept;
406 inline lx_complex operator - (
const l_real&,
const lx_complex&)
noexcept;
408 inline lx_complex operator - (
const real&,
const lx_complex&)
noexcept;
411 inline lx_complex & operator -=(lx_complex &,
const lx_complex &)
noexcept;
413 inline lx_complex & operator -=(lx_complex &,
const l_complex &)
noexcept;
415 inline lx_complex & operator -=(lx_complex &,
const complex &)
noexcept;
417 inline lx_complex & operator -=(lx_complex &,
const lx_real &)
noexcept;
419 inline lx_complex & operator -=(lx_complex &,
const l_real &)
noexcept;
421 inline lx_complex & operator -=(lx_complex &,
const real &)
noexcept;
424 inline lx_complex
operator * (
const lx_complex&,
const lx_complex&)
noexcept;
426 inline lx_complex
operator * (
const lx_complex&,
const l_complex&)
noexcept;
428 inline lx_complex
operator * (
const lx_complex&,
const complex&)
noexcept;
430 inline lx_complex
operator * (
const l_complex&,
const lx_complex&)
noexcept;
432 inline lx_complex
operator * (
const complex&,
const lx_complex&)
noexcept;
434 inline lx_complex
operator * (
const lx_complex&,
const lx_real&)
noexcept;
436 inline lx_complex
operator * (
const lx_complex&,
const l_real&)
noexcept;
438 inline lx_complex
operator * (
const lx_complex&,
const real&)
noexcept;
440 inline lx_complex
operator * (
const lx_real&,
const lx_complex&)
noexcept;
442 inline lx_complex
operator * (
const l_real&,
const lx_complex&)
noexcept;
444 inline lx_complex
operator * (
const real&,
const lx_complex&)
noexcept;
447 inline lx_complex &
operator *=(lx_complex &,
const lx_complex &)
noexcept;
449 inline lx_complex &
operator *=(lx_complex &,
const l_complex &)
noexcept;
451 inline lx_complex &
operator *=(lx_complex &,
const complex &)
noexcept;
453 inline lx_complex &
operator *=(lx_complex &,
const lx_real &)
noexcept;
455 inline lx_complex &
operator *=(lx_complex &,
const l_real &)
noexcept;
457 inline lx_complex &
operator *=(lx_complex &,
const real &)
noexcept;
460 inline lx_complex
operator / (
const lx_complex&,
const lx_complex&)
noexcept;
462 inline lx_complex
operator / (
const lx_complex&,
const l_complex&)
noexcept;
464 inline lx_complex
operator / (
const lx_complex&,
const complex&)
noexcept;
466 inline lx_complex
operator / (
const l_complex&,
const lx_complex&)
noexcept;
468 inline lx_complex
operator / (
const complex&,
const lx_complex&)
noexcept;
470 inline lx_complex
operator / (
const lx_complex&,
const lx_real&)
noexcept;
472 inline lx_complex
operator / (
const lx_complex&,
const l_real&)
noexcept;
474 inline lx_complex
operator / (
const lx_complex&,
const real&)
noexcept;
476 inline lx_complex
operator / (
const lx_real&,
const lx_complex&)
noexcept;
478 inline lx_complex
operator / (
const l_real&,
const lx_complex&)
noexcept;
480 inline lx_complex
operator / (
const real&,
const lx_complex&)
noexcept;
483 inline lx_complex &
operator /=(lx_complex &,
const lx_complex &)
noexcept;
485 inline lx_complex &
operator /=(lx_complex &,
const l_complex &)
noexcept;
487 inline lx_complex &
operator /=(lx_complex &,
const complex &)
noexcept;
489 inline lx_complex &
operator /=(lx_complex &,
const lx_real &)
noexcept;
491 inline lx_complex &
operator /=(lx_complex &,
const l_real &)
noexcept;
493 inline lx_complex &
operator /=(lx_complex &,
const real &)
noexcept;
502 lx_complex
sqr(
const lx_complex&)
noexcept;
504 lx_complex
sqrt(
const lx_complex&)
noexcept;
506 lx_complex
sqrt(
const lx_complex& ,
int)
noexcept;
508 lx_complex
exp(
const lx_complex&)
noexcept;
510 lx_complex
exp2(
const lx_complex&)
noexcept;
512 lx_complex
exp10(
const lx_complex&)
noexcept;
514 lx_complex
sin(
const lx_complex&)
noexcept;
516 lx_complex
cos(
const lx_complex&)
noexcept;
518 lx_complex
tan(
const lx_complex&)
noexcept;
520 lx_complex
cot(
const lx_complex&)
noexcept;
522 lx_complex
asin(
const lx_complex&)
noexcept;
524 lx_complex
acos(
const lx_complex&)
noexcept;
526 lx_complex
atan(
const lx_complex&)
noexcept;
528 lx_complex
acot(
const lx_complex&)
noexcept;
530 lx_complex
sinh(
const lx_complex&)
noexcept;
532 lx_complex
cosh(
const lx_complex&)
noexcept;
534 lx_complex
tanh(
const lx_complex&)
noexcept;
536 lx_complex
coth(
const lx_complex&)
noexcept;
538 lx_complex
asinh(
const lx_complex&)
noexcept;
540 lx_complex
acosh(
const lx_complex&)
noexcept;
542 lx_complex
atanh(
const lx_complex&)
noexcept;
544 lx_complex
acoth(
const lx_complex&)
noexcept;
546 std::list<lx_complex>
sqrt_all(
const lx_complex&);
548 lx_real
arg(
const lx_complex&)
noexcept;
550 lx_real
Arg(
const lx_complex&)
noexcept;
552 std::list<lx_complex>
sqrt_all(
const lx_complex&,
int);
554 lx_complex
ln(
const lx_complex&)
noexcept;
556 lx_complex
log2(
const lx_complex&)
noexcept;
558 lx_complex
log10(
const lx_complex&)
noexcept;
560 lx_complex
power_fast(
const lx_complex&,
const real&)
noexcept;
562 lx_complex
power(
const lx_complex&,
const real&)
noexcept;
564 lx_complex
pow(
const lx_complex&,
const lx_real&)
noexcept;
566 lx_complex
pow(
const lx_complex&,
const lx_complex&)
noexcept;
569 lx_complex
sqrt1px2(
const lx_complex&)
noexcept;
571 lx_complex
sqrt1mx2(
const lx_complex&)
noexcept;
573 lx_complex
sqrtx2m1(
const lx_complex&)
noexcept;
575 lx_complex
sqrtp1m1(
const lx_complex&)
noexcept;
577 lx_complex
expm1(
const lx_complex&)
noexcept;
579 lx_complex
lnp1(
const lx_complex&)
noexcept;
583#include "lx_complex.inl"
The namespace cxsc, providing all functionality of the class library C-XSC.
cinterval sqrtp1m1(const cinterval &z) noexcept
Calculates .
cinterval exp2(const cinterval &z) noexcept
Calculates .
cinterval sqrt1mx2(const cinterval &z) noexcept
Calculates .
cinterval asinh(const cinterval &z) noexcept
Calculates .
cinterval coth(const cinterval &z) noexcept
Calculates .
cdotprecision & operator+=(cdotprecision &cd, const l_complex &lc) noexcept
Implementation of standard algebraic addition and allocation operation.
cinterval log2(const cinterval &z) noexcept
Calculates .
cinterval power(const cinterval &z, int n) noexcept
Calculates .
cinterval log10(const cinterval &z) noexcept
Calculates .
cinterval ln(const cinterval &z) noexcept
Calculates .
civector operator/(const cimatrix_subv &rv, const cinterval &s) noexcept
Implementation of division operation.
cinterval pow(const cinterval &z, const interval &p) noexcept
Calculates .
cinterval sinh(const cinterval &z) noexcept
Calculates .
cinterval asin(const cinterval &z) noexcept
Calculates .
cinterval tan(const cinterval &z) noexcept
Calculates .
cinterval exp10(const cinterval &z) noexcept
Calculates .
interval arg(const cinterval &z) noexcept
Calculates .
std::list< cinterval > sqrt_all(const cinterval &z)
Calculates and returns all possible solutions.
cinterval acos(const cinterval &z) noexcept
Calculates .
cinterval sqrtx2m1(const cinterval &z) noexcept
Calculates .
cinterval acosh(const cinterval &z) noexcept
Calculates .
cinterval cosh(const cinterval &z) noexcept
Calculates .
cinterval cos(const cinterval &z) noexcept
Calculates .
cinterval sqrt1px2(const cinterval &z) noexcept
Calculates .
cinterval exp(const cinterval &z) noexcept
Calculates .
cinterval tanh(const cinterval &z) noexcept
Calculates .
cimatrix & operator*=(cimatrix &m, const cinterval &c) noexcept
Implementation of multiplication and allocation operation.
cinterval expm1(const cinterval &z) noexcept
Calculates .
cinterval cot(const cinterval &z) noexcept
Calculates .
ivector abs(const cimatrix_subv &mv) noexcept
Returns the absolute value of the matrix.
cinterval sqrt(const cinterval &z) noexcept
Calculates .
cinterval power_fast(const cinterval &z, int n) noexcept
Calculates .
cinterval acot(const cinterval &z) noexcept
Calculates .
cinterval sqr(const cinterval &z) noexcept
Calculates .
cinterval lnp1(const cinterval &z) noexcept
Calculates .
civector operator*(const cimatrix_subv &rv, const cinterval &s) noexcept
Implementation of multiplication operation.
cinterval atan(const cinterval &z) noexcept
Calculates .
cinterval atanh(const cinterval &z) noexcept
Calculates .
interval Arg(const cinterval &z) noexcept
Calculates .
cinterval acoth(const cinterval &z) noexcept
Calculates .
cinterval sin(const cinterval &z) noexcept
Calculates .
cimatrix & operator/=(cimatrix &m, const cinterval &c) noexcept
Implementation of division and allocation operation.