25 #ifndef _CXSC_L_COMPLEX_HPP_INCLUDED 26 #define _CXSC_L_COMPLEX_HPP_INCLUDED 32 #include "complex.hpp" 34 #include "l_rmath.hpp" 64 { re = lr; im = 0;
return *
this; }
67 { re = r; im = 0;
return *
this; }
70 { re =
Re(c); im =
Im(c);
return *
this; }
73 { re = d; im = 0.0;
return *
this; }
133 (
const l_complex &,
const l_complex &)
throw();
136 friend inline l_complex
operator -
137 (
const l_complex &,
const l_complex &)
throw();
144 friend inline l_complex
operator +
145 (
const complex &,
const l_complex &)
throw();
152 friend inline l_complex
operator +
153 (
const real &,
const l_complex &)
throw();
160 friend inline l_complex
operator +
161 (
const l_real &,
const l_complex &)
throw();
165 inline l_complex
operator - (
const l_real &)
const throw();
168 friend inline l_complex
operator -
169 (
const l_real &,
const l_complex &)
throw();
173 inline l_complex
operator - (
const complex &)
const throw();
176 friend inline l_complex
operator -
177 (
const complex &,
const l_complex &)
throw();
181 inline l_complex
operator - (
const real &)
const throw();
184 friend inline l_complex
operator -
185 (
const real &,
const l_complex &)
throw();
198 friend cdotprecision
operator-
199 (
const l_complex &,
const cdotprecision &)
throw();
202 friend cdotprecision
operator-
203 (
const cdotprecision &,
const l_complex &)
throw();
207 friend cdotprecision
operator+
211 friend cdotprecision
operator+
216 friend cdotprecision
operator-
217 (
const l_complex &,
const dotprecision &)
throw();
220 friend cdotprecision
operator-
221 (
const dotprecision &,
const l_complex &)
throw();
228 friend l_complex
operator * (
const l_complex& a,
const l_complex& b)
233 friend l_complex
operator * (
const l_complex& a,
const complex& b)
237 friend l_complex
operator * (
const complex& b,
const l_complex& a )
242 inline l_complex
operator * (
const real &)
const throw();
245 friend inline l_complex
operator *
246 (
const real &,
const l_complex &)
throw();
250 inline l_complex
operator * (
const l_real &)
const throw();
253 friend inline l_complex
operator *
254 (
const l_real &,
const l_complex &)
throw();
259 friend l_real &
Re(l_complex& a);
261 friend l_real
Re(
const l_complex& a);
263 friend l_real &
Im(l_complex& a);
265 friend l_real
Im(
const l_complex& a);
268 friend inline l_complex
conj(
const l_complex&)
throw();
270 friend l_complex &
SetRe(l_complex & a,
const l_real & b);
275 friend l_complex &
SetIm(l_complex & a,
const l_real & b);
281 friend void accumulate(cdotprecision&,
const l_complex&,
282 const l_complex&)
throw();
285 friend void accumulate(cdotprecision&,
const l_complex&,
286 const complex&)
throw();
289 friend void accumulate(cdotprecision&,
const l_complex&,
290 const real&)
throw();
293 friend void accumulate(cdotprecision&,
const l_complex&,
294 const l_real&)
throw();
298 friend inline cdotprecision &
operator += (cdotprecision &cd,
299 const l_complex &lc)
throw();
301 friend inline cdotprecision &
operator -= (cdotprecision &cd,
302 const l_complex &lc)
throw();
306 friend inline l_complex &
operator += (l_complex &,
const l_complex &)
throw();
308 friend inline l_complex &
operator -= (l_complex &,
const l_complex &)
throw();
310 friend inline l_complex &
operator += (l_complex &,
const complex &)
throw();
312 friend inline l_complex &
operator -= (l_complex &,
const complex &)
throw();
314 friend inline l_complex &
operator += (l_complex &,
const real &)
throw();
316 friend inline l_complex &
operator -= (l_complex &,
const real &)
throw();
318 friend inline l_complex &
operator += (l_complex &,
const l_real &)
throw();
320 friend inline l_complex &
operator -= (l_complex &,
const l_real &)
throw();
324 friend inline l_complex &
operator *= (l_complex &,
const l_complex &)
throw();
326 friend inline l_complex &
operator *= (l_complex &,
const complex &)
throw();
328 friend inline l_complex &
operator *= (l_complex &,
const real &)
throw();
330 friend inline l_complex &
operator *= (l_complex &,
const l_real &)
throw();
333 friend inline bool operator! (
const l_complex &)
throw();
335 friend inline bool operator== (
const l_complex &,
const l_complex &)
throw();
337 friend inline bool operator!= (
const l_complex &,
const l_complex &)
throw();
339 friend inline bool operator== (
const l_complex &,
const complex &)
throw();
341 friend inline bool operator== (
const complex &,
const l_complex &)
throw();
343 friend inline bool operator!= (
const l_complex &,
const complex &)
throw();
345 friend inline bool operator!= (
const complex &,
const l_complex &)
throw();
347 friend inline bool operator== (
const l_complex &,
const real &)
throw();
349 friend inline bool operator== (
const real &,
const l_complex &)
throw();
351 friend inline bool operator!= (
const l_complex &,
const real &)
throw();
353 friend inline bool operator!= (
const real &,
const l_complex &)
throw();
355 friend inline bool operator== (
const l_complex &,
const l_real &)
throw();
357 friend inline bool operator== (
const l_real &,
const l_complex &)
throw();
359 friend inline bool operator!= (
const l_complex &,
const l_real &)
throw();
361 friend inline bool operator!= (
const l_real &,
const l_complex &)
throw();
363 friend inline bool operator== (
const l_complex &,
const dotprecision &)
366 friend inline bool operator== (
const dotprecision &,
const l_complex &)
369 friend inline bool operator!= (
const l_complex &,
const dotprecision &)
372 friend inline bool operator!= (
const dotprecision &,
const l_complex &)
376 friend inline bool operator ==(
const cdotprecision &,
const l_complex &)
379 friend inline bool operator ==(
const l_complex &,
const cdotprecision &)
382 friend inline bool operator !=(
const cdotprecision &,
const l_complex &)
385 friend inline bool operator !=(
const l_complex &,
const cdotprecision &)
391 friend l_complex
divn (
const l_complex &,
const l_complex &);
393 friend l_complex divd (
const l_complex &,
const l_complex &);
395 friend l_complex divu (
const l_complex &,
const l_complex &);
399 friend l_complex
operator / (
const l_complex &,
const l_complex &)
throw();
402 friend inline l_complex
operator / (
const l_complex & a,
403 const complex & b)
throw();
405 friend inline l_complex
operator / (
const l_complex & a,
406 const l_real & b)
throw();
408 friend inline l_complex
operator / (
const l_complex & a,
409 const real & b)
throw();
412 friend inline l_complex
operator / (
const complex& a,
413 const l_complex& b)
throw();
415 friend inline l_complex
operator / (
const real& a,
416 const l_complex& b)
throw();
418 friend inline l_complex
operator / (
const l_real& a,
419 const l_complex& b)
throw();
422 friend inline l_complex&
operator /=(l_complex&,
const l_complex&)
throw();
424 friend inline l_complex&
operator /=(l_complex&,
const complex&)
throw();
426 friend inline l_complex&
operator /=(l_complex&,
const real&)
throw();
428 friend inline l_complex&
operator /=(l_complex&,
const l_real&)
throw();
431 friend l_real
abs2(
const l_complex &a)
throw();
433 friend l_real
abs (
const l_complex &z)
throw();
438 friend std::ostream&
operator << (std::ostream& s,
const l_complex& z )
throw()
449 friend std::string &
operator << (std::string &s,
const l_complex& a)
throw()
464 friend std::istream &
operator >> (std::istream &s, l_complex &a)
throw()
470 skipeolnflag = inpdotflag =
true;
471 c = skipwhitespacessinglechar (s,
'(');
477 skipeolnflag = inpdotflag =
true;
478 c = skipwhitespacessinglechar (s,
',');
479 if (inpdotflag) s.putback(c);
481 s >> a.im >> RestoreOpt;
485 skipeolnflag =
false, inpdotflag =
true;
486 c = skipwhitespaces (s);
487 if (inpdotflag && c !=
')')
494 friend std::string &
operator >> (std::string &s, l_complex &a)
throw()
498 s = skipwhitespacessinglechar (s,
'(');
499 s >> SaveOpt >> a.re;
500 s = skipwhitespacessinglechar (s,
',');
501 s >> a.im >> RestoreOpt;
502 s = skipwhitespaces (s);
511 inline l_complex
_l_complex(
const l_real &a)
throw()
513 inline l_complex
_l_complex(
const l_real &a,
const l_real &b)
515 inline l_complex
_l_complex(
const real &a)
throw()
517 inline l_complex
_l_complex(
const real &a,
const real &b)
521 inline l_complex
_l_complex(
const dotprecision &d)
523 inline l_complex
conj(
const l_complex&)
throw();
527 l_real &
Re(l_complex& a);
528 l_real
Re(
const l_complex& a);
529 l_real &
Im(l_complex& a);
530 l_real
Im(
const l_complex& a);
532 l_complex &
SetRe(l_complex & a,
const l_real & b);
536 l_complex &
SetIm(l_complex & a,
const l_real & b);
539 l_complex
_l_complex(
const cdotprecision &)
throw();
543 #include "l_complex.inl" 545 #endif // _CXSC_L_COMPLEX_HPP_INCLUDED friend bool operator!=(const l_complex &, const l_complex &)
Implementation of standard negated equality operation.
l_complex(const real &a, const real &b)
Constructor of class l_complex.
The Multiple-Precision Data Type l_real.
The Data Type dotprecision.
friend cdotprecision & operator-=(cdotprecision &cd, const l_complex &lc)
Implementation of standard algebraic subtraction and allocation operation.
friend l_real & Im(l_complex &a)
Returns the imaginary part of the complex value.
l_complex(const l_real &a, const l_real &b)
Constructor of class l_complex.
The namespace cxsc, providing all functionality of the class library C-XSC.
l_complex(const dotprecision &d)
Constructor of class l_complex.
l_complex(const complex &r)
Constructor of class l_complex.
friend l_complex & operator*=(l_complex &, const l_complex &)
Implementation of standard algebraic multiplication and allocation operation.
friend l_complex operator/(const l_complex &, const l_complex &)
Implementation of standard algebraic division operation.
friend bool operator==(const l_complex &, const l_complex &)
Implementation of standard equality operation.
friend l_complex conj(const l_complex &)
Returns the conjugated complex value.
l_complex(const real &r)
Constructor of class l_complex.
friend int StagPrec(const l_complex &)
Returns the precision of the long datatype value.
friend l_complex divn(const l_complex &, const l_complex &)
Division of two real values and rounding to the nearest value.
The Data Type cdotprecision.
friend l_real abs(const l_complex &z)
The absolute value of a l_complex value.
friend l_complex & SetIm(l_complex &a, const l_real &b)
Sets the imaginary part of a complex value.
l_complex _l_complex(const cdotprecision &)
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC...
friend l_complex & operator/=(l_complex &, const l_complex &)
Implementation of standard algebraic division and allocation operation.
The Multiple-Precision Data Type l_complex.
friend l_real & Re(l_complex &a)
Returns the real part of the complex value.
l_complex & operator=(const l_real &lr)
Implementation of standard assigning operator.
friend l_complex operator+(const l_complex &)
Implementation of standard algebraic positive sign operation.
friend cdotprecision & operator+=(cdotprecision &cd, const l_complex &lc)
Implementation of standard algebraic addition and allocation operation.
l_complex(const cdotprecision &cd)
Constructor of class l_complex.
friend void accumulate(cdotprecision &, const l_complex &, const l_complex &)
The accurate scalar product of the last two arguments added to the value of the first argument...
friend l_complex operator*(const l_complex &a, const l_complex &b)
Implementation of standard algebraic multiplication operation.
l_complex(void)
Constructor of class l_complex.
friend l_real abs2(const l_complex &a)
The absolute value of a l_complex value.
friend std::ostream & operator<<(std::ostream &s, const l_complex &z)
Implementation of standard output method.
friend l_complex & SetRe(l_complex &a, const l_real &b)
Sets the real part of a complex value.
friend std::istream & operator>>(std::istream &s, l_complex &a)
Implementation of standard input method.
l_complex(const l_real &r)
Constructor of class l_complex.
friend l_complex operator-(const l_complex &)
Implementation of standard algebraic negative sign operation.