C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
l_interval.hpp
00001 /*
00002 **  CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
00003 **
00004 **  Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
00005 **                          Universitaet Karlsruhe, Germany
00006 **            (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
00007 **                          Universitaet Wuppertal, Germany   
00008 **
00009 **  This library is free software; you can redistribute it and/or
00010 **  modify it under the terms of the GNU Library General Public
00011 **  License as published by the Free Software Foundation; either
00012 **  version 2 of the License, or (at your option) any later version.
00013 **
00014 **  This library is distributed in the hope that it will be useful,
00015 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 **  Library General Public License for more details.
00018 **
00019 **  You should have received a copy of the GNU Library General Public
00020 **  License along with this library; if not, write to the Free
00021 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 */
00023 
00024 /* CVS $Id: l_interval.hpp,v 1.36 2014/01/30 17:23:46 cxsc Exp $ */
00025 
00026 #ifndef _CXSC_L_INTERVAL_HPP_INCLUDED
00027 #define _CXSC_L_INTERVAL_HPP_INCLUDED
00028 
00029 #include <iostream>
00030 #include <string>
00031 #include "real.hpp"
00032 #include "interval.hpp"
00033 #include "l_real.hpp"
00034 #include "except.hpp"
00035 #include "idot.hpp"
00036 
00037 namespace cxsc {
00038 
00039 class l_interval_Inf;
00040 class l_interval_Sup;
00041 
00043 
00071 class l_interval
00072 {
00073       friend class l_interval_Inf;
00074       friend class l_interval_Sup;
00075    
00076    private:
00077       // ---- Datenelemente ---------------------------------------
00078 
00079          // die eigentliche Datenstruktur
00080          // ein l_interval der Praezision n besteht aus n+1 reals , wobei die reals
00081          // 1..n das inf,
00082          // 1..n-1,n+1 das sup darstellen!
00083          // Ein echtes interval liegt also nur in den letzten beiden reals vor!
00084       int prec;
00085       real *data;
00086   
00087 
00088    public:
00089       // ---- Konstruktoren ---------------------------------------
00090 #if (CXSC_INDEX_CHECK)
00091 
00092       inline l_interval()                              throw(ERROR_LINTERVAL_WRONG_STAGPREC);
00094       inline l_interval(const l_interval &)            throw(ERROR_LINTERVAL_WRONG_STAGPREC); 
00095 
00097              l_interval(const l_real &, const l_real &) throw(ERROR_LINTERVAL_WRONG_STAGPREC,ERROR_LINTERVAL_EMPTY_INTERVAL);
00099              l_interval(const real &, const l_real &)   throw(ERROR_LINTERVAL_WRONG_STAGPREC,ERROR_LINTERVAL_EMPTY_INTERVAL);
00101              l_interval(const l_real &, const real &)   throw(ERROR_LINTERVAL_WRONG_STAGPREC,ERROR_LINTERVAL_EMPTY_INTERVAL);
00103       inline l_interval(const real &, const real &)     throw(ERROR_LINTERVAL_WRONG_STAGPREC,ERROR_LINTERVAL_EMPTY_INTERVAL);
00104 
00106       explicit        l_interval(const dotprecision &) throw(ERROR_LINTERVAL_WRONG_STAGPREC);
00108       explicit        l_interval(const dotprecision &,const dotprecision &) throw(ERROR_LINTERVAL_WRONG_STAGPREC,ERROR_LINTERVAL_EMPTY_INTERVAL);
00110       explicit        l_interval(const idotprecision &) throw(ERROR_LINTERVAL_WRONG_STAGPREC);
00111 #else
00112 
00113       inline l_interval()                              throw();
00115       inline l_interval(const l_interval &)            throw(); 
00116 
00118       l_interval(const l_real &, const l_real &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00120       l_interval(const real &, const l_real &)   throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00122       l_interval(const l_real &, const real &)   throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00124       l_interval(const real &, const real &)     throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00125 
00127       explicit        l_interval(const dotprecision &) throw();
00129       explicit        l_interval(const dotprecision &,const dotprecision &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00131       explicit        l_interval(const idotprecision &) throw();
00132 #endif 
00133 
00135       explicit inline l_interval(const real &) throw();
00137       explicit inline l_interval(const l_real &) throw();
00138 
00139 #if(CXSC_INDEX_CHECK)
00140 
00141       explicit INLINE l_interval(const l_ivector &) throw(ERROR_LIVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_LIVECTOR_USE_OF_UNINITIALIZED_OBJ);      
00143       explicit INLINE l_interval(const l_ivector_slice &) throw(ERROR_LIVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_LIVECTOR_USE_OF_UNINITIALIZED_OBJ);      
00145       explicit INLINE l_interval(const l_imatrix &m) throw(ERROR_LIMATRIX_TYPE_CAST_OF_THICK_OBJ,ERROR_LIMATRIX_USE_OF_UNINITIALIZED_OBJ);
00147       explicit INLINE l_interval(const l_imatrix_slice &m) throw(ERROR_LIMATRIX_TYPE_CAST_OF_THICK_OBJ,ERROR_LIMATRIX_USE_OF_UNINITIALIZED_OBJ);
00149       friend INLINE interval _l_interval(const l_ivector &) throw(ERROR_LIVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_LIVECTOR_USE_OF_UNINITIALIZED_OBJ);      
00151       friend INLINE interval _l_interval(const l_ivector_slice &) throw(ERROR_LIVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_LIVECTOR_USE_OF_UNINITIALIZED_OBJ);      
00153       friend INLINE interval _l_interval(const l_imatrix &m) throw(ERROR_LIMATRIX_TYPE_CAST_OF_THICK_OBJ,ERROR_LIMATRIX_USE_OF_UNINITIALIZED_OBJ);
00155       friend INLINE interval _l_interval(const l_imatrix_slice &m) throw(ERROR_LIMATRIX_TYPE_CAST_OF_THICK_OBJ,ERROR_LIMATRIX_USE_OF_UNINITIALIZED_OBJ);
00156 #else
00157 
00158       explicit INLINE l_interval(const l_ivector &) throw();
00160       explicit INLINE l_interval(const l_ivector_slice &) throw();
00162       explicit INLINE l_interval(const l_imatrix &m) throw();
00164       explicit INLINE l_interval(const l_imatrix_slice &m) throw();
00166       friend INLINE interval _l_interval(const l_ivector &) throw();
00168       friend INLINE interval _l_interval(const l_ivector_slice &) throw();
00170       friend INLINE interval _l_interval(const l_imatrix &m) throw();
00172       friend INLINE interval _l_interval(const l_imatrix_slice &m) throw();
00173 #endif
00174 
00175 
00176 
00178       inline l_interval & operator= (const real & a)    throw();
00180       inline l_interval & operator= (const l_real &a)  throw();
00182       inline l_interval & operator= (const interval & a)throw();
00184              l_interval & operator= (const l_interval &a)throw();
00186              l_interval& operator = (const lx_interval&) throw();
00187 #if (CXSC_INDEX_CHECK)
00188 
00189              l_interval & operator= (const dotprecision &a) throw(ERROR_LINTERVAL_WRONG_STAGPREC);
00191              l_interval & operator= (const idotprecision &) throw(ERROR_LINTERVAL_WRONG_STAGPREC);
00192 #else
00193 
00194              l_interval & operator= (const dotprecision &a) throw();
00196              l_interval & operator= (const idotprecision &) throw();
00197 #endif             
00198 
00199       // ---- Destruktor    ----
00200       inline ~l_interval() throw();
00201 
00202       // ---- Typwandlungen ----
00204       explicit inline l_interval(const interval &) throw();
00205 
00206       friend        interval::interval(const l_interval &) throw();
00207       friend        interval _interval(const l_interval &) throw();
00208       friend interval & interval::operator =(const l_interval &) throw();
00209             
00210       friend inline interval _interval(const real &, const l_real &) throw(); // Sollte in l_real!!!
00211       friend inline interval _interval(const l_real &, const real &) throw();
00212       friend inline interval _interval(const l_real &) throw();
00213       friend        interval _unchecked_interval(const l_real &, const l_real &) throw();
00214 
00215 //      friend inline l_interval _l_interval(const real & a) throw() { return l_interval(a); }
00216 //      friend inline l_interval _l_interval(const real & a, const real & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL) { return l_interval(a,b); }
00217 //      friend inline l_interval _l_interval(const l_real & a) throw() { return l_interval(a); }
00218 //      friend inline l_interval _l_interval(const l_real & a,const l_real & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL) { return l_interval(a,b); }
00219 //      friend inline l_interval _l_interval(const real & a, const l_real & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL) { return l_interval(a,b); }
00220 //      friend inline l_interval _l_interval(const l_real & a, const real & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL) { return l_interval(a,b); }
00221 
00222 //      friend inline l_interval _l_interval(const interval & a) throw() { return l_interval(a); }
00223 //      friend inline l_interval _l_interval(const dotprecision & a) throw() { return l_interval(a); }
00224 //      friend inline l_interval _l_interval(const dotprecision & a,const dotprecision & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL) { return l_interval(a,b); }
00225 //      friend inline l_interval _l_interval(const idotprecision & a) throw() { return l_interval(a); }
00226 
00227       friend        l_interval _unchecked_l_interval(const l_real &, const l_real &) throw();      
00228       friend        idotprecision _idotprecision(const l_interval &) throw();
00229       friend        idotprecision::idotprecision(const l_interval &) throw();
00230       friend idotprecision & idotprecision::operator =(const l_interval &) throw();
00231       
00232       // ---- Ausgabefunkt. ---------------------------------------
00234       friend std::istream& operator >> (std::istream& s, l_interval & a)       throw();
00236       friend std::ostream& operator << (std::ostream& s, const l_interval & a) throw();
00238       friend std::string & operator >> (std::string&  s, l_interval & a)       throw();
00240       friend std::string & operator << (std::string&  s, const l_interval & a) throw();
00242       friend void          operator >> (const std::string& s,l_interval &a)   throw();
00244       friend void          operator >> (const char *       s,l_interval &a)   throw();      
00245 
00246       // ---- Standardfunkt ---- (arithmetische Operatoren)
00247       // LI
00249       friend        l_interval operator -(const l_interval &) throw();
00251       friend inline l_interval operator +(const l_interval &) throw();
00252 
00253       // LI-LI
00255       friend l_interval operator +(const l_interval &,const l_interval &) throw();
00257       friend l_interval operator -(const l_interval &,const l_interval &) throw();
00259       friend l_interval operator *(const l_interval &,const l_interval &) throw();
00261       friend l_interval operator /(const l_interval &,const l_interval &) throw(ERROR_LINTERVAL_DIV_BY_ZERO);
00263       friend inline l_interval operator |(const l_interval &,const l_interval &) throw(ERROR_LINTERVAL_IN_EXACT_CH_OR_IS);
00265       friend inline l_interval operator &(const l_interval &,const l_interval &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL,ERROR_LINTERVAL_IN_EXACT_CH_OR_IS);
00266 
00268       friend inline l_interval & operator +=(l_interval &,const l_interval &) throw();
00270       friend inline l_interval & operator -=(l_interval &,const l_interval &) throw();
00272       friend inline l_interval & operator *=(l_interval &,const l_interval &) throw();
00274       friend inline l_interval & operator /=(l_interval &,const l_interval &) throw();
00276       friend inline l_interval & operator |=(l_interval &,const l_interval &) throw();
00278       friend inline l_interval & operator &=(l_interval &,const l_interval &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00279 
00280       // LI-ID
00282       friend inline idotprecision operator +(const l_interval &,const idotprecision &) throw();
00284       friend inline idotprecision operator +(const idotprecision &,const l_interval &) throw();
00286       friend inline idotprecision operator -(const l_interval &,const idotprecision &) throw();
00288       friend inline idotprecision operator -(const idotprecision &,const l_interval &) throw();
00290       friend inline idotprecision operator |(const idotprecision &,const l_interval &) throw();
00292       friend inline idotprecision operator |(const l_interval &,const idotprecision &) throw();
00294       friend inline idotprecision operator &(const idotprecision &,const l_interval &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00296       friend inline idotprecision operator &(const l_interval &,const idotprecision &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00297 
00299       friend inline l_interval & operator |=(l_interval &,const idotprecision &) throw();
00301       friend inline l_interval & operator &=(l_interval &,const idotprecision &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00302  
00303       // LI-LR
00305       friend inline l_interval operator +(const l_interval &,const l_real &) throw();
00307       friend inline l_interval operator +(const l_real &,const l_interval &) throw();
00309       friend inline l_interval operator -(const l_interval &,const l_real &) throw();
00311       friend inline l_interval operator -(const l_real &,const l_interval &) throw();
00313       friend inline l_interval operator *(const l_interval &,const l_real &) throw();
00315       friend inline l_interval operator *(const l_real &,const l_interval &) throw();
00317       friend inline l_interval operator /(const l_interval &,const l_real &) throw();
00319       friend inline l_interval operator /(const l_real &,const l_interval &) throw();
00321       friend inline l_interval operator |(const l_real &,const l_interval &) throw();
00323       friend inline l_interval operator |(const l_interval &,const l_real &) throw();
00325       friend inline l_interval operator |(const l_real &,const l_real &)     throw();
00327       friend inline l_interval operator &(const l_real &,const l_interval &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00329       friend inline l_interval operator &(const l_interval &,const l_real &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00330 
00332       friend inline l_interval & operator +=(l_interval &,const l_real &) throw();      
00334       friend inline l_interval & operator -=(l_interval &,const l_real &) throw();
00336       friend inline l_interval & operator *=(l_interval &,const l_real &) throw();              
00338       friend inline l_interval & operator /=(l_interval &,const l_real &) throw(); 
00340       friend inline l_interval & operator |=(l_interval &,const l_real &) throw();
00342       friend inline l_interval & operator &=(l_interval &,const l_real &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00343  
00344       // LI-I
00346       friend inline l_interval operator +(const l_interval &,const interval &) throw();
00348       friend inline l_interval operator +(const interval &,const l_interval &) throw();
00350       friend inline l_interval operator -(const l_interval &,const interval &) throw();
00352       friend inline l_interval operator -(const interval &,const l_interval &) throw();
00354       friend inline l_interval operator *(const l_interval &,const interval &) throw();
00356       friend inline l_interval operator *(const interval &,const l_interval &) throw();
00358       friend inline l_interval operator /(const l_interval &,const interval &) throw();
00360       friend inline l_interval operator /(const interval &,const l_interval &) throw();
00362       friend inline l_interval operator |(const interval &,const l_interval &) throw();
00364       friend inline l_interval operator |(const l_interval &,const interval &) throw();
00366       friend inline l_interval operator &(const interval &,const l_interval &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00368       friend inline l_interval operator &(const l_interval &,const interval &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00369 
00371       friend inline l_interval & operator +=(l_interval &,const interval &) throw();      
00373       friend inline l_interval & operator -=(l_interval &,const interval &) throw();
00375       friend inline l_interval & operator *=(l_interval &,const interval &) throw();              
00377       friend inline l_interval & operator /=(l_interval &,const interval &) throw(); 
00379       friend inline l_interval & operator |=(l_interval &,const interval &) throw();
00381       friend inline l_interval & operator &=(l_interval &,const interval &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00382  
00383       // LI-R
00385       friend inline l_interval operator +(const l_interval &,const real &) throw();
00387       friend inline l_interval operator +(const real &,const l_interval &) throw();
00389       friend inline l_interval operator -(const l_interval &,const real &) throw();
00391       friend inline l_interval operator -(const real &,const l_interval &) throw();
00393       friend inline l_interval operator *(const l_interval &,const real &) throw();
00395       friend inline l_interval operator *(const real &,const l_interval &) throw();
00397       friend inline l_interval operator /(const l_interval &,const real &) throw();
00399       friend inline l_interval operator /(const real &,const l_interval &) throw();
00401       friend inline l_interval operator |(const real &,const l_interval &) throw();
00403       friend inline l_interval operator |(const l_interval &,const real &) throw();
00405       friend inline l_interval operator &(const real &,const l_interval &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00407       friend inline l_interval operator &(const l_interval &,const real &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00408 
00410       friend inline l_interval & operator +=(l_interval &,const real &) throw();      
00412       friend inline l_interval & operator -=(l_interval &,const real &) throw();
00414       friend inline l_interval & operator *=(l_interval &,const real &) throw();              
00416       friend inline l_interval & operator /=(l_interval &,const real &) throw(); 
00418       friend inline l_interval & operator |=(l_interval &,const real &) throw();
00420       friend inline l_interval & operator &=(l_interval &,const real &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00421 
00422       // LR-I
00424       friend inline l_interval operator +(const l_real &,const interval &) throw();
00426       friend inline l_interval operator +(const interval &,const l_real &) throw();
00428       friend inline l_interval operator -(const l_real &,const interval &) throw();
00430       friend inline l_interval operator -(const interval &,const l_real &) throw();
00432       friend inline l_interval operator *(const l_real &,const interval &) throw();
00434       friend inline l_interval operator *(const interval &,const l_real &) throw();
00436       friend inline l_interval operator /(const l_real &,const interval &) throw();
00438       friend inline l_interval operator /(const interval &,const l_real &) throw();
00440       friend inline l_interval operator |(const interval &,const l_real &) throw();
00442       friend inline l_interval operator |(const l_real &,const interval &) throw();
00444       friend inline l_interval operator &(const interval &,const l_real &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00446       friend inline l_interval operator &(const l_real &,const interval &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00447  
00448       // ---- Vergleichsop. ----
00450       friend        bool operator !(const l_interval &) throw();
00451 //                         operator void *(void) throw();
00452 
00454       friend        bool operator ==(const l_interval &,const l_interval &) throw();
00456       friend inline bool operator !=(const l_interval &,const l_interval &) throw();
00457 
00459       friend inline bool operator ==(const l_real &,const l_interval &) throw();
00461       friend inline bool operator !=(const l_real &,const l_interval &) throw();
00463       friend inline bool operator ==(const l_interval &,const l_real &) throw();
00465       friend inline bool operator !=(const l_interval &,const l_real &) throw();
00466 
00468       friend inline bool operator ==(const interval &,const l_interval &) throw();
00470       friend inline bool operator !=(const interval &,const l_interval &) throw();
00472       friend inline bool operator ==(const l_interval &,const interval &) throw();
00474       friend inline bool operator !=(const l_interval &,const interval &) throw();
00475 
00477       friend inline bool operator ==(const real &,const l_interval &) throw();
00479       friend inline bool operator !=(const real &,const l_interval &) throw();
00481       friend inline bool operator ==(const l_interval &,const real &) throw();
00483       friend inline bool operator !=(const l_interval &,const real &) throw();
00484 
00486       friend inline bool operator ==(const idotprecision &,const l_interval &) throw();
00488       friend inline bool operator !=(const idotprecision &,const l_interval &) throw();
00490       friend inline bool operator ==(const l_interval &,const idotprecision &) throw();
00492       friend inline bool operator !=(const l_interval &,const idotprecision &) throw();
00493 
00495       friend inline bool operator ==(const dotprecision &,const l_interval &) throw();
00497       friend inline bool operator !=(const dotprecision &,const l_interval &) throw();
00499       friend inline bool operator ==(const l_interval &,const dotprecision &) throw();
00501       friend inline bool operator !=(const l_interval &,const dotprecision &) throw();
00502    
00503       // ---- Mengenvergle. ----
00505       friend        bool operator  <(const l_interval &,const l_interval &) throw();
00507       friend        bool operator  >(const l_interval &,const l_interval &) throw();
00509       friend        bool operator <=(const l_interval &,const l_interval &) throw();
00511       friend        bool operator >=(const l_interval &,const l_interval &) throw();
00512 
00514       friend inline bool operator  <(const l_real &,const l_interval &) throw();
00516       friend inline bool operator  >(const l_real &,const l_interval &) throw();
00518       friend inline bool operator <=(const l_real &,const l_interval &) throw();
00520       friend inline bool operator >=(const l_real &,const l_interval &) throw();
00522       friend inline bool operator  <(const l_interval &,const l_real &) throw();
00524       friend inline bool operator  >(const l_interval &,const l_real &) throw();
00526       friend inline bool operator <=(const l_interval &,const l_real &) throw();
00528       friend inline bool operator >=(const l_interval &,const l_real &) throw();
00529 
00531       friend inline bool operator  <(const interval &,const l_interval &) throw();
00533       friend inline bool operator  >(const interval &,const l_interval &) throw();
00535       friend inline bool operator <=(const interval &,const l_interval &) throw();
00537       friend inline bool operator >=(const interval &,const l_interval &) throw();
00539       friend inline bool operator  <(const l_interval &,const interval &) throw();
00541       friend inline bool operator  >(const l_interval &,const interval &) throw();
00543       friend inline bool operator <=(const l_interval &,const interval &) throw();
00545       friend inline bool operator >=(const l_interval &,const interval &) throw();
00546 
00548       friend inline bool operator  <(const real &,const l_interval &) throw();
00550       friend inline bool operator  >(const real &,const l_interval &) throw();
00552       friend inline bool operator <=(const real &,const l_interval &) throw();
00554       friend inline bool operator >=(const real &,const l_interval &) throw();
00556       friend inline bool operator  <(const l_interval &,const real &) throw();
00558       friend inline bool operator  >(const l_interval &,const real &) throw();
00560       friend inline bool operator <=(const l_interval &,const real &) throw();
00562       friend inline bool operator >=(const l_interval &,const real &) throw();
00563 
00565       friend inline bool operator  <(const idotprecision &,const l_interval &) throw();
00567       friend inline bool operator  >(const idotprecision &,const l_interval &) throw();
00569       friend inline bool operator <=(const idotprecision &,const l_interval &) throw();
00571       friend inline bool operator >=(const idotprecision &,const l_interval &) throw();
00573       friend inline bool operator  <(const l_interval &,const idotprecision &) throw();
00575       friend inline bool operator  >(const l_interval &,const idotprecision &) throw();
00577       friend inline bool operator <=(const l_interval &,const idotprecision &) throw();
00579       friend inline bool operator >=(const l_interval &,const idotprecision &) throw();
00580 
00582       friend inline bool operator  <(const dotprecision &,const l_interval &) throw();
00584       friend inline bool operator  >(const dotprecision &,const l_interval &) throw();
00586       friend inline bool operator <=(const dotprecision &,const l_interval &) throw();
00588       friend inline bool operator >=(const dotprecision &,const l_interval &) throw();
00590       friend inline bool operator  <(const l_interval &,const dotprecision &) throw();
00592       friend inline bool operator  >(const l_interval &,const dotprecision &) throw();
00594       friend inline bool operator <=(const l_interval &,const dotprecision &) throw();
00596       friend inline bool operator >=(const l_interval &,const dotprecision &) throw();
00597 
00598       // ---- Funktionen    ----
00599       
00600 //      friend inline l_interval_Inf Inf (l_interval &)  throw();
00601 //      friend inline l_interval_Sup Sup (l_interval &)  throw();
00603       friend inline l_real         Inf (const l_interval &) throw();
00605       friend inline l_real         Sup (const l_interval &) throw();
00606 
00608       friend inline int expo_sm(const l_interval&);
00609       // Calculating expo(x[k]) of the smallest |x[k]|<>0.
00610 
00612       friend inline int expo_gr(const l_interval&);
00613       // Calculating expo(x[k]) of the greatest |x[k]|.
00614       
00616       friend inline int StagPrec(const l_interval &) throw();
00617 
00619       friend inline l_interval & SetInf (l_interval & a, const l_real & b)  throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00621       friend inline l_interval & SetSup (l_interval & a, const l_real & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00623       friend inline l_interval & SetInf (l_interval & a, const real & b)  throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00625       friend inline l_interval & SetSup (l_interval & a, const real & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00627       friend inline l_interval  adjust (const l_interval &) throw();         
00628 
00630       friend inline l_interval & UncheckedSetInf (l_interval & a, const l_real & b) throw();
00632       friend inline l_interval & UncheckedSetSup (l_interval & a, const l_real & b) throw();
00634       friend inline l_interval & UncheckedSetInf (l_interval & a, const real & b) throw();
00636       friend inline l_interval & UncheckedSetSup (l_interval & a, const real & b) throw();
00637       
00639       friend void ConvexHull(const l_interval &, const l_interval &, l_interval &, l_interval &) throw();
00641       friend void Intersection(const l_interval &, const l_interval &, l_interval &, l_interval &) throw(ERROR_LINTERVAL_EMPTY_INTERVAL);
00642    
00644       friend inline l_interval abs  (const l_interval & a) throw();
00646       friend        l_real     mid  (const l_interval & a) throw();
00648       friend inline l_real     diam (const l_interval & a) throw();
00649 
00651       friend l_interval pow(const l_interval &, const l_interval &) throw(ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF); // Pow(x,y)
00653       friend l_interval power(const l_interval &, int);       // Power(x,n)
00655       friend l_interval sqr(const l_interval &);              // Sqr(x)
00656 
00658       friend l_interval sqrt(const l_interval &) throw(ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF);             // Sqrt(x)
00660       friend l_interval sqrt(const l_interval &, int) throw(ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF);        // NSqrt(n,x)
00661 
00663       friend l_interval sin(const l_interval &) throw(ERROR_LINTERVAL_FAK_OVERFLOW);    // Sin(x)
00665       friend l_interval cos(const l_interval &) throw(ERROR_LINTERVAL_FAK_OVERFLOW);    // Cos(x)
00667       friend l_interval tan(const l_interval &) throw(ERROR_LINTERVAL_FAK_OVERFLOW,ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF);    // Tan(x)
00669       friend l_interval cot(const l_interval &) throw(ERROR_LINTERVAL_FAK_OVERFLOW,ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF);    // Cot(x)
00670 
00672       friend l_interval asin(const l_interval &) throw(ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF);   // ASin(x)
00674       friend l_interval acos(const l_interval &) throw(ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF);   // ACos(x)
00676       friend l_interval atan(const l_interval &) throw();   // ATan(x)
00678       friend l_interval acot(const l_interval &) throw();   // ACot(x)
00679 
00681       friend l_interval exp(const l_interval &) throw(ERROR_LINTERVAL_FAK_OVERFLOW);    // Exp(x)
00683       friend l_interval exp2(const l_interval &); // 2^x
00685       friend l_interval exp10(const l_interval &); // 10^x               
00687       friend l_interval ln(const l_interval &) throw(ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF);     // Ln(x)
00689       friend l_interval log2(const l_interval &);
00691       friend l_interval log10(const l_interval &);
00693       friend l_interval sinh(const l_interval &) throw(ERROR_LINTERVAL_FAK_OVERFLOW);   // Sinh(x)
00695       friend l_interval cosh(const l_interval &) throw(ERROR_LINTERVAL_FAK_OVERFLOW);   // Cosh(x)
00697       friend l_interval tanh(const l_interval &) throw();   // Tanh(x)
00699       friend l_interval coth(const l_interval &) throw();   // Coth(x)           
00700  
00702       friend l_interval asinh(const l_interval &) throw(ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF,ERROR_LINTERVAL_FAK_OVERFLOW);  // ASinh(x)
00704       friend l_interval acosh(const l_interval &) throw();  // ACosh(x)
00706       friend l_interval atanh(const l_interval &) throw(ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF,ERROR_LINTERVAL_FAK_OVERFLOW);  // ATanh(x)
00708       friend l_interval acoth(const l_interval &) throw(ERROR_LINTERVAL_STD_FKT_OUT_OF_DEF,ERROR_LINTERVAL_FAK_OVERFLOW);  // ACoth(x)
00709 
00711       friend l_interval Ln2_l_interval() throw();     // ln(2)
00713       friend l_interval Ln10_l_interval() throw();  // ln(10)
00715       friend l_interval Ln10r_l_interval() throw(); // 1/ln(10)
00717       friend l_interval Pid4_l_interval() throw();  // Pi/4
00719       friend l_interval Sqrt2_l_interval() throw(); // sqrt(2)
00721       friend l_interval Sqrt5_l_interval() throw(); // sqrt(5)
00723       friend l_interval Sqrt7_l_interval() throw(); // sqrt(7)
00724                 
00725       // obsolete, see also l_imath.hpp and l_imath.cpp
00727       friend inline l_interval li_ln2();   // ln(2) 
00729       friend inline l_interval li_ln10();  // ln(10)
00731       friend inline l_interval li_Rln10(); // 1/ln(10)
00733       friend inline l_interval li_pi4();   // Pi/4
00735       friend inline l_interval li_sqrt2(); // sqrt(2)
00736 
00738       friend l_interval Ln2r_l_interval() throw();     // 1/ln(2)
00740       friend l_interval Pi_l_interval() throw();       // Pi
00742       friend l_interval Pid2_l_interval() throw();     // Pi/2
00744       friend l_interval Pi2_l_interval() throw();      // 2*Pi
00746       friend l_interval Pid3_l_interval() throw();     // Pi/3
00748       friend l_interval Pir_l_interval() throw();      // 1/Pi
00750       friend l_interval Pi2r_l_interval() throw();     // 1/(2*Pi)
00752       friend l_interval SqrtPi_l_interval() throw();   // sqrt(Pi)
00754       friend l_interval Sqrt2Pi_l_interval() throw();  // sqrt(2*Pi)
00756       friend l_interval SqrtPir_l_interval() throw();  // 1/sqrt(Pi)
00758       friend l_interval Sqrt2Pir_l_interval() throw(); // 1/sqrt(2*Pi)
00760       friend l_interval Pip2_l_interval() throw();     // Pi^2
00762       friend l_interval Sqrt2r_l_interval() throw();   // 1/sqrt(2)
00764       friend l_interval Sqrt3_l_interval() throw();    // sqrt(3)
00766       friend l_interval Sqrt3d2_l_interval() throw();  // sqrt(3)/2
00768       friend l_interval Sqrt3r_l_interval() throw();   // 1/sqrt(3)
00770       friend l_interval LnPi_l_interval() throw();     // ln(Pi)
00772       friend l_interval Ln2Pi_l_interval() throw();    // ln(2*Pi)
00774       friend l_interval E_l_interval() throw();        // e = exp(1)
00776       friend l_interval Er_l_interval() throw();       // 1/e
00778       friend l_interval Ep2_l_interval() throw();      // e^2
00780       friend l_interval Ep2r_l_interval() throw();     // 1/e^2
00782       friend l_interval EpPi_l_interval() throw();     // e^Pi
00784       friend l_interval Ep2Pi_l_interval() throw();    // e^(2*Pi)
00786       friend l_interval EpPid2_l_interval() throw();   // e^(Pi/2)
00788       friend l_interval EpPid4_l_interval() throw();   // e^(Pi/4)
00790       friend l_interval EulerGa_l_interval() throw();  // EulerGamma
00792       friend l_interval Catalan_l_interval() throw();  // Catalan
00793 
00794       // Operatoren: l/real op idotprecision
00795       //      
00796       // friend inline void accumulate(idotprecision &, const real &, const l_real &) throw();
00797       // friend inline void accumulate(idotprecision &, const l_real &, const real &) throw();
00798 
00799       // Operatoren: l_real op idotprecision
00800       //
00801       // friend inline void accumulate(idotprecision &, const l_real &, const l_real &) throw();
00802 
00803       // Operatoren: real, l_interval op idotprecision
00804       //
00806       friend inline void accumulate(idotprecision &, const real &, const l_interval &) throw();
00808       friend inline void accumulate(idotprecision &, const l_interval &, const real &) throw();
00809 
00810       // Operatoren: interval, l_real op idotprecision
00811       //
00813       friend inline void accumulate(idotprecision &, const interval &, const l_real &) throw();
00815       friend inline void accumulate(idotprecision &, const l_real &, const interval &) throw();    
00816 
00817       // Operatoren: l_interval, l_real op idotprecision
00818       //
00820       friend inline void accumulate(idotprecision &, const l_interval &, const l_real &) throw();
00822       friend inline void accumulate(idotprecision &, const l_real &, const l_interval &) throw();
00823 
00824       // Operatoren: l_interval, interval op idotprecision
00825       //
00827       friend inline void accumulate(idotprecision &, const l_interval &, const interval &) throw();
00829       friend inline void accumulate(idotprecision &, const interval &, const l_interval &) throw();
00830 
00831       // Operatoren: l_interval op idotprecision
00832       //
00834       friend void accumulate(idotprecision &, const l_interval &, const l_interval &) throw();
00835 
00837       friend inline bool point_intv(const l_interval &);  // bool delivers: a is a point interval;
00839       friend inline bool zero_(const l_interval& ) throw(); // Blomquist,27.11.02
00841       friend void times2pown(l_interval&, int) throw();    // Blomquist,28.11.02
00843       friend void Times2pown(l_interval&, const real&) throw();
00844       friend void l_realz2l_interval(const l_real&, const interval&,
00845                                l_interval&) throw(); // Blomquist,28.11.02
00846       
00847 #if (CXSC_INDEX_CHECK)
00848 
00849       inline real & operator [](int) throw(ERROR_LINTERVAL_ELEMENT_NOT_IN_LONG);
00850 #else
00851 
00852       inline real & operator [](int) throw();
00853 #endif
00854             
00855    private:
00856 #if (CXSC_INDEX_CHECK)
00857       inline void _allo(int) throw(ERROR_LINTERVAL_WRONG_STAGPREC);
00858 #else
00859       inline void _allo(int) throw();
00860 #endif
00861       inline void _clear(int) throw();
00862       void _akku_out(idotprecision&) throw();
00863       void _akku_out_inn(idotprecision&) throw();
00864       void _akku_add(idotprecision &) const throw();
00865       void _akku_sub(idotprecision &) const throw();
00866       //void _create_l_interval(l_real &, l_real &);
00867       inline real & elem(int i)       { return data[i-1]; }
00868       inline real   elem(int i) const { return data[i-1]; }
00869              
00870 };
00871 
00872 interval _unchecked_interval(const l_real &, const l_real &) throw();
00873 
00879 inline l_interval _l_interval(const real & a) throw() { return l_interval(a); }
00885 inline l_interval _l_interval(const real & a, const real & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL) { return l_interval(a,b); }
00891 inline l_interval _l_interval(const l_real & a) throw() { return l_interval(a); }
00897 inline l_interval _l_interval(const l_real & a,const l_real & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL) { return l_interval(a,b); }
00903 inline l_interval _l_interval(const real & a, const l_real & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL) { return l_interval(a,b); }
00909 inline l_interval _l_interval(const l_real & a, const real & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL) { return l_interval(a,b); }
00910 
00916 inline l_interval _l_interval(const interval & a) throw() { return l_interval(a); }
00922 inline l_interval _l_interval(const dotprecision & a) throw() { return l_interval(a); }
00928 inline l_interval _l_interval(const dotprecision & a,const dotprecision & b) throw(ERROR_LINTERVAL_EMPTY_INTERVAL) { return l_interval(a,b); }
00934 inline l_interval _l_interval(const idotprecision & a) throw() { return l_interval(a); }
00935 l_interval _unchecked_l_interval(const l_real &, const l_real &) throw();      
00936  
00937 //inline l_interval_Inf Inf (l_interval &)  throw();
00938 //inline l_interval_Sup Sup (l_interval &)  throw();
00939 inline l_real         Inf (const l_interval &) throw();
00940 inline l_real         Sup (const l_interval &) throw();
00941 
00942 int in ( const real& x, const l_interval& y );        // Contained-in relation
00943 int in ( const l_real& x, const l_interval& y );      // Contained-in relation
00944 int in ( const interval& x, const l_interval& y );    // Contained-in relation
00945 int in ( const l_interval& x, const l_interval& y );  // Contained-in relation
00946 l_interval Blow (const l_interval& x, const real& eps );
00947 int Disjoint (const l_interval& a, const l_interval& b ); // Test for disjointedness
00948 l_real AbsMin ( const l_interval& x );           // Absolute minimum of
00949                                                  // an interval
00950 l_real AbsMax (const l_interval& x );            // Absolute maximum of
00951                                                  // an interval
00952 l_real RelDiam ( const l_interval x );           // Relative diameter
00953                                                  // of an interval
00954 inline bool point_intv(const l_interval &a );  // bool delivers: a is a point interval;
00955 
00956 void times2pown(l_interval&, int) throw();    // Blomquist,28.11.02
00957 void Times2pown(l_interval&, const real&) throw();
00958 
00960 
00963 class l_interval_Inf
00964 {
00965    private:
00966       l_interval & my_l_interval;
00967    public:
00968       // l_interval_Inf(const l_interval_Inf &a) throw() : my_l_interval(a.my_l_interval) {}
00970       l_interval_Inf(l_interval &a) throw() : my_l_interval(a) {}
00971                    operator l_real(void) const { return Inf((const l_interval)my_l_interval); }  
00973       l_interval & operator =(const l_real & a) throw(ERROR_LINTERVAL_EMPTY_INTERVAL)  { SetInf(my_l_interval,a); return my_l_interval; }
00975       l_interval & operator =(const real & a) throw(ERROR_LINTERVAL_EMPTY_INTERVAL)    { SetInf(my_l_interval,_l_real(a)); return my_l_interval; }
00976       // l_interval & operator =(int a) throw(ERROR_LINTERVAL_EMPTY_INTERVAL)             { SetInf(my_l_interval,_l_real(a)); return my_l_interval; }
00977 };
00979 
00982 class l_interval_Sup
00983 {
00984    private:
00985       l_interval & my_l_interval;
00986    public:
00988       l_interval_Sup(l_interval &a) throw() : my_l_interval(a) {}
00989                    operator l_real(void) const { return Sup((const l_interval)my_l_interval); }
00991       l_interval & operator =(const l_real & a) throw(ERROR_LINTERVAL_EMPTY_INTERVAL)  { SetSup(my_l_interval,a); return my_l_interval; }
00993       l_interval & operator =(const real & a) throw(ERROR_LINTERVAL_EMPTY_INTERVAL)    { SetSup(my_l_interval,_l_real(a)); return my_l_interval; }
00994       // l_interval & operator =(int a) throw(ERROR_LINTERVAL_EMPTY_INTERVAL)             { SetSup(my_l_interval,_l_real(a)); return my_l_interval; }    
00995 };
00996 
00997 } // namespace cxsc 
00998 
00999 #include "l_interval.inl"
01000 
01001 #endif // _CXSC_L_INTERVAL_HPP_INCLUDED