C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
lx_civector.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: lx_civector.hpp,v 1.9 2014/01/30 17:23:47 cxsc Exp $ */
00025 
00026 #ifndef _CXSC_LX_CIVECTOR_HPP_INCLUDED
00027 #define _CXSC_LX_CIVECTOR_HPP_INCLUDED 
00028 
00029 #include <xscclass.hpp>
00030 #include <real.hpp>
00031 #include <except.hpp>
00032 #include "lx_cinterval.hpp"
00033 
00034 #include <iostream>
00035 
00036 namespace cxsc {
00037         
00039 
00045 class lx_civector
00046 {       
00047         private:
00048                 lx_cinterval *dat;
00049                 int l,u,size;
00050                 
00051         public:
00052         //------ Konstruktoren ----------------------------------------------------
00053                 
00055         inline lx_civector () throw();
00056                 
00061         explicit inline lx_civector(int i) throw();
00062                 
00064         explicit inline lx_civector(int i1, int i2)
00065 #if(CXSC_INDEX_CHECK)
00066                 throw(ERROR_IVECTOR_WRONG_BOUNDARIES,ERROR_IVECTOR_NO_MORE_MEMORY);
00067 #else
00068                 throw();
00069 #endif
00070                 
00072         explicit inline lx_civector(const lx_cinterval &) throw();
00074         explicit inline lx_civector(const l_cinterval &) throw();
00076         explicit inline lx_civector(const cinterval &) throw();
00078         explicit inline lx_civector(const lx_complex &) throw();
00080         explicit inline lx_civector(const l_complex &) throw();
00082         explicit inline lx_civector(const complex &) throw();
00083                 
00085         explicit inline lx_civector(const lx_interval &) throw();
00087         explicit inline lx_civector(const l_interval &)  throw();
00089         explicit inline lx_civector(const interval &)    throw();
00091         explicit inline lx_civector(const lx_real &)     throw();
00093         explicit inline lx_civector(const l_real &)      throw();
00095         explicit inline lx_civector(const real &)        throw();
00096         
00098         inline lx_civector(const lx_civector &) throw();
00099                 
00100         
00102         inline lx_civector & operator = (const lx_civector &) throw();
00103         
00105         inline lx_civector & operator =(const lx_cinterval &) throw();
00107         inline lx_civector & operator =(const l_cinterval &) throw();
00109         inline lx_civector & operator =(const cinterval &) throw();
00111         inline lx_civector & operator =(const lx_complex &) throw();
00113         inline lx_civector & operator =(const l_complex &) throw();
00115         inline lx_civector & operator =(const complex &) throw();
00116         
00118         inline lx_civector & operator =(const lx_interval &) throw();
00120         inline lx_civector & operator =(const l_interval &) throw();
00122         inline lx_civector & operator =(const interval &) throw();
00124         inline lx_civector & operator =(const lx_real &) throw();
00126         inline lx_civector & operator =(const l_real &) throw();
00128         inline lx_civector & operator =(const real &) throw();
00129         
00130         //--------- Destruktor ----------------------------------------------------
00131         inline ~lx_civector() { delete [] dat; }
00132         
00133         
00135         inline lx_cinterval & operator [](const int &i)
00136 #if(CXSC_INDEX_CHECK)
00137                         throw(ERROR_IVECTOR_ELEMENT_NOT_IN_VEC);
00138 #else
00139         throw();
00140 #endif
00141 
00142         inline const lx_cinterval & operator [](const int &i) const
00143 #if(CXSC_INDEX_CHECK)
00144         throw(ERROR_IVECTOR_ELEMENT_NOT_IN_VEC);
00145 #else
00146         throw();
00147 #endif
00148         
00149 //------ Standardfunktionen -----------------------------------------------
00150         
00152 friend inline int Lb(const lx_civector &a) throw() { return a.l; }
00154 friend inline int Ub(const lx_civector &a) throw() { return a.u; }
00156 friend inline int VecLen(const lx_civector &a) throw() { return a.size; }
00158 friend inline lx_civector& SetLb(lx_civector &a, int l) throw() 
00159 { a.l=l; a.u=l+a.size-1; return a; }
00161 friend inline lx_civector & SetUb(lx_civector &a, int u) throw()
00162 { a.u=u; a.l=u-a.size+1; return a; }
00163 
00165 friend inline void Resize(lx_civector &rv, int lb, int ub)
00166 #if(CXSC_INDEX_CHECK)
00167                 throw(ERROR__WRONG_BOUNDARIES<lx_civector>);
00168 #else
00169                 throw();
00170 #endif
00171 
00173 friend inline void Resize(lx_civector &rv, int len)
00174 #if(CXSC_INDEX_CHECK)
00175                                 throw(ERROR__WRONG_BOUNDARIES<lx_civector>);
00176 #else
00177                 throw();
00178 #endif          
00179         
00180 }; // End of class lx_civector
00181 
00183 inline void DoubleSize(lx_civector&) throw();
00184 
00185 inline void Resize(lx_civector &rv, int lb, int ub)
00186 #if(CXSC_INDEX_CHECK)
00187                 throw(ERROR__WRONG_BOUNDARIES<lx_civector>);
00188 #else
00189                 throw();
00190 #endif
00191                 
00192                 inline void Resize(lx_civector &rv, int len)
00193 #if(CXSC_INDEX_CHECK)
00194                                 throw(ERROR__WRONG_BOUNDARIES<lx_civector>);
00195 #else
00196                 throw();
00197 #endif          
00198 
00199 } // End namespace cxsc
00200  
00201 
00202 #include "lx_civector.inl"
00203                                         
00204 #endif