C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
intvector.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: intvector.hpp,v 1.20 2014/01/30 17:23:45 cxsc Exp $ */
00025 
00026 #ifndef _CXSC_INTVECTOR_HPP_INCLUDED
00027 #define _CXSC_INTVECTOR_HPP_INCLUDED
00028 
00029 #include "xscclass.hpp"
00030 #include "dot.hpp"
00031 #include "idot.hpp"
00032 #include "cdot.hpp"
00033 #include "cidot.hpp"
00034 #include "except.hpp"
00035 #include "vector.hpp"
00036 
00037 #include <iostream>
00038 
00039 namespace cxsc{
00040 
00041 int abs(int a);
00042 
00043 class intvector_slice;
00044 
00046 
00051 class intvector
00052 {
00053         friend class intvector_slice;
00054         friend class intmatrix;
00055         friend class intmatrix_subv;
00056 //#if(CXSC_INDEX_CHECK)
00057         //------------ Templates --------------------------------------------------
00058 #ifdef _CXSC_FRIEND_TPL
00059 template <class V,class MS,class S> friend  void _vmsconstr(V &v,const MS &m)
00060 #if(CXSC_INDEX_CHECK)
00061         throw(ERROR__TYPE_CAST_OF_THICK_OBJ<MS>);
00062 #else
00063         throw();
00064 #endif
00065 template <class V,class M,class S> friend  void _vmconstr(V &v,const M &m)
00066 #if(CXSC_INDEX_CHECK)
00067         throw(ERROR__TYPE_CAST_OF_THICK_OBJ<M>);
00068 #else
00069         throw();
00070 #endif
00071  template <class V> friend       void _vresize(V &rv) throw();
00072  template <class V,class S> friend       void _vresize(V &rv, const int &len)
00073 #if(CXSC_INDEX_CHECK)
00074                 throw(ERROR__WRONG_BOUNDARIES<V>);
00075 #else
00076         throw();
00077 #endif
00078  template <class V,class S> friend       void _vresize(V &rv, const int &lb, const int &ub)
00079 #if(CXSC_INDEX_CHECK)
00080                 throw(ERROR__WRONG_BOUNDARIES<V>);
00081 #else
00082         throw();
00083 #endif
00084  template <class V1,class V2,class S> friend     V1 &_vvassign(V1 &rv1,const V2 &rv2) throw();
00085  template <class V,class S> friend       V & _vsassign(V &rv,const S &r) throw();
00086  template <class V,class VS,class S> friend      V & _vvsassign(V &rv,const VS &sl) throw();
00087  template <class VS,class V> friend      VS & _vsvassign(VS &sl,const V &rv)
00088 #if(CXSC_INDEX_CHECK)
00089                 throw(ERROR__OP_WITH_WRONG_DIM<VS>);
00090 #else
00091         throw();
00092 #endif
00093 template <class V,class M,class S> friend  V &_vmassign(V &v,const M &m)
00094 #if(CXSC_INDEX_CHECK)
00095         throw(ERROR__TYPE_CAST_OF_THICK_OBJ<M>);
00096 #else
00097         throw();
00098 #endif
00099 template <class M,class V,class S> friend  M &_mvassign(M &m,const V &v) throw();
00100 template <class MV,class V> friend  MV &_mvvassign(MV &v,const V &rv)
00101 #if(CXSC_INDEX_CHECK)
00102         throw(ERROR__OP_WITH_WRONG_DIM<MV>);
00103 #else
00104         throw();
00105 #endif
00106 template <class MV,class V> friend  V _mvabs(const MV &mv) throw();
00107 
00108         //-------- vector-vector -----------------
00109  template <class DP,class V1,class V2> friend    void _vvaccu(DP &dp, const V1 & rv1, const V2 &rv2)
00110 #if(CXSC_INDEX_CHECK)
00111                 throw(OP_WITH_WRONG_DIM);
00112 #else
00113         throw();
00114 #endif
00115  template <class DP,class VS,class V> friend     void _vsvaccu(DP &dp, const VS & sl, const V &rv)
00116 #if(CXSC_INDEX_CHECK)
00117                 throw(OP_WITH_WRONG_DIM);
00118 #else
00119         throw();
00120 #endif
00121  template <class V,class S> friend       V &_vsmultassign(V &rv,const S &r) throw();
00122  template <class VS,class S> friend      VS &_vssmultassign(VS &rv,const S &r) throw();
00123  template <class VS,class S> friend      VS &_vssdivassign(VS &rv,const S &r) throw();
00124  template <class V1,class V2,class E> friend     E _vvplus(const V1 &rv1, const V2 &rv2)
00125 #if(CXSC_INDEX_CHECK)
00126                 throw(ERROR__OP_WITH_WRONG_DIM<V1>);
00127 #else
00128         throw();
00129 #endif
00130  template <class V,class VS,class E> friend      E _vvsplus(const V &rv,const VS &sl)
00131 #if(CXSC_INDEX_CHECK)
00132                 throw(ERROR__OP_WITH_WRONG_DIM<V>);
00133 #else
00134         throw();
00135 #endif
00136  template <class VS1,class VS2,class E> friend   E _vsvsplus(const VS1 &s1,const VS2 &s2)
00137 #if(CXSC_INDEX_CHECK)
00138                 throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
00139 #else
00140         throw();
00141 #endif
00142  template <class VS1,class VS2,class E> friend   E _vsvsminus(const VS1 &s1,const VS2 &s2)
00143 #if(CXSC_INDEX_CHECK)
00144                 throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
00145 #else
00146         throw();
00147 #endif
00148  template <class V1,class V2> friend     V1 &_vvplusassign(V1 &rv1, const V2 &rv2)
00149 #if(CXSC_INDEX_CHECK)
00150                 throw(ERROR__OP_WITH_WRONG_DIM<V1>);
00151 #else
00152         throw();
00153 #endif
00154  template <class V,class VS> friend      V &_vvsplusassign(V &rv, const VS &sl)
00155 #if(CXSC_INDEX_CHECK)
00156                 throw(ERROR__OP_WITH_WRONG_DIM<V>);
00157 #else
00158         throw();
00159 #endif
00160  template <class VS,class V> friend      VS &_vsvplusassign(VS &sl, const V &rv)
00161 #if(CXSC_INDEX_CHECK)
00162                 throw(ERROR__OP_WITH_WRONG_DIM<VS>);
00163 #else
00164         throw();
00165 #endif
00166  template <class VS1,class VS2> friend   VS1 &_vsvsplusassign(VS1 &sl1, const VS2 &sl2)
00167 #if(CXSC_INDEX_CHECK)
00168                 throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
00169 #else
00170         throw();
00171 #endif
00172  template <class VS1,class VS2> friend   VS1 &_vsvsminusassign(VS1 &sl1, const VS2 &sl2)
00173 #if(CXSC_INDEX_CHECK)
00174                 throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
00175 #else
00176         throw();
00177 #endif
00178  template <class V1,class V2> friend     V1 &_vvminusassign(V1 &rv1, const V2 &rv2)
00179 #if(CXSC_INDEX_CHECK)
00180                 throw(ERROR__OP_WITH_WRONG_DIM<V1>);
00181 #else
00182         throw();
00183 #endif
00184  template <class V,class VS> friend      V &_vvsminusassign(V &rv, const VS &sl)
00185 #if(CXSC_INDEX_CHECK)
00186                 throw(ERROR__OP_WITH_WRONG_DIM<V>);
00187 #else
00188         throw();
00189 #endif
00190  template <class VS,class V> friend      VS &_vsvminusassign(VS &sl, const V &rv)
00191 #if(CXSC_INDEX_CHECK)
00192                 throw(ERROR__OP_WITH_WRONG_DIM<VS>);
00193 #else
00194         throw();
00195 #endif
00196  template <class V> friend       V _vminus(const V &rv) throw();
00197  template <class VS,class V> friend      V _vsminus(const VS &sl) throw();
00198  template <class V1,class V2,class E> friend     E _vvminus(const V1 &rv1, const V2 &rv2)
00199 #if(CXSC_INDEX_CHECK)
00200                 throw(ERROR__OP_WITH_WRONG_DIM<E>);
00201 #else
00202         throw();
00203 #endif
00204  template <class V,class VS,class E> friend      E _vvsminus(const V &rv, const VS &sl)
00205 #if(CXSC_INDEX_CHECK)
00206                 throw(ERROR__OP_WITH_WRONG_DIM<E>);
00207 #else
00208         throw();
00209 #endif
00210  template <class VS,class V,class E> friend      E _vsvminus(const VS &sl,const V &rv)
00211 #if(CXSC_INDEX_CHECK)
00212                 throw(ERROR__OP_WITH_WRONG_DIM<E>);
00213 #else
00214         throw();
00215 #endif
00216  template <class MV1,class MV2,class E> friend   E _mvmvplus(const MV1 &rv1, const MV2 &rv2)
00217 #if(CXSC_INDEX_CHECK)
00218                 throw(ERROR__OP_WITH_WRONG_DIM<E>);
00219 #else
00220         throw();
00221 #endif
00222  template <class MV,class V,class E> friend      E _mvvplus(const MV &rv1, const V &rv2)
00223 #if(CXSC_INDEX_CHECK)
00224                 throw(ERROR__OP_WITH_WRONG_DIM<E>);
00225 #else
00226         throw();
00227 #endif
00228  template <class MV,class V,class E> friend      E _mvvminus(const MV &rv1, const V &rv2)
00229 #if(CXSC_INDEX_CHECK)
00230                 throw(ERROR__OP_WITH_WRONG_DIM<E>);
00231 #else
00232         throw();
00233 #endif
00234  template <class V,class MV,class E> friend      E _vmvminus(const V &rv1, const MV &rv2)
00235 #if(CXSC_INDEX_CHECK)
00236                 throw(ERROR__OP_WITH_WRONG_DIM<E>);
00237 #else
00238         throw();
00239 #endif
00240  template <class MV1,class MV2,class E> friend   E _mvmvminus(const MV1 &rv1, const MV2 &rv2)
00241 #if(CXSC_INDEX_CHECK)
00242                 throw(ERROR__OP_WITH_WRONG_DIM<E>);
00243 #else
00244         throw();
00245 #endif
00246 template <class MV,class V> friend  MV &_mvvplusassign(MV &v,const V &rv)
00247 #if(CXSC_INDEX_CHECK)
00248         throw(ERROR__OP_WITH_WRONG_DIM<MV>);
00249 #else
00250         throw();
00251 #endif
00252 template <class MV,class V> friend  MV &_mvvminusassign(MV &v,const V &rv)
00253 #if(CXSC_INDEX_CHECK)
00254         throw(ERROR__OP_WITH_WRONG_DIM<MV>);
00255 #else
00256         throw();
00257 #endif
00258 
00259         
00260 template <class DP,class V,class SV> friend      void _vmvaccu(DP &dp, const V & rv1, const SV &rv2)
00261 #if(CXSC_INDEX_CHECK)
00262                 throw(OP_WITH_WRONG_DIM);
00263 #else
00264         throw();
00265 #endif
00266         //--------- vector-scalar ----------------
00267  template <class V,class S,class E> friend       E _vsdiv(const V &rv, const S &s) throw();
00268  template <class V,class S> friend       V &_vsdivassign(V &rv,const S &r) throw();
00269  template <class VS,class S,class E> friend      E _vssdiv(const VS &sl, const S &s) throw();
00270  template <class MV,class S,class E> friend      E _mvsmult(const MV &rv, const S &s) throw();
00271  template <class V,class S,class E> friend       E _vsmult(const V &rv, const S &s) throw();
00272  template <class VS,class S,class E> friend      E _vssmult(const VS &sl, const S &s) throw();
00273  template <class V1,class V2> friend     bool _vveq(const V1 &rv1, const V2 &rv2) throw();
00274  template <class VS,class V> friend      bool _vsveq(const VS &sl, const V &rv) throw();
00275  template <class V1,class V2> friend     bool _vvneq(const V1 &rv1, const V2 &rv2) throw();
00276  template <class VS,class V> friend      bool _vsvneq(const VS &sl, const V &rv) throw();
00277  template <class V1,class V2> friend     bool _vvless(const V1 &rv1, const V2 &rv2) throw();
00278  template <class VS,class V> friend      bool _vsvless(const VS &sl, const V &rv) throw();
00279  template <class V1,class V2> friend     bool _vvleq(const V1 &rv1, const V2 &rv2) throw();
00280  template <class VS,class V> friend      bool _vsvleq(const VS &sl, const V &rv) throw();
00281  template <class V,class VS> friend      bool _vvsless(const V &rv, const VS &sl) throw();
00282  template <class V,class VS> friend      bool _vvsleq(const V &rv, const VS &sl) throw();
00283  template <class V> friend       bool _vnot(const V &rv) throw();
00284  template <class V> friend       void *_vvoid(const V &rv) throw();
00285  template <class V,class E> friend       E _vabs(const V &rv) throw();
00286  template <class VS,class E> friend      E _vsabs(const VS &sl) throw();
00287  template <class VS1,class VS2> friend   bool _vsvseq(const VS1 &sl1, const VS2 &sl2) throw();
00288  template <class VS1,class VS2> friend   bool _vsvsneq(const VS1 &sl1, const VS2 &sl2) throw();
00289  template <class VS1,class VS2> friend   bool _vsvsless(const VS1 &sl1, const VS2 &sl2) throw();
00290  template <class VS1,class VS2> friend   bool _vsvsleq(const VS1 &sl1, const VS2 &sl2) throw();
00291  template <class VS> friend      bool _vsnot(const VS &sl) throw();
00292  template <class VS> friend      void *_vsvoid(const VS &sl) throw();
00293  template <class V> friend      std::ostream &_vout(std::ostream &s, const V &rv) throw();
00294  template <class V> friend      std::istream &_vin(std::istream &s, V &rv) throw();
00295 
00296 template <class V,class MV2,class S> friend  V &_vmvassign(V &v,const MV2 &rv) throw();
00297  template <class MV,class S,class E> friend      E _mvsdiv(const MV &rv, const S &s) throw();
00298         
00299 #endif
00300 
00301         private:
00302         int *dat;
00303         int l,u,size;
00304 
00305         public:
00306         //------ Konstruktoren ----------------------------------------------------
00308         INLINE intvector () throw();
00309 #ifdef OLD_CXSC
00310 
00311         explicit INLINE intvector(const class index &i) throw(); // for backwards compatibility
00312 #endif
00313 
00314         explicit INLINE intvector(const int &i1,const int &i2)
00315 #if(CXSC_INDEX_CHECK)
00316         throw(ERROR_INTVECTOR_WRONG_BOUNDARIES,ERROR_INTVECTOR_NO_MORE_MEMORY);
00317 #else
00318         throw();
00319 #endif
00320 
00321         INLINE intvector(const intmatrix_subv &) throw();
00323         explicit INLINE intvector(const int &) throw();
00325         explicit INLINE intvector(const intmatrix &)
00326 #if(CXSC_INDEX_CHECK)
00327         throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
00328 #else
00329         throw();
00330 #endif
00331 
00332         explicit INLINE intvector(const intmatrix_slice &sl)
00333 #if(CXSC_INDEX_CHECK)
00334         throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
00335 #else
00336         throw();
00337 #endif
00338 
00339         INLINE intvector(const intvector_slice &rs) throw();
00341         INLINE intvector(const intvector &v) throw();
00343         INLINE intvector &operator =(const intvector &rv) throw();
00345         INLINE intvector &operator =(const intvector_slice &sl) throw();
00347         INLINE intvector &operator =(const int &r) throw();
00349         INLINE intvector &operator =(const intmatrix &)
00350 #if(CXSC_INDEX_CHECK)
00351         throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
00352 #else
00353         throw();
00354 #endif
00355 
00356         INLINE intvector &operator =(const intmatrix_slice &)
00357 #if(CXSC_INDEX_CHECK)
00358         throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
00359 #else
00360         throw();
00361 #endif
00362 
00363         INLINE intvector &operator =(const intmatrix_subv &) throw();
00364 
00365         //--------- Destruktor ----------------------------------------------------
00366         INLINE ~intvector() { delete [] dat; }
00367 
00368         //------ Standardfunktionen -----------------------------------------------
00369         
00371         friend INLINE int Lb(const intvector &rv) throw() { return rv.l; }
00373         friend INLINE int Ub(const intvector &rv) throw() { return rv.u; }
00375         friend INLINE int VecLen(const intvector &rv) throw() { return rv.size; }
00377         friend INLINE intvector &SetLb(intvector &rv, const int &l) throw() { rv.l=l; rv.u=l+rv.size-1; return rv; }
00379         friend INLINE intvector &SetUb(intvector &rv, const int &u) throw() { rv.u=u; rv.l=u-rv.size+1; return rv; }
00381         INLINE int & operator [](const int &i)
00382 #if(CXSC_INDEX_CHECK)
00383         throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC);
00384 #else
00385         throw();
00386 #endif
00387 
00388         INLINE const int &operator [](const int &i) const
00389 #if(CXSC_INDEX_CHECK)
00390         throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC);
00391 #else
00392         throw();
00393 #endif
00394 
00395         INLINE intvector & operator ()() throw() { return *this; }
00397         INLINE intvector_slice operator ()(const int &i)
00398 #if(CXSC_INDEX_CHECK)
00399         throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG);
00400 #else
00401         throw();
00402 #endif
00403 
00404         INLINE intvector_slice operator ()(const int &i1,const int &i2)
00405 #if(CXSC_INDEX_CHECK)
00406         throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG);
00407 #else
00408         throw();
00409 #endif
00410         
00411         INLINE operator void*() throw();
00412 //#else
00413 //#endif
00414 };
00415 
00417 
00422 class intvector_slice
00423 {
00424         friend class intvector;
00425         friend class intmatrix;
00426         private:
00427         int *dat;
00428         int l,u,size;
00429         int start,end;
00430 
00431         public:
00432 //#if(CXSC_INDEX_CHECK) 
00433 #ifdef _CXSC_FRIEND_TPL
00434 //------------------------- Templates -------------------------------------------
00435  template <class VS1,class VS2> friend   VS1 & _vsvsassign(VS1 &sl1,const VS2 &sl2)
00436 #if(CXSC_INDEX_CHECK)
00437                 throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
00438 #else
00439         throw();
00440 #endif
00441  template <class V,class VS,class S> friend      V & _vvsassign(V &rv,const VS &sl) throw();
00442  template <class VS,class V> friend      VS & _vsvassign(VS &sl,const V &rv)
00443 #if(CXSC_INDEX_CHECK)
00444                 throw(ERROR__OP_WITH_WRONG_DIM<VS>);
00445 #else
00446         throw();
00447 #endif
00448  template <class VS,class S> friend      VS & _vssassign(VS &sl,const S &r) throw();
00449         //-------- vector-scalar ------------------
00450  template <class VS,class S> friend      VS &_vssmultassign(VS &rv,const S &r) throw();
00451  template <class VS,class S> friend      VS &_vssdivassign(VS &rv,const S &r) throw();
00452         
00453  template <class VS,class V> friend      bool _vsveq(const VS &sl, const V &rv) throw();
00454  template <class VS,class V> friend      bool _vsvneq(const VS &sl, const V &rv) throw();
00455  template <class VS,class V> friend      bool _vsvless(const VS &sl, const V &rv) throw();
00456  template <class VS,class V> friend      bool _vsvleq(const VS &sl, const V &rv) throw();
00457  template <class V,class VS> friend      bool _vvsless(const V &rv, const VS &sl) throw();
00458  template <class V,class VS> friend      bool _vvsleq(const V &rv, const VS &sl) throw();
00459  template <class VS,class E> friend      E _vsabs(const VS &sl) throw();
00460  template <class VS1,class VS2> friend   bool _vsvseq(const VS1 &sl1, const VS2 &sl2) throw();
00461  template <class VS1,class VS2> friend   bool _vsvsneq(const VS1 &sl1, const VS2 &sl2) throw();
00462  template <class VS1,class VS2> friend   bool _vsvsless(const VS1 &sl1, const VS2 &sl2) throw();
00463  template <class VS1,class VS2> friend   bool _vsvsleq(const VS1 &sl1, const VS2 &sl2) throw();
00464  template <class VS> friend      bool _vsnot(const VS &sl) throw();
00465  template <class VS> friend      void *_vsvoid(const VS &sl) throw();
00466  template <class V> friend      std::ostream &_vsout(std::ostream &s, const V &rv) throw();
00467  template <class V> friend      std::istream &_vsin(std::istream &s, V &rv) throw();
00468         //------- vector-matrix ----------------
00469         //------- vector-vector -----------------
00470  template <class DP,class VS,class V> friend     void _vsvaccu(DP &dp, const VS & sl, const V &rv)
00471 #if(CXSC_INDEX_CHECK)
00472                 throw(OP_WITH_WRONG_DIM);
00473 #else
00474         throw();
00475 #endif
00476  template <class DP,class VS1,class VS2> friend          void _vsvsaccu(DP &dp, const VS1 & sl1, const VS2 &sl2)
00477 #if(CXSC_INDEX_CHECK)
00478                 throw(OP_WITH_WRONG_DIM);
00479 #else
00480         throw();
00481 #endif
00482  template <class VS,class S,class E> friend      E _vssdiv(const VS &sl, const S &s) throw();
00483  template <class VS,class S,class E> friend      E _vssmult(const VS &sl, const S &s) throw();
00484  template <class VS,class V,class E> friend      E _vsvmult(const VS & sl, const V &rv)
00485 #if(CXSC_INDEX_CHECK)
00486                 throw(ERROR__OP_WITH_WRONG_DIM<V>);
00487 #else
00488         throw();
00489 #endif
00490  template <class V,class VS,class E> friend      E _vvsplus(const V &rv,const VS &sl)
00491 #if(CXSC_INDEX_CHECK)
00492                 throw(ERROR__OP_WITH_WRONG_DIM<V>);
00493 #else
00494         throw();
00495 #endif
00496  template <class VS1,class VS2,class E> friend   E _vsvsplus(const VS1 &s1,const VS2 &s2)
00497 #if(CXSC_INDEX_CHECK)
00498                 throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
00499 #else
00500         throw();
00501 #endif
00502  template <class VS1,class VS2,class E> friend   E _vsvsminus(const VS1 &s1,const VS2 &s2)
00503 #if(CXSC_INDEX_CHECK)
00504                 throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
00505 #else
00506         throw();
00507 #endif
00508  template <class V,class VS> friend      V &_vvsplusassign(V &rv, const VS &sl)
00509 #if(CXSC_INDEX_CHECK)
00510                 throw(ERROR__OP_WITH_WRONG_DIM<V>);
00511 #else
00512         throw();
00513 #endif
00514  template <class VS,class V> friend      VS &_vsvplusassign(VS &sl, const V &rv)
00515 #if(CXSC_INDEX_CHECK)
00516                 throw(ERROR__OP_WITH_WRONG_DIM<VS>);
00517 #else
00518         throw();
00519 #endif
00520  template <class VS1,class VS2> friend   VS1 &_vsvsplusassign(VS1 &sl1, const VS2 &sl2)
00521 #if(CXSC_INDEX_CHECK)
00522                 throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
00523 #else
00524         throw();
00525 #endif
00526  template <class VS1,class VS2> friend   VS1 &_vsvsminusassign(VS1 &sl1, const VS2 &sl2)
00527 #if(CXSC_INDEX_CHECK)
00528                 throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
00529 #else
00530         throw();
00531 #endif
00532  template <class V,class VS> friend      V &_vvsminusassign(V &rv, const VS &sl)
00533 #if(CXSC_INDEX_CHECK)
00534                 throw(ERROR__OP_WITH_WRONG_DIM<V>);
00535 #else
00536         throw();
00537 #endif
00538  template <class VS,class V> friend      VS &_vsvminusassign(VS &sl, const V &rv)
00539 #if(CXSC_INDEX_CHECK)
00540                 throw(ERROR__OP_WITH_WRONG_DIM<VS>);
00541 #else
00542         throw();
00543 #endif
00544  template <class VS,class V> friend      V _vsminus(const VS &sl) throw();
00545  template <class V,class VS,class E> friend      E _vvsminus(const V &rv, const VS &sl)
00546 #if(CXSC_INDEX_CHECK)
00547                 throw(ERROR__OP_WITH_WRONG_DIM<E>);
00548 #else
00549         throw();
00550 #endif
00551  template <class VS,class V,class E> friend      E _vsvminus(const VS &sl,const V &rv)
00552 #if(CXSC_INDEX_CHECK)
00553                 throw(ERROR__OP_WITH_WRONG_DIM<E>);
00554 #else
00555         throw();
00556 #endif
00557  template <class VS1,class VS2,class E> friend   E _vsvsmult(const VS1 & sl1, const VS2 &sl2)
00558 #if(CXSC_INDEX_CHECK)
00559                 throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
00560 #else
00561         throw();
00562 #endif
00563 
00564 #endif
00565         
00566         
00567         //--------------------- Konstruktoren -----------------------------------
00569         explicit INLINE intvector_slice(intvector &a, const int &lb, const int &ub) throw():dat(a.dat),l(a.l),u(a.u),size(ub-lb+1),start(lb),end(ub) { }
00571         explicit INLINE intvector_slice(intvector_slice &a, const int &lb, const int &ub) throw():dat(a.dat),l(a.l),u(a.u),size(ub-lb+1),start(lb),end(ub) { }
00572         public: 
00574         INLINE intvector_slice(const intvector_slice &a) throw():dat(a.dat),l(a.l),u(a.u),size(a.size),start(a.start),end(a.end) { }
00575         public:
00577         INLINE intvector_slice & operator =(const intvector_slice &sl)
00578 #if(CXSC_INDEX_CHECK)
00579         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00580 #else
00581         throw();
00582 #endif
00583 
00584         INLINE intvector_slice & operator =(const intvector &rv)
00585 #if(CXSC_INDEX_CHECK)
00586         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00587 #else
00588         throw();
00589 #endif
00590 
00591         INLINE intvector_slice & operator =(const int &r) throw();
00593         INLINE intvector_slice & operator =(const intmatrix &m)
00594 #if(CXSC_INDEX_CHECK)
00595         throw(ERROR__OP_WITH_WRONG_DIM<intvector>,ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
00596 #else
00597         throw();
00598 #endif
00599 
00600         INLINE intvector_slice & operator =(const intmatrix_slice &m)
00601 #if(CXSC_INDEX_CHECK)
00602         throw(ERROR__OP_WITH_WRONG_DIM<intvector>,ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
00603 #else
00604         throw();
00605 #endif
00606 
00607         INLINE intvector_slice &operator =(const intmatrix_subv &) throw();
00608 
00609         //--------------------- Standardfunktionen ------------------------------
00610 
00612         friend INLINE int Lb(const intvector_slice &sl) throw() { return sl.start; }
00614         friend INLINE int Ub(const intvector_slice &sl) throw() { return sl.end; }
00616         friend INLINE int VecLen(const intvector_slice &sl) throw() { return sl.end-sl.start+1; }
00618         INLINE int & operator [](const int &i)
00619 #if(CXSC_INDEX_CHECK)
00620         throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC);
00621 #else
00622         throw();
00623 #endif
00624 
00625         INLINE const int & operator [](const int &i) const
00626 #if(CXSC_INDEX_CHECK)
00627         throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC);
00628 #else
00629         throw();
00630 #endif
00631 
00632         INLINE intvector_slice & operator ()() throw() { return *this; }
00634         INLINE intvector_slice operator ()(const int &i)
00635 #if(CXSC_INDEX_CHECK)
00636         throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG);
00637 #else
00638         throw();
00639 #endif
00640 
00641         INLINE intvector_slice operator ()(const int &i1,const int &i2)
00642 #if(CXSC_INDEX_CHECK)
00643         throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG);
00644 #else
00645         throw();
00646 #endif
00647         
00649         INLINE intvector_slice &operator /=(const int &r) throw();
00651         INLINE intvector_slice &operator *=(const int &r) throw();
00653         INLINE intvector_slice &operator *=(const intmatrix &m)
00654 #if(CXSC_INDEX_CHECK)
00655         throw(ERROR_INTMATRIX_OP_WITH_WRONG_DIM);
00656 #else
00657         throw();
00658 #endif
00659 
00660         INLINE intvector_slice &operator +=(const intvector &rv)
00661 #if(CXSC_INDEX_CHECK)
00662         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00663 #else
00664         throw();
00665 #endif
00666 
00667         INLINE intvector_slice &operator +=(const intvector_slice &sl2)
00668 #if(CXSC_INDEX_CHECK)
00669         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00670 #else
00671         throw();
00672 #endif
00673 
00674         INLINE intvector_slice &operator -=(const intvector &rv)
00675 #if(CXSC_INDEX_CHECK)
00676         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00677 #else
00678         throw();
00679 #endif
00680 
00681         INLINE intvector_slice &operator -=(const intvector_slice &sl2)
00682 #if(CXSC_INDEX_CHECK)
00683         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00684 #else
00685         throw();
00686 #endif
00687         INLINE operator void*() throw();
00688 //#else
00689 //#endif
00690 };
00691 
00692 //======================== Vector Functions =============================
00693 
00695         INLINE intvector _intvector(const int &r) throw(); 
00696 //      INLINE intvector _intvector(const intmatrix &m) throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
00697 //      INLINE intvector _intvector(const intmatrix_slice &sl) throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
00698 
00700         INLINE void Resize(intvector &rv) throw();
00702         INLINE void Resize(intvector &rv, const int &len)
00703 #if(CXSC_INDEX_CHECK)
00704         throw(ERROR__WRONG_BOUNDARIES<intvector>);
00705 #else
00706         throw();
00707 #endif
00708 
00709         INLINE void Resize(intvector &rv, const int &lb, const int &ub)
00710 #if(CXSC_INDEX_CHECK)
00711         throw(ERROR__WRONG_BOUNDARIES<intvector>);
00712 #else
00713         throw();
00714 #endif
00715         
00717         INLINE intvector abs(const intvector &rv) throw();
00719         INLINE intvector abs(const intvector_slice &sl) throw();
00721         INLINE bool operator !(const intvector &rv) throw();
00723         INLINE bool operator !(const intvector_slice &sl) throw();
00724 
00725 //======================= Vector / Scalar ===============================
00726 
00728         INLINE intvector operator *(const intvector &rv, const int &s) throw();
00730         INLINE intvector operator *(const intvector_slice &sl, const int &s) throw();
00732         INLINE intvector operator *(const int &s, const intvector &rv) throw();
00734         INLINE intvector operator *(const int &s, const intvector_slice &sl) throw();
00736         INLINE intvector &operator *=(intvector &rv,const int &r) throw();
00737 
00739         INLINE intvector operator /(const intvector &rv, const int &s) throw();
00741         INLINE intvector operator /(const intvector_slice &sl, const int &s) throw();
00743         INLINE intvector &operator /=(intvector &rv,const int &r) throw();
00744 
00745 //======================= Vector / Vector ===============================
00746 
00747 
00748 
00750         INLINE void accumulate(dotprecision &dp, const intvector & rv1, const intvector &rv2)
00751 #if(CXSC_INDEX_CHECK)
00752         throw(OP_WITH_WRONG_DIM);
00753 #else
00754         throw();
00755 #endif
00756 
00757         INLINE void accumulate(dotprecision &dp, const intvector & rv1, const intmatrix_subv &rv2)
00758 #if(CXSC_INDEX_CHECK)
00759         throw(OP_WITH_WRONG_DIM);
00760 #else
00761         throw();
00762 #endif
00763 
00764         INLINE void accumulate(dotprecision &dp, const intmatrix_subv & rv1, const intvector &rv2)
00765 #if(CXSC_INDEX_CHECK)
00766         throw(OP_WITH_WRONG_DIM);
00767 #else
00768         throw();
00769 #endif
00770 
00771         INLINE void accumulate(dotprecision &dp,const intvector_slice &sl,const intvector &rv)
00772 #if(CXSC_INDEX_CHECK)
00773         throw(OP_WITH_WRONG_DIM);
00774 #else
00775         throw();
00776 #endif
00777 
00778         INLINE void accumulate(dotprecision &dp,const intvector &rv,const intvector_slice &sl)
00779 #if(CXSC_INDEX_CHECK)
00780         throw(OP_WITH_WRONG_DIM);
00781 #else
00782         throw();
00783 #endif
00784 
00785         INLINE void accumulate(dotprecision &dp, const intvector_slice & sl1, const intvector_slice &sl2)
00786 #if(CXSC_INDEX_CHECK)
00787         throw(OP_WITH_WRONG_DIM);
00788 #else
00789         throw();
00790 #endif
00791 
00792 
00794         INLINE int operator *(const intvector & rv1, const intvector &rv2)
00795 #if(CXSC_INDEX_CHECK)
00796         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00797 #else
00798         throw();
00799 #endif
00800 
00801         INLINE int operator *(const intvector_slice &sl, const intvector &rv)
00802 #if(CXSC_INDEX_CHECK)
00803         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00804 #else
00805         throw();
00806 #endif
00807 
00808         INLINE int operator *(const intvector &rv, const intvector_slice &sl)
00809 #if(CXSC_INDEX_CHECK)
00810         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00811 #else
00812         throw();
00813 #endif
00814 
00815         INLINE int operator *(const intvector_slice & sl1, const intvector_slice &sl2)
00816 #if(CXSC_INDEX_CHECK)
00817         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00818 #else
00819         throw();
00820 #endif
00821         
00823         INLINE const intvector &operator +(const intvector &rv) throw();
00825         INLINE intvector operator +(const intvector_slice &sl) throw();
00827         INLINE intvector operator +(const intvector &rv1, const intvector &rv2)
00828 #if(CXSC_INDEX_CHECK)
00829         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00830 #else
00831         throw();
00832 #endif
00833 
00834         INLINE intvector operator +(const intvector &rv, const intvector_slice &sl)
00835 #if(CXSC_INDEX_CHECK)
00836         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00837 #else
00838         throw();
00839 #endif
00840 
00841         INLINE intvector operator +(const intvector_slice &sl, const intvector &rv)
00842 #if(CXSC_INDEX_CHECK)
00843         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00844 #else
00845         throw();
00846 #endif
00847 
00848         INLINE intvector operator +(const intvector_slice &sl1, const intvector_slice &sl2)
00849 #if(CXSC_INDEX_CHECK)
00850         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00851 #else
00852         throw();
00853 #endif
00854 
00855         INLINE intvector & operator +=(intvector &rv1, const intvector &rv2)
00856 #if(CXSC_INDEX_CHECK)
00857         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00858 #else
00859         throw();
00860 #endif
00861 
00862         INLINE intvector &operator +=(intvector &rv, const intvector_slice &sl)
00863 #if(CXSC_INDEX_CHECK)
00864         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00865 #else
00866         throw();
00867 #endif
00868 
00870         INLINE intvector operator -(const intvector &rv) throw();
00872         INLINE intvector operator -(const intvector_slice &sl) throw();
00874         INLINE intvector operator -(const intvector &rv1, const intvector &rv2)
00875 #if(CXSC_INDEX_CHECK)
00876         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00877 #else
00878         throw();
00879 #endif
00880 
00881         INLINE intvector operator -(const intvector &rv, const intvector_slice &sl)
00882 #if(CXSC_INDEX_CHECK)
00883         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00884 #else
00885         throw();
00886 #endif
00887 
00888         INLINE intvector operator -(const intvector_slice &sl, const intvector &rv)
00889 #if(CXSC_INDEX_CHECK)
00890         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00891 #else
00892         throw();
00893 #endif
00894 
00895         INLINE intvector operator -(const intvector_slice &sl1, const intvector_slice &sl2)
00896 #if(CXSC_INDEX_CHECK)
00897         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00898 #else
00899         throw();
00900 #endif
00901 
00902         INLINE intvector & operator -=(intvector &rv1, const intvector &rv2)
00903 #if(CXSC_INDEX_CHECK)
00904         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00905 #else
00906         throw();
00907 #endif
00908 
00909         INLINE intvector &operator -=(intvector &rv, const intvector_slice &sl)
00910 #if(CXSC_INDEX_CHECK)
00911         throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
00912 #else
00913         throw();
00914 #endif
00915 
00917         INLINE bool operator ==(const intvector &rv1, const intvector &rv2) throw();
00919         INLINE bool operator ==(const intvector_slice &sl1, const intvector_slice &sl2) throw();
00921         INLINE bool operator ==(const intvector_slice &sl, const intvector &rv) throw();
00923         INLINE bool operator ==(const intvector &rv, const intvector_slice &sl) throw();
00925         INLINE bool operator !=(const intvector &rv1, const intvector &rv2) throw();
00927         INLINE bool operator !=(const intvector_slice &sl1, const intvector_slice &sl2) throw();
00929         INLINE bool operator !=(const intvector_slice &sl, const intvector &rv) throw();
00931         INLINE bool operator !=(const intvector &rv, const intvector_slice &sl) throw();
00933         INLINE bool operator <(const intvector &rv1, const intvector &rv2) throw();
00935         INLINE bool operator <(const intvector_slice &sl1, const intvector_slice &sl2) throw();
00937         INLINE bool operator < (const intvector_slice &sl, const intvector &rv) throw();
00939         INLINE bool operator < (const intvector &rv, const intvector_slice &sl) throw();
00941         INLINE bool operator <=(const intvector &rv1, const intvector &rv2) throw();
00943         INLINE bool operator <=(const intvector_slice &sl1, const intvector_slice &sl2) throw();
00945         INLINE bool operator <=(const intvector_slice &sl, const intvector &rv) throw();
00947         INLINE bool operator <=(const intvector &rv, const intvector_slice &sl) throw();
00949         INLINE bool operator >(const intvector &rv1, const intvector &rv2) throw();
00951         INLINE bool operator >(const intvector_slice &sl1, const intvector_slice &sl2) throw();
00953         INLINE bool operator >(const intvector_slice &sl, const intvector &rv) throw();
00955         INLINE bool operator >(const intvector &rv, const intvector_slice &sl) throw();
00957         INLINE bool operator >=(const intvector &rv1, const intvector &rv2) throw();
00959         INLINE bool operator >=(const intvector_slice &sl1, const intvector_slice &sl2) throw();
00961         INLINE bool operator >=(const intvector_slice &sl, const intvector &rv) throw();
00963         INLINE bool operator >=(const intvector &rv, const intvector_slice &sl) throw();
00964 
00966         INLINE std::ostream &operator <<(std::ostream &s, const intvector &rv) throw();
00968         INLINE std::ostream &operator <<(std::ostream &o, const intvector_slice &sl) throw();
00970         INLINE std::istream &operator >>(std::istream &s, intvector &rv) throw();
00972         INLINE std::istream &operator >>(std::istream &s, intvector_slice &rv) throw();
00973 
00974 
00975         INLINE intvector perminv(const intvector&);
00976 
00977 extern void     DoubleSize ( intvector& );
00979 extern std::ostream& operator<< ( std::ostream&, intvector& );
00980 
00981 
00982  
00983 } // namespace cxsc
00984         
00985 #ifdef _CXSC_INCL_INL
00986 #include "intvector.inl"
00987 #include "vector.inl"
00988 #endif
00989 
00990 
00991 #endif
00992