C-XSC - A C++ Class Library for Extended Scientific Computing 2.5.4
l_interval.hpp
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: l_interval.hpp,v 1.36 2014/01/30 17:23:46 cxsc Exp $ */
25
26#ifndef _CXSC_L_INTERVAL_HPP_INCLUDED
27#define _CXSC_L_INTERVAL_HPP_INCLUDED
28
29#include <iostream>
30#include <string>
31#include "real.hpp"
32#include "interval.hpp"
33#include "l_real.hpp"
34#include "except.hpp"
35#include "idot.hpp"
36
37namespace cxsc {
38
39class l_interval_Inf;
40class l_interval_Sup;
41
43
72{
73 friend class l_interval_Inf;
74 friend class l_interval_Sup;
75
76 private:
77 // ---- Datenelemente ---------------------------------------
78
79 // die eigentliche Datenstruktur
80 // ein l_interval der Praezision n besteht aus n+1 reals , wobei die reals
81 // 1..n das inf,
82 // 1..n-1,n+1 das sup darstellen!
83 // Ein echtes interval liegt also nur in den letzten beiden reals vor!
84 int prec;
85 real *data;
86
87
88 public:
89 // ---- Konstruktoren ---------------------------------------
90#if (CXSC_INDEX_CHECK)
92 inline l_interval() ;
94 inline l_interval(const l_interval &) ;
95
97 l_interval(const l_real &, const l_real &);
99 l_interval(const real &, const l_real &) ;
101 l_interval(const l_real &, const real &) ;
103 inline l_interval(const real &, const real &) ;
104
106 explicit l_interval(const dotprecision &);
108 explicit l_interval(const dotprecision &,const dotprecision &);
110 explicit l_interval(const idotprecision &);
111#else
113 inline l_interval() noexcept;
115 inline l_interval(const l_interval &) noexcept;
116
118 l_interval(const l_real &, const l_real &);
120 l_interval(const real &, const l_real &) ;
122 l_interval(const l_real &, const real &) ;
124 l_interval(const real &, const real &) ;
125
127 explicit l_interval(const dotprecision &) noexcept;
129 explicit l_interval(const dotprecision &,const dotprecision &);
131 explicit l_interval(const idotprecision &) noexcept;
132#endif
133
135 explicit inline l_interval(const real &) noexcept;
137 explicit inline l_interval(const l_real &) noexcept;
138
139#if(CXSC_INDEX_CHECK)
141 explicit INLINE l_interval(const l_ivector &);
143 explicit INLINE l_interval(const l_ivector_slice &);
145 explicit INLINE l_interval(const l_imatrix &m);
147 explicit INLINE l_interval(const l_imatrix_slice &m);
149 friend INLINE interval _l_interval(const l_ivector &);
151 friend INLINE interval _l_interval(const l_ivector_slice &);
153 friend INLINE interval _l_interval(const l_imatrix &m);
155 friend INLINE interval _l_interval(const l_imatrix_slice &m);
156#else
158 explicit INLINE l_interval(const l_ivector &) noexcept;
160 explicit INLINE l_interval(const l_ivector_slice &) noexcept;
162 explicit INLINE l_interval(const l_imatrix &m) noexcept;
164 explicit INLINE l_interval(const l_imatrix_slice &m) noexcept;
166 friend INLINE interval _l_interval(const l_ivector &) noexcept;
168 friend INLINE interval _l_interval(const l_ivector_slice &) noexcept;
170 friend INLINE interval _l_interval(const l_imatrix &m) noexcept;
172 friend INLINE interval _l_interval(const l_imatrix_slice &m) noexcept;
173#endif
174
175
176
178 inline l_interval & operator= (const real & a) noexcept;
180 inline l_interval & operator= (const l_real &a) noexcept;
182 inline l_interval & operator= (const interval & a)throw();
184 l_interval & operator= (const l_interval &a)throw();
186 l_interval& operator = (const lx_interval&) noexcept;
187#if (CXSC_INDEX_CHECK)
189 l_interval & operator= (const dotprecision &a);
191 l_interval & operator= (const idotprecision &);
192#else
194 l_interval & operator= (const dotprecision &a) noexcept;
196 l_interval & operator= (const idotprecision &) noexcept;
197#endif
198
199 // ---- Destruktor ----
200 inline ~l_interval() noexcept;
201
202 // ---- Typwandlungen ----
204 explicit inline l_interval(const interval &) noexcept;
205
206 friend interval::interval(const l_interval &) noexcept;
207 friend interval _interval(const l_interval &) noexcept;
208 friend interval & interval::operator =(const l_interval &) noexcept;
209
210 friend inline interval _interval(const real &, const l_real &) noexcept; // Sollte in l_real!!!
211 friend inline interval _interval(const l_real &, const real &) noexcept;
212 friend inline interval _interval(const l_real &) noexcept;
213 friend interval _unchecked_interval(const l_real &, const l_real &) noexcept;
214
215// friend inline l_interval _l_interval(const real & a) noexcept { return l_interval(a); }
216// friend inline l_interval _l_interval(const real & a, const real & b) { return l_interval(a,b); }
217// friend inline l_interval _l_interval(const l_real & a) noexcept { return l_interval(a); }
218// friend inline l_interval _l_interval(const l_real & a,const l_real & b) { return l_interval(a,b); }
219// friend inline l_interval _l_interval(const real & a, const l_real & b) { return l_interval(a,b); }
220// friend inline l_interval _l_interval(const l_real & a, const real & b) { return l_interval(a,b); }
221
222// friend inline l_interval _l_interval(const interval & a) noexcept { return l_interval(a); }
223// friend inline l_interval _l_interval(const dotprecision & a) noexcept { return l_interval(a); }
224// friend inline l_interval _l_interval(const dotprecision & a,const dotprecision & b) { return l_interval(a,b); }
225// friend inline l_interval _l_interval(const idotprecision & a) noexcept { return l_interval(a); }
226
227 friend l_interval _unchecked_l_interval(const l_real &, const l_real &) noexcept;
228 friend idotprecision _idotprecision(const l_interval &) noexcept;
229 friend idotprecision::idotprecision(const l_interval &) noexcept;
230 friend idotprecision & idotprecision::operator =(const l_interval &) noexcept;
231
232 // ---- Ausgabefunkt. ---------------------------------------
234 friend std::istream& operator >> (std::istream& s, l_interval & a) noexcept;
236 friend std::ostream& operator << (std::ostream& s, const l_interval & a) noexcept;
238 friend std::string & operator >> (std::string& s, l_interval & a) noexcept;
240 friend std::string & operator << (std::string& s, const l_interval & a) noexcept;
242 friend void operator >> (const std::string& s,l_interval &a) noexcept;
244 friend void operator >> (const char * s,l_interval &a) noexcept;
245
246 // ---- Standardfunkt ---- (arithmetische Operatoren)
247 // LI
249 friend l_interval operator -(const l_interval &) noexcept;
251 friend inline l_interval operator +(const l_interval &) noexcept;
252
253 // LI-LI
255 friend l_interval operator +(const l_interval &,const l_interval &) noexcept;
257 friend l_interval operator -(const l_interval &,const l_interval &) noexcept;
259 friend l_interval operator *(const l_interval &,const l_interval &) noexcept;
261 friend l_interval operator /(const l_interval &,const l_interval &);
263 friend inline l_interval operator |(const l_interval &,const l_interval &);
265 friend inline l_interval operator &(const l_interval &,const l_interval &);
266
268 friend inline l_interval & operator +=(l_interval &,const l_interval &) noexcept;
270 friend inline l_interval & operator -=(l_interval &,const l_interval &) noexcept;
272 friend inline l_interval & operator *=(l_interval &,const l_interval &) noexcept;
274 friend inline l_interval & operator /=(l_interval &,const l_interval &) noexcept;
276 friend inline l_interval & operator |=(l_interval &,const l_interval &) noexcept;
278 friend inline l_interval & operator &=(l_interval &,const l_interval &);
279
280 // LI-ID
282 friend inline idotprecision operator +(const l_interval &,const idotprecision &) noexcept;
284 friend inline idotprecision operator +(const idotprecision &,const l_interval &) noexcept;
286 friend inline idotprecision operator -(const l_interval &,const idotprecision &) noexcept;
288 friend inline idotprecision operator -(const idotprecision &,const l_interval &) noexcept;
290 friend inline idotprecision operator |(const idotprecision &,const l_interval &) noexcept;
292 friend inline idotprecision operator |(const l_interval &,const idotprecision &) noexcept;
294 friend inline idotprecision operator &(const idotprecision &,const l_interval &);
296 friend inline idotprecision operator &(const l_interval &,const idotprecision &);
297
299 friend inline l_interval & operator |=(l_interval &,const idotprecision &) noexcept;
301 friend inline l_interval & operator &=(l_interval &,const idotprecision &);
302
303 // LI-LR
305 friend inline l_interval operator +(const l_interval &,const l_real &) noexcept;
307 friend inline l_interval operator +(const l_real &,const l_interval &) noexcept;
309 friend inline l_interval operator -(const l_interval &,const l_real &) noexcept;
311 friend inline l_interval operator -(const l_real &,const l_interval &) noexcept;
313 friend inline l_interval operator *(const l_interval &,const l_real &) noexcept;
315 friend inline l_interval operator *(const l_real &,const l_interval &) noexcept;
317 friend inline l_interval operator /(const l_interval &,const l_real &) noexcept;
319 friend inline l_interval operator /(const l_real &,const l_interval &) noexcept;
321 friend inline l_interval operator |(const l_real &,const l_interval &) noexcept;
323 friend inline l_interval operator |(const l_interval &,const l_real &) noexcept;
325 friend inline l_interval operator |(const l_real &,const l_real &) noexcept;
327 friend inline l_interval operator &(const l_real &,const l_interval &);
329 friend inline l_interval operator &(const l_interval &,const l_real &);
330
332 friend inline l_interval & operator +=(l_interval &,const l_real &) noexcept;
334 friend inline l_interval & operator -=(l_interval &,const l_real &) noexcept;
336 friend inline l_interval & operator *=(l_interval &,const l_real &) noexcept;
338 friend inline l_interval & operator /=(l_interval &,const l_real &) noexcept;
340 friend inline l_interval & operator |=(l_interval &,const l_real &) noexcept;
342 friend inline l_interval & operator &=(l_interval &,const l_real &);
343
344 // LI-I
346 friend inline l_interval operator +(const l_interval &,const interval &) noexcept;
348 friend inline l_interval operator +(const interval &,const l_interval &) noexcept;
350 friend inline l_interval operator -(const l_interval &,const interval &) noexcept;
352 friend inline l_interval operator -(const interval &,const l_interval &) noexcept;
354 friend inline l_interval operator *(const l_interval &,const interval &) noexcept;
356 friend inline l_interval operator *(const interval &,const l_interval &) noexcept;
358 friend inline l_interval operator /(const l_interval &,const interval &) noexcept;
360 friend inline l_interval operator /(const interval &,const l_interval &) noexcept;
362 friend inline l_interval operator |(const interval &,const l_interval &) noexcept;
364 friend inline l_interval operator |(const l_interval &,const interval &) noexcept;
366 friend inline l_interval operator &(const interval &,const l_interval &);
368 friend inline l_interval operator &(const l_interval &,const interval &);
369
371 friend inline l_interval & operator +=(l_interval &,const interval &) noexcept;
373 friend inline l_interval & operator -=(l_interval &,const interval &) noexcept;
375 friend inline l_interval & operator *=(l_interval &,const interval &) noexcept;
377 friend inline l_interval & operator /=(l_interval &,const interval &) noexcept;
379 friend inline l_interval & operator |=(l_interval &,const interval &) noexcept;
381 friend inline l_interval & operator &=(l_interval &,const interval &);
382
383 // LI-R
385 friend inline l_interval operator +(const l_interval &,const real &) noexcept;
387 friend inline l_interval operator +(const real &,const l_interval &) noexcept;
389 friend inline l_interval operator -(const l_interval &,const real &) noexcept;
391 friend inline l_interval operator -(const real &,const l_interval &) noexcept;
393 friend inline l_interval operator *(const l_interval &,const real &) noexcept;
395 friend inline l_interval operator *(const real &,const l_interval &) noexcept;
397 friend inline l_interval operator /(const l_interval &,const real &) noexcept;
399 friend inline l_interval operator /(const real &,const l_interval &) noexcept;
401 friend inline l_interval operator |(const real &,const l_interval &) noexcept;
403 friend inline l_interval operator |(const l_interval &,const real &) noexcept;
405 friend inline l_interval operator &(const real &,const l_interval &);
407 friend inline l_interval operator &(const l_interval &,const real &);
408
410 friend inline l_interval & operator +=(l_interval &,const real &) noexcept;
412 friend inline l_interval & operator -=(l_interval &,const real &) noexcept;
414 friend inline l_interval & operator *=(l_interval &,const real &) noexcept;
416 friend inline l_interval & operator /=(l_interval &,const real &) noexcept;
418 friend inline l_interval & operator |=(l_interval &,const real &) noexcept;
420 friend inline l_interval & operator &=(l_interval &,const real &);
421
422 // LR-I
424 friend inline l_interval operator +(const l_real &,const interval &) noexcept;
426 friend inline l_interval operator +(const interval &,const l_real &) noexcept;
428 friend inline l_interval operator -(const l_real &,const interval &) noexcept;
430 friend inline l_interval operator -(const interval &,const l_real &) noexcept;
432 friend inline l_interval operator *(const l_real &,const interval &) noexcept;
434 friend inline l_interval operator *(const interval &,const l_real &) noexcept;
436 friend inline l_interval operator /(const l_real &,const interval &) noexcept;
438 friend inline l_interval operator /(const interval &,const l_real &) noexcept;
440 friend inline l_interval operator |(const interval &,const l_real &) noexcept;
442 friend inline l_interval operator |(const l_real &,const interval &) noexcept;
444 friend inline l_interval operator &(const interval &,const l_real &);
446 friend inline l_interval operator &(const l_real &,const interval &);
447
448 // ---- Vergleichsop. ----
450 friend bool operator !(const l_interval &) noexcept;
451// operator void *(void) noexcept;
452
454 friend bool operator ==(const l_interval &,const l_interval &) noexcept;
456 friend inline bool operator !=(const l_interval &,const l_interval &) noexcept;
457
459 friend inline bool operator ==(const l_real &,const l_interval &) noexcept;
461 friend inline bool operator !=(const l_real &,const l_interval &) noexcept;
463 friend inline bool operator ==(const l_interval &,const l_real &) noexcept;
465 friend inline bool operator !=(const l_interval &,const l_real &) noexcept;
466
468 friend inline bool operator ==(const interval &,const l_interval &) noexcept;
470 friend inline bool operator !=(const interval &,const l_interval &) noexcept;
472 friend inline bool operator ==(const l_interval &,const interval &) noexcept;
474 friend inline bool operator !=(const l_interval &,const interval &) noexcept;
475
477 friend inline bool operator ==(const real &,const l_interval &) noexcept;
479 friend inline bool operator !=(const real &,const l_interval &) noexcept;
481 friend inline bool operator ==(const l_interval &,const real &) noexcept;
483 friend inline bool operator !=(const l_interval &,const real &) noexcept;
484
486 friend inline bool operator ==(const idotprecision &,const l_interval &) noexcept;
488 friend inline bool operator !=(const idotprecision &,const l_interval &) noexcept;
490 friend inline bool operator ==(const l_interval &,const idotprecision &) noexcept;
492 friend inline bool operator !=(const l_interval &,const idotprecision &) noexcept;
493
495 friend inline bool operator ==(const dotprecision &,const l_interval &) noexcept;
497 friend inline bool operator !=(const dotprecision &,const l_interval &) noexcept;
499 friend inline bool operator ==(const l_interval &,const dotprecision &) noexcept;
501 friend inline bool operator !=(const l_interval &,const dotprecision &) noexcept;
502
503 // ---- Mengenvergle. ----
505 friend bool operator <(const l_interval &,const l_interval &) noexcept;
507 friend bool operator >(const l_interval &,const l_interval &) noexcept;
509 friend bool operator <=(const l_interval &,const l_interval &) noexcept;
511 friend bool operator >=(const l_interval &,const l_interval &) noexcept;
512
514 friend inline bool operator <(const l_real &,const l_interval &) noexcept;
516 friend inline bool operator >(const l_real &,const l_interval &) noexcept;
518 friend inline bool operator <=(const l_real &,const l_interval &) noexcept;
520 friend inline bool operator >=(const l_real &,const l_interval &) noexcept;
522 friend inline bool operator <(const l_interval &,const l_real &) noexcept;
524 friend inline bool operator >(const l_interval &,const l_real &) noexcept;
526 friend inline bool operator <=(const l_interval &,const l_real &) noexcept;
528 friend inline bool operator >=(const l_interval &,const l_real &) noexcept;
529
531 friend inline bool operator <(const interval &,const l_interval &) noexcept;
533 friend inline bool operator >(const interval &,const l_interval &) noexcept;
535 friend inline bool operator <=(const interval &,const l_interval &) noexcept;
537 friend inline bool operator >=(const interval &,const l_interval &) noexcept;
539 friend inline bool operator <(const l_interval &,const interval &) noexcept;
541 friend inline bool operator >(const l_interval &,const interval &) noexcept;
543 friend inline bool operator <=(const l_interval &,const interval &) noexcept;
545 friend inline bool operator >=(const l_interval &,const interval &) noexcept;
546
548 friend inline bool operator <(const real &,const l_interval &) noexcept;
550 friend inline bool operator >(const real &,const l_interval &) noexcept;
552 friend inline bool operator <=(const real &,const l_interval &) noexcept;
554 friend inline bool operator >=(const real &,const l_interval &) noexcept;
556 friend inline bool operator <(const l_interval &,const real &) noexcept;
558 friend inline bool operator >(const l_interval &,const real &) noexcept;
560 friend inline bool operator <=(const l_interval &,const real &) noexcept;
562 friend inline bool operator >=(const l_interval &,const real &) noexcept;
563
565 friend inline bool operator <(const idotprecision &,const l_interval &) noexcept;
567 friend inline bool operator >(const idotprecision &,const l_interval &) noexcept;
569 friend inline bool operator <=(const idotprecision &,const l_interval &) noexcept;
571 friend inline bool operator >=(const idotprecision &,const l_interval &) noexcept;
573 friend inline bool operator <(const l_interval &,const idotprecision &) noexcept;
575 friend inline bool operator >(const l_interval &,const idotprecision &) noexcept;
577 friend inline bool operator <=(const l_interval &,const idotprecision &) noexcept;
579 friend inline bool operator >=(const l_interval &,const idotprecision &) noexcept;
580
582 friend inline bool operator <(const dotprecision &,const l_interval &) noexcept;
584 friend inline bool operator >(const dotprecision &,const l_interval &) noexcept;
586 friend inline bool operator <=(const dotprecision &,const l_interval &) noexcept;
588 friend inline bool operator >=(const dotprecision &,const l_interval &) noexcept;
590 friend inline bool operator <(const l_interval &,const dotprecision &) noexcept;
592 friend inline bool operator >(const l_interval &,const dotprecision &) noexcept;
594 friend inline bool operator <=(const l_interval &,const dotprecision &) noexcept;
596 friend inline bool operator >=(const l_interval &,const dotprecision &) noexcept;
597
598 // ---- Funktionen ----
599
600// friend inline l_interval_Inf Inf (l_interval &) noexcept;
601// friend inline l_interval_Sup Sup (l_interval &) noexcept;
603 friend inline l_real Inf (const l_interval &) noexcept;
605 friend inline l_real Sup (const l_interval &) noexcept;
606
608 friend inline int expo_sm(const l_interval&);
609 // Calculating expo(x[k]) of the smallest |x[k]|<>0.
610
612 friend inline int expo_gr(const l_interval&);
613 // Calculating expo(x[k]) of the greatest |x[k]|.
614
616 friend inline int StagPrec(const l_interval &) noexcept;
617
619 friend inline l_interval & SetInf (l_interval & a, const l_real & b) ;
621 friend inline l_interval & SetSup (l_interval & a, const l_real & b);
623 friend inline l_interval & SetInf (l_interval & a, const real & b) ;
625 friend inline l_interval & SetSup (l_interval & a, const real & b);
627 friend inline l_interval adjust (const l_interval &) noexcept;
628
630 friend inline l_interval & UncheckedSetInf (l_interval & a, const l_real & b) noexcept;
632 friend inline l_interval & UncheckedSetSup (l_interval & a, const l_real & b) noexcept;
634 friend inline l_interval & UncheckedSetInf (l_interval & a, const real & b) noexcept;
636 friend inline l_interval & UncheckedSetSup (l_interval & a, const real & b) noexcept;
637
639 friend void ConvexHull(const l_interval &, const l_interval &, l_interval &, l_interval &) noexcept;
641 friend void Intersection(const l_interval &, const l_interval &, l_interval &, l_interval &);
642
644 friend inline l_interval abs (const l_interval & a) noexcept;
646 friend l_real mid (const l_interval & a) noexcept;
648 friend inline l_real diam (const l_interval & a) noexcept;
649
651 friend l_interval pow(const l_interval &, const l_interval &); // Pow(x,y)
653 friend l_interval power(const l_interval &, int); // Power(x,n)
655 friend l_interval sqr(const l_interval &); // Sqr(x)
656
658 friend l_interval sqrt(const l_interval &); // Sqrt(x)
660 friend l_interval sqrt(const l_interval &, int); // NSqrt(n,x)
661
663 friend l_interval sin(const l_interval &); // Sin(x)
665 friend l_interval cos(const l_interval &); // Cos(x)
667 friend l_interval tan(const l_interval &); // Tan(x)
669 friend l_interval cot(const l_interval &); // Cot(x)
670
672 friend l_interval asin(const l_interval &); // ASin(x)
674 friend l_interval acos(const l_interval &); // ACos(x)
676 friend l_interval atan(const l_interval &) noexcept; // ATan(x)
678 friend l_interval acot(const l_interval &) noexcept; // ACot(x)
679
681 friend l_interval exp(const l_interval &); // Exp(x)
683 friend l_interval exp2(const l_interval &); // 2^x
685 friend l_interval exp10(const l_interval &); // 10^x
687 friend l_interval ln(const l_interval &); // Ln(x)
689 friend l_interval log2(const l_interval &);
691 friend l_interval log10(const l_interval &);
693 friend l_interval sinh(const l_interval &); // Sinh(x)
695 friend l_interval cosh(const l_interval &); // Cosh(x)
697 friend l_interval tanh(const l_interval &) noexcept; // Tanh(x)
699 friend l_interval coth(const l_interval &) noexcept; // Coth(x)
700
702 friend l_interval asinh(const l_interval &); // ASinh(x)
704 friend l_interval acosh(const l_interval &) noexcept; // ACosh(x)
706 friend l_interval atanh(const l_interval &); // ATanh(x)
708 friend l_interval acoth(const l_interval &); // ACoth(x)
709
711 friend l_interval Ln2_l_interval() noexcept; // ln(2)
713 friend l_interval Ln10_l_interval() noexcept; // ln(10)
715 friend l_interval Ln10r_l_interval() noexcept; // 1/ln(10)
717 friend l_interval Pid4_l_interval() noexcept; // Pi/4
719 friend l_interval Sqrt2_l_interval() noexcept; // sqrt(2)
721 friend l_interval Sqrt5_l_interval() noexcept; // sqrt(5)
723 friend l_interval Sqrt7_l_interval() noexcept; // sqrt(7)
724
725 // obsolete, see also l_imath.hpp and l_imath.cpp
727 friend inline l_interval li_ln2(); // ln(2)
729 friend inline l_interval li_ln10(); // ln(10)
731 friend inline l_interval li_Rln10(); // 1/ln(10)
733 friend inline l_interval li_pi4(); // Pi/4
735 friend inline l_interval li_sqrt2(); // sqrt(2)
736
738 friend l_interval Ln2r_l_interval() noexcept; // 1/ln(2)
740 friend l_interval Pi_l_interval() noexcept; // Pi
742 friend l_interval Pid2_l_interval() noexcept; // Pi/2
744 friend l_interval Pi2_l_interval() noexcept; // 2*Pi
746 friend l_interval Pid3_l_interval() noexcept; // Pi/3
748 friend l_interval Pir_l_interval() noexcept; // 1/Pi
750 friend l_interval Pi2r_l_interval() noexcept; // 1/(2*Pi)
752 friend l_interval SqrtPi_l_interval() noexcept; // sqrt(Pi)
754 friend l_interval Sqrt2Pi_l_interval() noexcept; // sqrt(2*Pi)
756 friend l_interval SqrtPir_l_interval() noexcept; // 1/sqrt(Pi)
758 friend l_interval Sqrt2Pir_l_interval() noexcept; // 1/sqrt(2*Pi)
760 friend l_interval Pip2_l_interval() noexcept; // Pi^2
762 friend l_interval Sqrt2r_l_interval() noexcept; // 1/sqrt(2)
764 friend l_interval Sqrt3_l_interval() noexcept; // sqrt(3)
766 friend l_interval Sqrt3d2_l_interval() noexcept; // sqrt(3)/2
768 friend l_interval Sqrt3r_l_interval() noexcept; // 1/sqrt(3)
770 friend l_interval LnPi_l_interval() noexcept; // ln(Pi)
772 friend l_interval Ln2Pi_l_interval() noexcept; // ln(2*Pi)
774 friend l_interval E_l_interval() noexcept; // e = exp(1)
776 friend l_interval Er_l_interval() noexcept; // 1/e
778 friend l_interval Ep2_l_interval() noexcept; // e^2
780 friend l_interval Ep2r_l_interval() noexcept; // 1/e^2
782 friend l_interval EpPi_l_interval() noexcept; // e^Pi
784 friend l_interval Ep2Pi_l_interval() noexcept; // e^(2*Pi)
786 friend l_interval EpPid2_l_interval() noexcept; // e^(Pi/2)
788 friend l_interval EpPid4_l_interval() noexcept; // e^(Pi/4)
790 friend l_interval EulerGa_l_interval() noexcept; // EulerGamma
792 friend l_interval Catalan_l_interval() noexcept; // Catalan
793
794 // Operatoren: l/real op idotprecision
795 //
796 // friend inline void accumulate(idotprecision &, const real &, const l_real &) noexcept;
797 // friend inline void accumulate(idotprecision &, const l_real &, const real &) noexcept;
798
799 // Operatoren: l_real op idotprecision
800 //
801 // friend inline void accumulate(idotprecision &, const l_real &, const l_real &) noexcept;
802
803 // Operatoren: real, l_interval op idotprecision
804 //
806 friend inline void accumulate(idotprecision &, const real &, const l_interval &) noexcept;
808 friend inline void accumulate(idotprecision &, const l_interval &, const real &) noexcept;
809
810 // Operatoren: interval, l_real op idotprecision
811 //
813 friend inline void accumulate(idotprecision &, const interval &, const l_real &) noexcept;
815 friend inline void accumulate(idotprecision &, const l_real &, const interval &) noexcept;
816
817 // Operatoren: l_interval, l_real op idotprecision
818 //
820 friend inline void accumulate(idotprecision &, const l_interval &, const l_real &) noexcept;
822 friend inline void accumulate(idotprecision &, const l_real &, const l_interval &) noexcept;
823
824 // Operatoren: l_interval, interval op idotprecision
825 //
827 friend inline void accumulate(idotprecision &, const l_interval &, const interval &) noexcept;
829 friend inline void accumulate(idotprecision &, const interval &, const l_interval &) noexcept;
830
831 // Operatoren: l_interval op idotprecision
832 //
834 friend void accumulate(idotprecision &, const l_interval &, const l_interval &) noexcept;
835
837 friend inline bool point_intv(const l_interval &); // bool delivers: a is a point interval;
839 friend inline bool zero_(const l_interval& ) noexcept; // Blomquist,27.11.02
841 friend void times2pown(l_interval&, int) noexcept; // Blomquist,28.11.02
843 friend void Times2pown(l_interval&, const real&) noexcept;
844 friend void l_realz2l_interval(const l_real&, const interval&,
845 l_interval&) noexcept; // Blomquist,28.11.02
846
847#if (CXSC_INDEX_CHECK)
849 inline real & operator [](int);
850#else
852 inline real & operator [](int) noexcept;
853#endif
854
855 private:
856#if (CXSC_INDEX_CHECK)
857 inline void _allo(int);
858#else
859 inline void _allo(int) noexcept;
860#endif
861 inline void _clear(int) noexcept;
862 void _akku_out(idotprecision&) noexcept;
863 void _akku_out_inn(idotprecision&) noexcept;
864 void _akku_add(idotprecision &) const noexcept;
865 void _akku_sub(idotprecision &) const noexcept;
866 //void _create_l_interval(l_real &, l_real &);
867 inline real & elem(int i) { return data[i-1]; }
868 inline real elem(int i) const { return data[i-1]; }
869
870};
871
872interval _unchecked_interval(const l_real &, const l_real &) noexcept;
873
879inline l_interval _l_interval(const real & a) noexcept { return l_interval(a); }
885inline l_interval _l_interval(const real & a, const real & b) { return l_interval(a,b); }
891inline l_interval _l_interval(const l_real & a) noexcept { return l_interval(a); }
897inline l_interval _l_interval(const l_real & a,const l_real & b) { return l_interval(a,b); }
903inline l_interval _l_interval(const real & a, const l_real & b) { return l_interval(a,b); }
909inline l_interval _l_interval(const l_real & a, const real & b) { return l_interval(a,b); }
910
916inline l_interval _l_interval(const interval & a) noexcept { return l_interval(a); }
922inline l_interval _l_interval(const dotprecision & a) noexcept { return l_interval(a); }
928inline l_interval _l_interval(const dotprecision & a,const dotprecision & b) { return l_interval(a,b); }
934inline l_interval _l_interval(const idotprecision & a) noexcept { return l_interval(a); }
935l_interval _unchecked_l_interval(const l_real &, const l_real &) noexcept;
936
937//inline l_interval_Inf Inf (l_interval &) noexcept;
938//inline l_interval_Sup Sup (l_interval &) noexcept;
939inline l_real Inf (const l_interval &) noexcept;
940inline l_real Sup (const l_interval &) noexcept;
941
942int in ( const real& x, const l_interval& y ); // Contained-in relation
943int in ( const l_real& x, const l_interval& y ); // Contained-in relation
944int in ( const interval& x, const l_interval& y ); // Contained-in relation
945int in ( const l_interval& x, const l_interval& y ); // Contained-in relation
946l_interval Blow (const l_interval& x, const real& eps );
947int Disjoint (const l_interval& a, const l_interval& b ); // Test for disjointedness
948l_real AbsMin ( const l_interval& x ); // Absolute minimum of
949 // an interval
950l_real AbsMax (const l_interval& x ); // Absolute maximum of
951 // an interval
952l_real RelDiam ( const l_interval x ); // Relative diameter
953 // of an interval
954inline bool point_intv(const l_interval &a ); // bool delivers: a is a point interval;
955
956void times2pown(l_interval&, int) noexcept; // Blomquist,28.11.02
957void Times2pown(l_interval&, const real&) noexcept;
958
960
964{
965 private:
966 l_interval & my_l_interval;
967 public:
968 // l_interval_Inf(const l_interval_Inf &a) noexcept : my_l_interval(a.my_l_interval) {}
970 l_interval_Inf(l_interval &a) noexcept : my_l_interval(a) {}
971 operator l_real(void) const { return Inf((const l_interval)my_l_interval); }
973 l_interval & operator =(const l_real & a) { SetInf(my_l_interval,a); return my_l_interval; }
975 l_interval & operator =(const real & a) { SetInf(my_l_interval,_l_real(a)); return my_l_interval; }
976 // l_interval & operator =(int a) { SetInf(my_l_interval,_l_real(a)); return my_l_interval; }
977};
979
983{
984 private:
985 l_interval & my_l_interval;
986 public:
988 l_interval_Sup(l_interval &a) noexcept : my_l_interval(a) {}
989 operator l_real(void) const { return Sup((const l_interval)my_l_interval); }
991 l_interval & operator =(const l_real & a) { SetSup(my_l_interval,a); return my_l_interval; }
993 l_interval & operator =(const real & a) { SetSup(my_l_interval,_l_real(a)); return my_l_interval; }
994 // l_interval & operator =(int a) { SetSup(my_l_interval,_l_real(a)); return my_l_interval; }
995};
996
997} // namespace cxsc
998
999#include "l_interval.inl"
1000
1001#endif // _CXSC_L_INTERVAL_HPP_INCLUDED
The Data Type dotprecision.
Definition dot.hpp:112
The Data Type idotprecision.
Definition idot.hpp:48
The Scalar Type interval.
Definition interval.hpp:55
The Multiple-Precision Data Type l_imatrix_slice.
The Multiple-Precision Data Type l_imatrix.
The Multiple-Precision Data Type l_interval_Inf.
l_interval_Inf(l_interval &a) noexcept
Constructor of class l_interval_Inf.
l_interval & operator=(const l_real &a)
Implementation of standard assigning operator.
The Multiple-Precision Data Type l_interval_Sup.
l_interval_Sup(l_interval &a) noexcept
Constructor of class l_interval_Sup.
l_interval & operator=(const l_real &a)
Implementation of standard assigning operator.
The Multiple-Precision Data Type l_interval.
friend l_interval Pip2_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2159
friend l_interval coth(const l_interval &) noexcept
Calculates .
Definition l_imath.cpp:4234
friend l_interval Pid4_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1065
real & operator[](int) noexcept
Access to the single components used to store the long data type value.
friend l_interval SqrtPi_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1863
friend l_interval Ln2Pi_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2603
friend l_interval Ln2_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:854
friend l_interval exp2(const l_interval &)
Calculates .
Definition l_imath.cpp:3640
friend l_interval Ep2Pi_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:3047
friend l_interval Ln10_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:925
friend l_interval Catalan_l_interval() noexcept
Enclosure-Interval for Catalan Numbers.
Definition l_imath.cpp:3343
friend l_interval sin(const l_interval &)
Calculates .
Definition l_imath.cpp:397
friend l_interval Er_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2751
friend l_interval Sqrt2_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1135
friend l_interval acot(const l_interval &) noexcept
Calculates .
Definition l_imath.cpp:3510
friend l_interval LnPi_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2529
friend l_interval EpPi_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2973
friend l_interval Ln2r_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1349
friend l_interval cos(const l_interval &)
Calculates .
Definition l_imath.cpp:441
friend l_interval Ep2_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2825
friend l_interval & SetInf(l_interval &a, const l_real &b)
Returns the interval with the new given infimum value.
friend l_interval adjust(const l_interval &) noexcept
Sets the precision of a specific long datatype value.
friend l_interval abs(const l_interval &a) noexcept
Returns the absolute value of the interval.
friend l_interval exp10(const l_interval &)
Calculates .
Definition l_imath.cpp:3656
friend l_interval li_ln2()
Enclosure-Interval for .
Definition l_imath.hpp:157
friend l_interval tan(const l_interval &)
Calculates .
Definition l_imath.cpp:613
friend l_interval Sqrt2r_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2233
friend l_interval li_ln10()
Enclosure-Interval for .
Definition l_imath.hpp:159
friend l_interval acosh(const l_interval &) noexcept
Calculates .
Definition l_imath.cpp:4295
friend l_interval log2(const l_interval &)
Calculates .
Definition l_imath.cpp:3944
friend l_interval li_pi4()
Enclosure-Interval for .
Definition l_imath.hpp:163
friend l_interval & UncheckedSetInf(l_interval &a, const l_real &b) noexcept
Returns the interval with the unchecked new given infimum value.
friend l_interval Sqrt2Pi_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1937
friend interval _l_interval(const l_ivector_slice &) noexcept
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
friend l_interval sqrt(const l_interval &)
Calculates .
Definition l_imath.cpp:176
friend bool point_intv(const l_interval &)
Checks if the argument is a point interval.
friend void Times2pown(l_interval &, const real &) noexcept
Multiplication of interval with .
friend bool zero_(const l_interval &) noexcept
Checks if the argument is zero.
friend void Intersection(const l_interval &, const l_interval &, l_interval &, l_interval &)
Allocates the intersection of the arguments to the first argument.
friend l_interval Pir_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1716
friend l_interval asinh(const l_interval &)
Calculates .
Definition l_imath.cpp:4332
friend l_interval & SetSup(l_interval &a, const l_real &b)
Returns the interval with the new given supremum value.
friend l_interval Sqrt7_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1276
friend interval _l_interval(const l_imatrix &m) noexcept
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
friend void accumulate(idotprecision &, const real &, const l_interval &) noexcept
The accurate scalar product of the last two arguments added to the value of the first argument.
friend l_interval sqr(const l_interval &)
Calculates .
Definition l_imath.cpp:153
friend l_interval power(const l_interval &, int)
Calculates .
Definition l_imath.cpp:91
l_interval() noexcept
Constructor of class l_interval.
friend l_real Sup(const l_interval &) noexcept
Returns the supremum of an interval.
friend l_real Inf(const l_interval &) noexcept
Returns the infimum of an interval.
friend l_interval Pi2r_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1789
friend l_interval Sqrt3_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2307
friend void times2pown(l_interval &, int) noexcept
Multiplication of interval with .
l_interval(const l_imatrix_slice &m) noexcept
Constructor of class l_interval.
friend l_interval SqrtPir_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2011
friend l_interval cot(const l_interval &)
Calculates .
Definition l_imath.cpp:657
friend l_interval pow(const l_interval &, const l_interval &)
Calculates .
Definition l_imath.cpp:37
friend l_interval sinh(const l_interval &)
Calculates .
Definition l_imath.cpp:3976
friend l_interval Pid3_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1642
friend l_real diam(const l_interval &a) noexcept
Returns the rounded diameter of the interval.
friend void ConvexHull(const l_interval &, const l_interval &, l_interval &, l_interval &) noexcept
Allocates the convex hull of the arguments to the first argument.
friend l_interval Pid2_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1496
friend l_interval Sqrt5_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1204
friend l_interval cosh(const l_interval &)
Calculates .
Definition l_imath.cpp:4111
friend l_interval EulerGa_l_interval() noexcept
Enclosure-Interval for Euler Gamma.
Definition l_imath.cpp:3269
friend interval _l_interval(const l_imatrix_slice &m) noexcept
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
friend l_interval Sqrt2Pir_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2085
friend l_interval & UncheckedSetSup(l_interval &a, const l_real &b) noexcept
Returns the interval with the unchecked new given supremum value.
friend l_real mid(const l_interval &a) noexcept
Returns the rounded middle of the interval.
friend l_interval li_sqrt2()
Enclosure-Interval for .
Definition l_imath.hpp:165
friend l_interval atanh(const l_interval &)
Calculates .
Definition l_imath.cpp:4391
friend l_interval Sqrt3d2_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2381
friend l_interval li_Rln10()
Enclosure-Interval for .
Definition l_imath.hpp:161
friend int expo_sm(const l_interval &)
Returns the minimum of the expo-function.
friend l_interval Ep2r_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2899
friend l_interval acos(const l_interval &)
Calculates .
Definition l_imath.cpp:767
friend l_interval E_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2677
friend l_interval acoth(const l_interval &)
Calculates .
Definition l_imath.cpp:4432
friend l_interval exp(const l_interval &)
Calculates .
Definition l_imath.cpp:3538
friend l_interval EpPid4_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:3195
friend l_interval EpPid2_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:3121
friend l_interval atan(const l_interval &) noexcept
Calculates .
Definition l_imath.cpp:3412
friend l_interval Pi2_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1569
friend l_interval log10(const l_interval &)
Calculates .
Definition l_imath.cpp:3960
friend l_interval Ln10r_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:995
friend l_interval Pi_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:1423
friend l_interval asin(const l_interval &)
Calculates .
Definition l_imath.cpp:705
friend int StagPrec(const l_interval &) noexcept
Returns the precision of the long datatype value.
friend interval _l_interval(const l_ivector &) noexcept
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
friend int expo_gr(const l_interval &)
Returns the maximum of the expo-function.
friend l_interval tanh(const l_interval &) noexcept
Calculates .
Definition l_imath.cpp:4161
friend l_interval ln(const l_interval &)
Calculates .
Definition l_imath.cpp:3760
friend l_interval Sqrt3r_l_interval() noexcept
Enclosure-Interval for .
Definition l_imath.cpp:2455
The Multiple-Precision Data Type l_ivector_slice.
The Multiple-Precision Data Type l_ivector.
Definition l_ivector.hpp:55
The Multiple-Precision Data Type l_real.
Definition l_real.hpp:78
The Scalar Type real.
Definition real.hpp:114
The namespace cxsc, providing all functionality of the class library C-XSC.
Definition cdot.cpp:29
int Disjoint(const interval &a, const interval &b)
Checks arguments for disjointness.
Definition interval.cpp:288
l_interval _l_interval(const real &a) noexcept
real RelDiam(const interval &x)
Computes the relative diameter .
Definition interval.cpp:316
int in(const cinterval &x, const cinterval &y)
Checks if first argument is part of second argument.
interval _unchecked_interval(const real &a, const real &b)
Definition interval.inl:66
real AbsMax(const interval &x)
Computes the greatest absolute value .
Definition interval.cpp:303
void times2pown(cinterval &x, int n) noexcept
Fast multiplication of reference parameter [z] with .
Definition cimath.cpp:2059
cinterval Blow(cinterval x, const real &eps)
Performs an epsilon inflation.
real AbsMin(const interval &x)
Computes the smallest absolute value .
Definition interval.cpp:293