C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
cinterval.inl
1 /*
2 ** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
3 **
4 ** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
5 ** Universitaet Karlsruhe, Germany
6 ** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
7 ** Universitaet Wuppertal, Germany
8 **
9 ** This library is free software; you can redistribute it and/or
10 ** modify it under the terms of the GNU Library General Public
11 ** License as published by the Free Software Foundation; either
12 ** version 2 of the License, or (at your option) any later version.
13 **
14 ** This library is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ** Library General Public License for more details.
18 **
19 ** You should have received a copy of the GNU Library General Public
20 ** License along with this library; if not, write to the Free
21 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23 
24 /* CVS $Id: cinterval.inl,v 1.20 2014/01/30 17:23:44 cxsc Exp $ */
25 
26 namespace cxsc {
27 
28 // Inlined functions for cinterval.
29 
30 // ---- implicit constructors ------------------------------
31 
32 inline cinterval::cinterval(const interval & a,const interval & b) throw()
33  : re(a), im(b)
34 {
35 }
36 
37 inline cinterval::cinterval(const complex & a,const complex & b) throw(ERROR_CINTERVAL_EMPTY_INTERVAL)
38  : re(Re(a),Re(b)),
39  im(Im(a),Im(b))
40 {
41  if(Inf(re)>Sup(re) || Inf(im)>Sup(im))
42  cxscthrow(ERROR_CINTERVAL_EMPTY_INTERVAL("cinterval::cinterval(const complex & a,const complex & b)"));
43 }
44 
45 // ---- explicit constructors ------------------------------
46 
47 inline cinterval::cinterval(const real & a) throw() : re(a,a), im(0,0) {}
48 inline cinterval::cinterval(const interval & a) throw() : re(a), im(0,0) {}
49 inline cinterval::cinterval(const complex & a) throw() : re(Re(a),Re(a)),im(Im(a),Im(a)) {}
50 
51 // ---- assignments -----------------------------------------
52 
53 inline cinterval & cinterval::operator =(const real & a) throw()
54 {
55  re=a,im=0.0;
56  return *this;
57 }
58 
59 inline cinterval & cinterval::operator =(const interval & a) throw()
60 {
61  re=a,im=0.0;
62  return *this;
63 }
64 
65 inline cinterval & cinterval::operator =(const complex & a) throw()
66 {
67  re=Re(a),im=Im(a);
68  return *this;
69 }
70 
71 inline cinterval & cinterval::operator =(const cinterval & a) throw()
72 {
73  re=a.re;
74  im=a.im;
75  return *this;
76 }
77 
78 inline cinterval & cinterval::operator =(const dotprecision & a) throw()
79 {
80  return *this=cinterval(a);
81 }
82 
83 inline cinterval & cinterval::operator =(const idotprecision & a) throw()
84 {
85  return *this=cinterval(a);
86 }
87 
88 inline cinterval & cinterval::operator =(const cdotprecision & a) throw()
89 {
90  return *this=cinterval(a);
91 }
92 
93 inline cinterval & cinterval::operator =(const cidotprecision & a) throw()
94 {
95  return *this=cinterval(a);
96 }
97 
98 // ---- compatiblility typecasts ----------------------------
99 
105 inline cinterval _cinterval(const real & a) throw ()
106 {
107  return cinterval(interval(a,a), interval(0.0,0.0));
108 }
109 
115 inline cinterval _cinterval(const complex & a) throw ()
116 {
117  return cinterval(a,a);
118 }
119 
125 inline cinterval _cinterval(const interval & a) throw()
126 {
127  return cinterval(a,_interval(0.0,0.0));
128 }
129 
135 inline cinterval _cinterval(const dotprecision & a) throw() { return cinterval(a); }
136 
142 inline cinterval _cinterval(const cdotprecision & a) throw() { return cinterval(a); }
143 
149 inline cinterval _cinterval(const idotprecision & a) throw() { return cinterval(a); }
150 
156 inline cinterval _cinterval(const cidotprecision & a) throw() { return cinterval(a); }
157 
163 inline cinterval _cinterval(const complex & a,const complex & b) throw()
164 {
165  return cinterval(interval(Re(a),Re(b)),interval(Im(a),Im(b)));
166 }
167 
173 inline cinterval _cinterval(const real & a,const complex & b) throw()
174 {
175  return cinterval(complex(a),b);
176 }
177 
183 inline cinterval _cinterval(const complex & a,const real & b) throw()
184 {
185  return cinterval(a,complex(b));
186 }
187 
193 inline cinterval _cinterval(const interval & a,const interval & b) throw()
194 {
195  return cinterval(a,b);
196 }
197 
203 inline cinterval _cinterval(const real & a,const interval & b) throw()
204 {
205  return cinterval(interval(a),b);
206 }
207 
213 inline cinterval _cinterval(const interval & a,const real & b) throw()
214 {
215  return cinterval(a,interval(b));
216 }
217 
223 inline cinterval _unchecked_cinterval(const complex & a,const complex & b) throw()
224 {
225  cinterval tmp;
226  UncheckedSetInf(tmp,a);
227  UncheckedSetSup(tmp,b);
228  return tmp;
229 }
230 
236 inline cinterval _unchecked_cinterval(const real & a,const complex & b) throw()
237 {
238  cinterval tmp;
239  UncheckedSetInf(tmp,_complex(a));
240  UncheckedSetSup(tmp,b);
241  return tmp;
242 }
243 
249 inline cinterval _unchecked_cinterval(const complex & a,const real & b) throw()
250 {
251  cinterval tmp;
252  UncheckedSetInf(tmp,a);
253  UncheckedSetSup(tmp,_complex(b));
254  return tmp;
255 }
256 
257 // ---- Std.Operators ---------------------------------------
258 
259 inline cinterval operator -(const cinterval & a) throw ()
260 {
261  return cinterval(-a.re,-a.im);
262 }
263 
264 inline cinterval operator +(const cinterval & a) throw ()
265 {
266  return a;
267 }
268 
269 inline cinterval operator +(const cinterval & a,const cinterval & b) throw()
270 {
271  return cinterval(a.re+b.re,a.im+b.im);
272 }
273 
274 inline cinterval operator -(const cinterval & a,const cinterval & b) throw()
275 {
276  return cinterval(a.re-b.re,a.im-b.im);
277 }
278 
279 inline cinterval operator &(const cinterval & a,const cinterval & b) throw(ERROR_CINTERVAL_EMPTY_INTERVAL)
280 {
281  cinterval tmp = a;
282  SetInf(tmp.re, max(Inf(a.re), Inf(b.re)));
283  SetInf(tmp.im, max(Inf(a.im), Inf(b.im)));
284  SetSup(tmp.re, min(Sup(a.re), Sup(b.re)));
285  SetSup(tmp.im, min(Sup(a.im), Sup(b.im)));
286  if (Inf(tmp.re) > Sup(tmp.re) || Inf(tmp.im) > Sup(tmp.im))
287  cxscthrow(ERROR_CINTERVAL_EMPTY_INTERVAL("inline cinterval operator &(const cinterval & a,const cinterval & b)"));
288  return tmp;
289 }
290 
291 inline cinterval operator |(const cinterval & a,const cinterval & b) throw()
292 {
293  cinterval tmp = a;
294  SetInf(tmp.re, min(Inf(a.re), Inf(b.re)));
295  SetInf(tmp.im, min(Inf(a.im), Inf(b.im)));
296  SetSup(tmp.re, max(Sup(a.re), Sup(b.re)));
297  SetSup(tmp.im, max(Sup(a.im), Sup(b.im)));
298  return tmp;
299 }
300 
301 inline cinterval & operator +=(cinterval & a, const cinterval & b) throw() { return a=a+b; }
302 inline cinterval & operator -=(cinterval & a, const cinterval & b) throw() { return a=a-b; }
303 inline cinterval & operator *=(cinterval & a, const cinterval & b) throw() { return a=a*b; }
304 inline cinterval & operator /=(cinterval & a, const cinterval & b) throw() { return a=a/b; }
305 inline cinterval & operator |=(cinterval & a, const cinterval & b) throw() { return a=a|b; }
306 inline cinterval & operator &=(cinterval & a, const cinterval & b) throw(ERROR_CINTERVAL_EMPTY_INTERVAL) { return a=a&b; }
307 
308 // CI-R
309 
310 inline cinterval operator +(const cinterval & a,const real & b) throw() { return a+_cinterval(b); }
311 inline cinterval operator +(const real & a,const cinterval & b) throw() { return _cinterval(a)+b; }
312 inline cinterval operator -(const cinterval & a,const real & b) throw() { return a-_cinterval(b); }
313 inline cinterval operator -(const real & a,const cinterval & b) throw() { return _cinterval(a)-b; }
314 inline cinterval operator *(const cinterval & a,const real & b) throw() { return a*_cinterval(b); }
315 inline cinterval operator *(const real & a,const cinterval & b) throw()
316 { // return _cinterval(a)*b;
317  return cinterval(b.re*a, b.im*a); // Blomquist 07.11.02;
318 }
319 inline cinterval operator /(const cinterval & a,const real & b) throw()
320 { // return a/_cinterval(b);
321  return cinterval(a.re/b, a.im/b); // Blomquist 07.11.02;
322 }
323 inline cinterval operator /(const real & a,const cinterval & b) throw() { return _cinterval(a)/b; }
324 inline cinterval operator |(const cinterval & a,const real & b) throw() { return a|_cinterval(b); }
325 inline cinterval operator |(const real & a,const cinterval & b) throw() { return _cinterval(a)|b; }
326 inline cinterval operator &(const cinterval & a,const real & b) throw() { return a&_cinterval(b); }
327 inline cinterval operator &(const real & a,const cinterval & b) throw() { return _cinterval(a)&b; }
328 
329 inline cinterval & operator +=(cinterval & a, const real & b) throw() { return a=a+_cinterval(b); }
330 inline cinterval & operator -=(cinterval & a, const real & b) throw() { return a=a-_cinterval(b); }
331 inline cinterval & operator *=(cinterval & a, const real & b) throw()
332 { // return a=a*_cinterval(b);
333  return a = a * b; // Blomquist 07.11.02;
334 }
335 inline cinterval & operator /=(cinterval & a, const real & b) throw()
336 { // return a=a/_cinterval(b);
337  return a = a / b; // Blomquist 07.11.02;
338 }
339 inline cinterval & operator |=(cinterval & a, const real & b) throw() { return a=a|_cinterval(b); }
340 inline cinterval & operator &=(cinterval & a, const real & b) throw() { return a=a&_cinterval(b); }
341 
342 // CI-C
343 
344 inline cinterval operator +(const cinterval & a,const complex & b) throw() { return a+_cinterval(b); }
345 inline cinterval operator +(const complex & a,const cinterval & b) throw() { return _cinterval(a)+b; }
346 inline cinterval operator -(const cinterval & a,const complex & b) throw() { return a-_cinterval(b); }
347 inline cinterval operator -(const complex & a,const cinterval & b) throw() { return _cinterval(a)-b; }
348 inline cinterval operator *(const cinterval & a,const complex & b) throw() { return a*_cinterval(b); }
349 inline cinterval operator *(const complex & a,const cinterval & b) throw() { return _cinterval(a)*b; }
350 inline cinterval operator /(const cinterval & a,const complex & b) throw() { return a/_cinterval(b); }
351 inline cinterval operator /(const complex & a,const cinterval & b) throw() { return _cinterval(a)/b; }
352 inline cinterval operator |(const cinterval & a,const complex & b) throw() { return a|_cinterval(b); }
353 inline cinterval operator |(const complex & a,const cinterval & b) throw() { return _cinterval(a)|b; }
354 inline cinterval operator &(const cinterval & a,const complex & b) throw() { return a&_cinterval(b); }
355 inline cinterval operator &(const complex & a,const cinterval & b) throw() { return _cinterval(a)&b; }
356 
357 inline cinterval & operator +=(cinterval & a, const complex & b) throw() { return a=a+_cinterval(b); }
358 inline cinterval & operator -=(cinterval & a, const complex & b) throw() { return a=a-_cinterval(b); }
359 inline cinterval & operator *=(cinterval & a, const complex & b) throw() { return a=a*_cinterval(b); }
360 inline cinterval & operator /=(cinterval & a, const complex & b) throw() { return a=a/_cinterval(b); }
361 inline cinterval & operator |=(cinterval & a, const complex & b) throw() { return a=a|_cinterval(b); }
362 inline cinterval & operator &=(cinterval & a, const complex & b) throw() { return a=a&_cinterval(b); }
363 
364 // CI-I
365 
366 inline cinterval operator +(const cinterval & a,const interval & b) throw() { return a+_cinterval(b); }
367 inline cinterval operator +(const interval & a,const cinterval & b) throw() { return _cinterval(a)+b; }
368 inline cinterval operator -(const cinterval & a,const interval & b) throw() { return a-_cinterval(b); }
369 inline cinterval operator -(const interval & a,const cinterval & b) throw() { return _cinterval(a)-b; }
370 inline cinterval operator *(const cinterval & a,const interval & b) throw()
371 { // return a*_cinterval(b);
372  return cinterval(a.re*b,a.im*b); // Blomquist, 07.11.02;
373 }
374 inline cinterval operator *(const interval & a,const cinterval & b) throw()
375 { // return _cinterval(a)*b;
376  return cinterval(b.re*a,b.im*a);
377 }
378 inline cinterval operator /(const cinterval & a,const interval & b) throw()
379 { // return a/_cinterval(b);
380  return cinterval(a.re/b,a.im/b);
381 }
382 inline cinterval operator /(const interval & a,const cinterval & b) throw() { return _cinterval(a)/b; }
383 inline cinterval operator |(const cinterval & a,const interval & b) throw() { return a|_cinterval(b); }
384 inline cinterval operator |(const interval & a,const cinterval & b) throw() { return _cinterval(a)|b; }
385 inline cinterval operator &(const cinterval & a,const interval & b) throw() { return a&_cinterval(b); }
386 inline cinterval operator &(const interval & a,const cinterval & b) throw() { return _cinterval(a)&b; }
387 
388 inline cinterval & operator +=(cinterval & a, const interval & b) throw() { return a=a+_cinterval(b); }
389 inline cinterval & operator -=(cinterval & a, const interval & b) throw() { return a=a-_cinterval(b); }
390 inline cinterval & operator *=(cinterval & a, const interval & b) throw() { return a=a*_cinterval(b); }
391 inline cinterval & operator /=(cinterval & a, const interval & b) throw() { return a=a/_cinterval(b); }
392 inline cinterval & operator |=(cinterval & a, const interval & b) throw() { return a=a|_cinterval(b); }
393 inline cinterval & operator &=(cinterval & a, const interval & b) throw() { return a=a&_cinterval(b); }
394 
395 // C-R
396 
397 inline cinterval operator |(const complex & a,const real & b) throw() { return _cinterval(a)|_cinterval(b); }
398 inline cinterval operator |(const real & a,const complex & b) throw() { return _cinterval(a)|_cinterval(b); }
399 
400 // C-I
401 
402 inline cinterval operator +(const complex & a,const interval & b) throw() { return _cinterval(a)+_cinterval(b); }
403 inline cinterval operator +(const interval & a,const complex & b) throw() { return _cinterval(a)+_cinterval(b); }
404 inline cinterval operator -(const complex & a,const interval & b) throw() { return _cinterval(a)-_cinterval(b); }
405 inline cinterval operator -(const interval & a,const complex & b) throw() { return _cinterval(a)-_cinterval(b); }
406 inline cinterval operator *(const complex & a,const interval & b) throw()
407 { // return _cinterval(a)*_cinterval(b);
408  return _cinterval(a)*b; // Blomquist, 07.11.02;
409 }
410 inline cinterval operator *(const interval & a,const complex & b) throw()
411 { // return _cinterval(a)*_cinterval(b);
412  return _cinterval(b) * a; // Blomquist, 07.11.02;
413 }
414 inline cinterval operator /(const complex & a,const interval & b) throw()
415 { // return _cinterval(a)/_cinterval(b);
416  return _cinterval(a) / b; // Blomquist, 07.11.02;
417 }
418 inline cinterval operator /(const interval & a,const complex & b) throw() { return _cinterval(a)/_cinterval(b); }
419 inline cinterval operator |(const complex & a,const interval & b) throw() { return _cinterval(a)|_cinterval(b); }
420 inline cinterval operator |(const interval & a,const complex & b) throw() { return _cinterval(a)|_cinterval(b); }
421 inline cinterval operator &(const complex & a,const interval & b) throw() { return _cinterval(a)&_cinterval(b); }
422 inline cinterval operator &(const interval & a,const complex & b) throw() { return _cinterval(a)&_cinterval(b); }
423 
424 // C-C
425 
426 inline cinterval operator |(const complex & a,const complex & b) throw() { return _cinterval(a)|_cinterval(b); }
427 
428 // ---- Comp.Operat. ---------------------------------------
429 inline bool operator! (const cinterval & a) throw()
430 {
431  return !a.re && !a.im;
432 }
433 
434 inline bool operator== (const cinterval & a, const cinterval & b) throw()
435 {
436  return a.re==b.re && a.im==b.im;
437 }
438 
439 inline bool operator!= (const cinterval & a, const cinterval & b) throw()
440 {
441  return a.re!=b.re || a.im!=b.im;
442 }
443 
444 // CI-R
445 
446 inline bool operator== (const cinterval & a, const real & b) throw() { return a==_cinterval(b); }
447 inline bool operator== (const real & a, const cinterval & b) throw() { return _cinterval(a)==b; }
448 inline bool operator!= (const cinterval & a, const real & b) throw() { return a!=_cinterval(b); }
449 inline bool operator!= (const real & a, const cinterval & b) throw() { return _cinterval(a)!=b; }
450 
451 // CI-C
452 
453 inline bool operator== (const cinterval & a, const complex & b) throw() { return a==_cinterval(b); }
454 inline bool operator== (const complex & a, const cinterval & b) throw() { return _cinterval(a)==b; }
455 inline bool operator!= (const cinterval & a, const complex & b) throw() { return a!=_cinterval(b); }
456 inline bool operator!= (const complex & a, const cinterval & b) throw() { return _cinterval(a)!=b; }
457 
458 // CI-I
459 
460 inline bool operator== (const cinterval & a, const interval & b) throw() { return a==_cinterval(b); }
461 inline bool operator== (const interval & a, const cinterval & b) throw() { return _cinterval(a)==b; }
462 inline bool operator!= (const cinterval & a, const interval & b) throw() { return a!=_cinterval(b); }
463 inline bool operator!= (const interval & a, const cinterval & b) throw() { return _cinterval(a)!=b; }
464 
465 // ---- Set Operators ----
466 inline bool operator <(const cinterval & a,const cinterval & b) throw()
467 {
468  if (Inf(a.re) <= Inf(b.re) || Sup(a.re) >= Sup(b.re))
469  return false;
470  if (Inf(a.im) <= Inf(b.im) || Sup(a.im) >= Sup(b.im))
471  return false;
472 
473  return true;
474 }
475 
476 inline bool operator >(const cinterval & a,const cinterval & b) throw() { return b<a; }
477 
478 inline bool operator <=(const cinterval & a,const cinterval & b) throw()
479 {
480  if (Inf(a.re) < Inf(b.re) || Sup(a.re) > Sup(b.re))
481  return false;
482  if (Inf(a.im) < Inf(b.im) || Sup(a.im) > Sup(b.im))
483  return false;
484 
485  return true;
486 }
487 
488 inline bool operator >=(const cinterval & a,const cinterval & b) throw() { return b<=a; }
489 
490 // CI-R
491 
492 inline bool operator <(const real & a,const cinterval & b) throw() { return _cinterval(a)<b; }
493 inline bool operator >(const real & a,const cinterval & b) throw() { return _cinterval(a)>b; }
494 inline bool operator <=(const real & a,const cinterval & b) throw() { return _cinterval(a)<=b; }
495 inline bool operator >=(const real & a,const cinterval & b) throw() { return _cinterval(a)>=b; }
496 
497 inline bool operator <(const cinterval & a,const real & b) throw() { return a<_cinterval(b); }
498 inline bool operator >(const cinterval & a,const real & b) throw() { return a>_cinterval(b); }
499 inline bool operator <=(const cinterval & a,const real & b) throw() { return a<=_cinterval(b); }
500 inline bool operator >=(const cinterval & a,const real & b) throw() { return a>=_cinterval(b); }
501 
502 // CI-C
503 
504 inline bool operator <(const complex & a,const cinterval & b) throw() { return _cinterval(a)<b; }
505 inline bool operator >(const complex & a,const cinterval & b) throw() { return _cinterval(a)>b; }
506 inline bool operator <=(const complex & a,const cinterval & b) throw() { return _cinterval(a)<=b; }
507 inline bool operator >=(const complex & a,const cinterval & b) throw() { return _cinterval(a)>=b; }
508 
509 inline bool operator <(const cinterval & a,const complex & b) throw() { return a<_cinterval(b); }
510 inline bool operator >(const cinterval & a,const complex & b) throw() { return a>_cinterval(b); }
511 inline bool operator <=(const cinterval & a,const complex & b) throw() { return a<=_cinterval(b); }
512 inline bool operator >=(const cinterval & a,const complex & b) throw() { return a>=_cinterval(b); }
513 
514 // CI-C
515 
516 inline bool operator <(const interval & a,const cinterval & b) throw() { return _cinterval(a)<b; }
517 inline bool operator >(const interval & a,const cinterval & b) throw() { return _cinterval(a)>b; }
518 inline bool operator <=(const interval & a,const cinterval & b) throw() { return _cinterval(a)<=b; }
519 inline bool operator >=(const interval & a,const cinterval & b) throw() { return _cinterval(a)>=b; }
520 
521 inline bool operator <(const cinterval & a,const interval & b) throw() { return a<_cinterval(b); }
522 inline bool operator >(const cinterval & a,const interval & b) throw() { return a>_cinterval(b); }
523 inline bool operator <=(const cinterval & a,const interval & b) throw() { return a<=_cinterval(b); }
524 inline bool operator >=(const cinterval & a,const interval & b) throw() { return a>=_cinterval(b); }
525 
526 // ---- Others -------------------------------------------
527 inline complex Inf(const cinterval & a) throw() { return _complex(Inf(a.re),Inf(a.im)); }
528 inline complex Sup(const cinterval & a) throw() { return _complex(Sup(a.re),Sup(a.im)); }
529 
530 inline cinterval & SetInf(cinterval & a,const complex & b) throw(ERROR_CINTERVAL_EMPTY_INTERVAL)
531 {
532  Inf(a.re)=Re(b);
533  Inf(a.im)=Im(b);
534 
535  if (Inf(a.re) > Sup(a.re) || Inf(a.im) > Sup(a.im))
536  cxscthrow(ERROR_CINTERVAL_EMPTY_INTERVAL("inline cinterval & SetInf(cinterval & a,const complex & b)"));
537 
538  return a;
539 }
540 
541 inline cinterval & SetSup(cinterval & a,const complex & b) throw(ERROR_CINTERVAL_EMPTY_INTERVAL)
542 {
543  Sup(a.re)=Re(b);
544  Sup(a.im)=Im(b);
545 
546  if (Inf(a.re) > Sup(a.re) || Inf(a.im) > Sup(a.im))
547  cxscthrow(ERROR_CINTERVAL_EMPTY_INTERVAL("inline cinterval & SetSup(cinterval & a,const complex & b)"));
548 
549  return a;
550 }
551 
552 inline cinterval & SetInf(cinterval & a,const real & b) throw(ERROR_CINTERVAL_EMPTY_INTERVAL)
553 {
554  Inf(a.re)=b;
555  Inf(a.im)=0.0;
556 
557  if (Inf(a.re) > Sup(a.re) || Inf(a.im) > Sup(a.im))
558  cxscthrow(ERROR_CINTERVAL_EMPTY_INTERVAL("inline cinterval & SetInf(cinterval & a,const real & b)"));
559 
560  return a;
561 }
562 
563 inline cinterval & SetSup(cinterval & a,const real & b) throw(ERROR_CINTERVAL_EMPTY_INTERVAL)
564 {
565  Sup(a.re)=b;
566  Sup(a.im)=0.0;
567 
568  if (Inf(a.re) > Sup(a.re) || Inf(a.im) > Sup(a.im))
569  cxscthrow(ERROR_CINTERVAL_EMPTY_INTERVAL("inline cinterval & SetSup(cinterval & a,const real & b)"));
570 
571  return a;
572 }
573 
574 inline cinterval & UncheckedSetInf(cinterval & a,const complex & b) throw()
575 {
576  Inf(a.re)=Re(b);
577  Inf(a.im)=Im(b);
578  return a;
579 }
580 
581 inline cinterval & UncheckedSetInf(cinterval & a,const real & b) throw()
582 {
583  Inf(a.re)=b;
584  Inf(a.im)=0.0;
585  return a;
586 }
587 
588 inline cinterval & UncheckedSetSup(cinterval & a,const complex & b) throw()
589 {
590  Sup(a.re)=Re(b);
591  Sup(a.im)=Im(b);
592  return a;
593 }
594 
595 inline cinterval & UncheckedSetSup(cinterval & a,const real & b) throw()
596 {
597  Sup(a.re)=b;
598  Sup(a.im)=0.0;
599  return a;
600 }
601 
602 inline interval & Re(cinterval & a) throw() { return a.re; }
603 inline interval Re(const cinterval & a) throw() { return a.re; }
604 inline interval & Im(cinterval & a) throw() { return a.im; }
605 inline interval Im(const cinterval & a) throw() { return a.im; }
606 
607 inline cinterval & SetRe(cinterval & a,const interval & b) { a.re=b; return a; }
608 inline cinterval & SetIm(cinterval & a,const interval & b) { a.im=b; return a; }
609 inline cinterval & SetRe(cinterval & a,const real & b) { a.re=b; return a; }
610 inline cinterval & SetIm(cinterval & a,const real & b) { a.im=b; return a; }
611 
612 inline real InfRe(const cinterval &a) throw() { return Inf(a.re); }
613 inline real InfIm(const cinterval &a) throw() { return Inf(a.im); }
614 inline real SupRe(const cinterval &a) throw() { return Sup(a.re); }
615 inline real SupIm(const cinterval &a) throw() { return Sup(a.im); }
616 
617 inline real & InfRe(cinterval &a) throw() { return Inf(a.re); }
618 inline real & InfIm(cinterval &a) throw() { return Inf(a.im); }
619 inline real & SupRe(cinterval &a) throw() { return Sup(a.re); }
620 inline real & SupIm(cinterval &a) throw() { return Sup(a.im); }
621 
622 
623 
624 
625 
626 
627 
628 
629 
630 
631 inline cinterval conj(const cinterval & a) throw() { return cinterval(a.re,-a.im); }
632 
633 inline complex mid(const cinterval &a) throw() { return complex(mid(a.re),mid(a.im)); }
634 inline complex diam(const cinterval &a) throw(){ return complex(diam(a.re),diam(a.im)); }
635 
636 cinterval mult_operator(const cinterval & a,const cinterval & b) throw();
637 cinterval div_operator(const cinterval & a,const cinterval & b) throw(DIV_BY_ZERO);
638 
639 inline cinterval operator *(const cinterval & a,const cinterval & b) throw()
640 {
641 #ifdef CXSC_FAST_COMPLEX_OPERATIONS
642  return cinterval(Re(a)*Re(b)-Im(a)*Im(b), Re(a)*Im(b)+Im(a)*Re(b));
643 #else
644  return mult_operator(a,b);
645 #endif
646 }
647 
648 inline cinterval operator / (const cinterval & a, const cinterval & b) throw(DIV_BY_ZERO)
649 {
650  if (0.0 <= Re(b) && 0.0 <= Im(b) ) {
651  cxscthrow(DIV_BY_ZERO("cinterval operator / (const cinterval&, const cinterval&)"));
652  return a; // dummy result
653  }
654 #ifdef CXSC_FAST_COMPLEX_OPERATIONS
655  return a * (1.0 / b);
656 #else
657  return div_operator(a,b);
658 #endif
659 }
660 
661 
662 } // namespace cxsc
663 
cxsc::cinterval::cinterval
cinterval(void)
Constructor of class cinterval.
Definition: cinterval.hpp:64
cxsc::mid
cvector mid(const cimatrix_subv &mv)
Returns the middle of the matrix.
Definition: cimatrix.inl:739
cxsc::operator*=
cimatrix & operator*=(cimatrix &m, const cinterval &c)
Implementation of multiplication and allocation operation.
Definition: cimatrix.inl:1605
cxsc::interval
The Scalar Type interval.
Definition: interval.hpp:55
cxsc::_complex
complex _complex(const real &a)
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
Definition: complex.hpp:366
cxsc::diam
cvector diam(const cimatrix_subv &mv)
Returns the diameter of the matrix.
Definition: cimatrix.inl:738
cxsc::idotprecision
The Data Type idotprecision.
Definition: idot.hpp:48
cxsc::operator*
civector operator*(const cimatrix_subv &rv, const cinterval &s)
Implementation of multiplication operation.
Definition: cimatrix.inl:731
cxsc::dotprecision
The Data Type dotprecision.
Definition: dot.hpp:112
cxsc::operator/=
cimatrix & operator/=(cimatrix &m, const cinterval &c)
Implementation of division and allocation operation.
Definition: cimatrix.inl:1623
cxsc::cidotprecision
The Data Type cidotprecision.
Definition: cidot.hpp:58
cxsc
The namespace cxsc, providing all functionality of the class library C-XSC.
Definition: cdot.cpp:29
cxsc::operator+=
cdotprecision & operator+=(cdotprecision &cd, const l_complex &lc)
Implementation of standard algebraic addition and allocation operation.
Definition: cdot.inl:251
cxsc::cdotprecision
The Data Type cdotprecision.
Definition: cdot.hpp:61
cxsc::cinterval::operator=
cinterval & operator=(const real &)
Implementation of standard assigning operator.
Definition: cinterval.inl:53
cxsc::operator/
civector operator/(const cimatrix_subv &rv, const cinterval &s)
Implementation of division operation.
Definition: cimatrix.inl:730
cxsc::cinterval
The Scalar Type cinterval.
Definition: cinterval.hpp:55
cxsc::_cinterval
cinterval _cinterval(const real &a)
Definition: cinterval.inl:105
cxsc::complex
The Scalar Type complex.
Definition: complex.hpp:50
cxsc::real
The Scalar Type real.
Definition: real.hpp:114
cxsc::_unchecked_cinterval
cinterval _unchecked_cinterval(const complex &a, const complex &b)
Definition: cinterval.inl:223