C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
intvector.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: intvector.hpp,v 1.20 2014/01/30 17:23:45 cxsc Exp $ */
25 
26 #ifndef _CXSC_INTVECTOR_HPP_INCLUDED
27 #define _CXSC_INTVECTOR_HPP_INCLUDED
28 
29 #include "xscclass.hpp"
30 #include "dot.hpp"
31 #include "idot.hpp"
32 #include "cdot.hpp"
33 #include "cidot.hpp"
34 #include "except.hpp"
35 #include "vector.hpp"
36 
37 #include <iostream>
38 
39 namespace cxsc{
40 
41 int abs(int a);
42 
43 class intvector_slice;
44 
46 
51 class intvector
52 {
53  friend class intvector_slice;
54  friend class intmatrix;
55  friend class intmatrix_subv;
56 //#if(CXSC_INDEX_CHECK)
57  //------------ Templates --------------------------------------------------
58 #ifdef _CXSC_FRIEND_TPL
59 template <class V,class MS,class S> friend void _vmsconstr(V &v,const MS &m)
60 #if(CXSC_INDEX_CHECK)
61  throw(ERROR__TYPE_CAST_OF_THICK_OBJ<MS>);
62 #else
63  throw();
64 #endif
65 template <class V,class M,class S> friend void _vmconstr(V &v,const M &m)
66 #if(CXSC_INDEX_CHECK)
67  throw(ERROR__TYPE_CAST_OF_THICK_OBJ<M>);
68 #else
69  throw();
70 #endif
71  template <class V> friend void _vresize(V &rv) throw();
72  template <class V,class S> friend void _vresize(V &rv, const int &len)
73 #if(CXSC_INDEX_CHECK)
74  throw(ERROR__WRONG_BOUNDARIES<V>);
75 #else
76  throw();
77 #endif
78  template <class V,class S> friend void _vresize(V &rv, const int &lb, const int &ub)
79 #if(CXSC_INDEX_CHECK)
80  throw(ERROR__WRONG_BOUNDARIES<V>);
81 #else
82  throw();
83 #endif
84  template <class V1,class V2,class S> friend V1 &_vvassign(V1 &rv1,const V2 &rv2) throw();
85  template <class V,class S> friend V & _vsassign(V &rv,const S &r) throw();
86  template <class V,class VS,class S> friend V & _vvsassign(V &rv,const VS &sl) throw();
87  template <class VS,class V> friend VS & _vsvassign(VS &sl,const V &rv)
88 #if(CXSC_INDEX_CHECK)
89  throw(ERROR__OP_WITH_WRONG_DIM<VS>);
90 #else
91  throw();
92 #endif
93 template <class V,class M,class S> friend V &_vmassign(V &v,const M &m)
94 #if(CXSC_INDEX_CHECK)
95  throw(ERROR__TYPE_CAST_OF_THICK_OBJ<M>);
96 #else
97  throw();
98 #endif
99 template <class M,class V,class S> friend M &_mvassign(M &m,const V &v) throw();
100 template <class MV,class V> friend MV &_mvvassign(MV &v,const V &rv)
101 #if(CXSC_INDEX_CHECK)
102  throw(ERROR__OP_WITH_WRONG_DIM<MV>);
103 #else
104  throw();
105 #endif
106 template <class MV,class V> friend V _mvabs(const MV &mv) throw();
107 
108  //-------- vector-vector -----------------
109  template <class DP,class V1,class V2> friend void _vvaccu(DP &dp, const V1 & rv1, const V2 &rv2)
110 #if(CXSC_INDEX_CHECK)
111  throw(OP_WITH_WRONG_DIM);
112 #else
113  throw();
114 #endif
115  template <class DP,class VS,class V> friend void _vsvaccu(DP &dp, const VS & sl, const V &rv)
116 #if(CXSC_INDEX_CHECK)
117  throw(OP_WITH_WRONG_DIM);
118 #else
119  throw();
120 #endif
121  template <class V,class S> friend V &_vsmultassign(V &rv,const S &r) throw();
122  template <class VS,class S> friend VS &_vssmultassign(VS &rv,const S &r) throw();
123  template <class VS,class S> friend VS &_vssdivassign(VS &rv,const S &r) throw();
124  template <class V1,class V2,class E> friend E _vvplus(const V1 &rv1, const V2 &rv2)
125 #if(CXSC_INDEX_CHECK)
126  throw(ERROR__OP_WITH_WRONG_DIM<V1>);
127 #else
128  throw();
129 #endif
130  template <class V,class VS,class E> friend E _vvsplus(const V &rv,const VS &sl)
131 #if(CXSC_INDEX_CHECK)
132  throw(ERROR__OP_WITH_WRONG_DIM<V>);
133 #else
134  throw();
135 #endif
136  template <class VS1,class VS2,class E> friend E _vsvsplus(const VS1 &s1,const VS2 &s2)
137 #if(CXSC_INDEX_CHECK)
138  throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
139 #else
140  throw();
141 #endif
142  template <class VS1,class VS2,class E> friend E _vsvsminus(const VS1 &s1,const VS2 &s2)
143 #if(CXSC_INDEX_CHECK)
144  throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
145 #else
146  throw();
147 #endif
148  template <class V1,class V2> friend V1 &_vvplusassign(V1 &rv1, const V2 &rv2)
149 #if(CXSC_INDEX_CHECK)
150  throw(ERROR__OP_WITH_WRONG_DIM<V1>);
151 #else
152  throw();
153 #endif
154  template <class V,class VS> friend V &_vvsplusassign(V &rv, const VS &sl)
155 #if(CXSC_INDEX_CHECK)
156  throw(ERROR__OP_WITH_WRONG_DIM<V>);
157 #else
158  throw();
159 #endif
160  template <class VS,class V> friend VS &_vsvplusassign(VS &sl, const V &rv)
161 #if(CXSC_INDEX_CHECK)
162  throw(ERROR__OP_WITH_WRONG_DIM<VS>);
163 #else
164  throw();
165 #endif
166  template <class VS1,class VS2> friend VS1 &_vsvsplusassign(VS1 &sl1, const VS2 &sl2)
167 #if(CXSC_INDEX_CHECK)
168  throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
169 #else
170  throw();
171 #endif
172  template <class VS1,class VS2> friend VS1 &_vsvsminusassign(VS1 &sl1, const VS2 &sl2)
173 #if(CXSC_INDEX_CHECK)
174  throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
175 #else
176  throw();
177 #endif
178  template <class V1,class V2> friend V1 &_vvminusassign(V1 &rv1, const V2 &rv2)
179 #if(CXSC_INDEX_CHECK)
180  throw(ERROR__OP_WITH_WRONG_DIM<V1>);
181 #else
182  throw();
183 #endif
184  template <class V,class VS> friend V &_vvsminusassign(V &rv, const VS &sl)
185 #if(CXSC_INDEX_CHECK)
186  throw(ERROR__OP_WITH_WRONG_DIM<V>);
187 #else
188  throw();
189 #endif
190  template <class VS,class V> friend VS &_vsvminusassign(VS &sl, const V &rv)
191 #if(CXSC_INDEX_CHECK)
192  throw(ERROR__OP_WITH_WRONG_DIM<VS>);
193 #else
194  throw();
195 #endif
196  template <class V> friend V _vminus(const V &rv) throw();
197  template <class VS,class V> friend V _vsminus(const VS &sl) throw();
198  template <class V1,class V2,class E> friend E _vvminus(const V1 &rv1, const V2 &rv2)
199 #if(CXSC_INDEX_CHECK)
200  throw(ERROR__OP_WITH_WRONG_DIM<E>);
201 #else
202  throw();
203 #endif
204  template <class V,class VS,class E> friend E _vvsminus(const V &rv, const VS &sl)
205 #if(CXSC_INDEX_CHECK)
206  throw(ERROR__OP_WITH_WRONG_DIM<E>);
207 #else
208  throw();
209 #endif
210  template <class VS,class V,class E> friend E _vsvminus(const VS &sl,const V &rv)
211 #if(CXSC_INDEX_CHECK)
212  throw(ERROR__OP_WITH_WRONG_DIM<E>);
213 #else
214  throw();
215 #endif
216  template <class MV1,class MV2,class E> friend E _mvmvplus(const MV1 &rv1, const MV2 &rv2)
217 #if(CXSC_INDEX_CHECK)
218  throw(ERROR__OP_WITH_WRONG_DIM<E>);
219 #else
220  throw();
221 #endif
222  template <class MV,class V,class E> friend E _mvvplus(const MV &rv1, const V &rv2)
223 #if(CXSC_INDEX_CHECK)
224  throw(ERROR__OP_WITH_WRONG_DIM<E>);
225 #else
226  throw();
227 #endif
228  template <class MV,class V,class E> friend E _mvvminus(const MV &rv1, const V &rv2)
229 #if(CXSC_INDEX_CHECK)
230  throw(ERROR__OP_WITH_WRONG_DIM<E>);
231 #else
232  throw();
233 #endif
234  template <class V,class MV,class E> friend E _vmvminus(const V &rv1, const MV &rv2)
235 #if(CXSC_INDEX_CHECK)
236  throw(ERROR__OP_WITH_WRONG_DIM<E>);
237 #else
238  throw();
239 #endif
240  template <class MV1,class MV2,class E> friend E _mvmvminus(const MV1 &rv1, const MV2 &rv2)
241 #if(CXSC_INDEX_CHECK)
242  throw(ERROR__OP_WITH_WRONG_DIM<E>);
243 #else
244  throw();
245 #endif
246 template <class MV,class V> friend MV &_mvvplusassign(MV &v,const V &rv)
247 #if(CXSC_INDEX_CHECK)
248  throw(ERROR__OP_WITH_WRONG_DIM<MV>);
249 #else
250  throw();
251 #endif
252 template <class MV,class V> friend MV &_mvvminusassign(MV &v,const V &rv)
253 #if(CXSC_INDEX_CHECK)
254  throw(ERROR__OP_WITH_WRONG_DIM<MV>);
255 #else
256  throw();
257 #endif
258 
259 
260 template <class DP,class V,class SV> friend void _vmvaccu(DP &dp, const V & rv1, const SV &rv2)
261 #if(CXSC_INDEX_CHECK)
262  throw(OP_WITH_WRONG_DIM);
263 #else
264  throw();
265 #endif
266  //--------- vector-scalar ----------------
267  template <class V,class S,class E> friend E _vsdiv(const V &rv, const S &s) throw();
268  template <class V,class S> friend V &_vsdivassign(V &rv,const S &r) throw();
269  template <class VS,class S,class E> friend E _vssdiv(const VS &sl, const S &s) throw();
270  template <class MV,class S,class E> friend E _mvsmult(const MV &rv, const S &s) throw();
271  template <class V,class S,class E> friend E _vsmult(const V &rv, const S &s) throw();
272  template <class VS,class S,class E> friend E _vssmult(const VS &sl, const S &s) throw();
273  template <class V1,class V2> friend bool _vveq(const V1 &rv1, const V2 &rv2) throw();
274  template <class VS,class V> friend bool _vsveq(const VS &sl, const V &rv) throw();
275  template <class V1,class V2> friend bool _vvneq(const V1 &rv1, const V2 &rv2) throw();
276  template <class VS,class V> friend bool _vsvneq(const VS &sl, const V &rv) throw();
277  template <class V1,class V2> friend bool _vvless(const V1 &rv1, const V2 &rv2) throw();
278  template <class VS,class V> friend bool _vsvless(const VS &sl, const V &rv) throw();
279  template <class V1,class V2> friend bool _vvleq(const V1 &rv1, const V2 &rv2) throw();
280  template <class VS,class V> friend bool _vsvleq(const VS &sl, const V &rv) throw();
281  template <class V,class VS> friend bool _vvsless(const V &rv, const VS &sl) throw();
282  template <class V,class VS> friend bool _vvsleq(const V &rv, const VS &sl) throw();
283  template <class V> friend bool _vnot(const V &rv) throw();
284  template <class V> friend void *_vvoid(const V &rv) throw();
285  template <class V,class E> friend E _vabs(const V &rv) throw();
286  template <class VS,class E> friend E _vsabs(const VS &sl) throw();
287  template <class VS1,class VS2> friend bool _vsvseq(const VS1 &sl1, const VS2 &sl2) throw();
288  template <class VS1,class VS2> friend bool _vsvsneq(const VS1 &sl1, const VS2 &sl2) throw();
289  template <class VS1,class VS2> friend bool _vsvsless(const VS1 &sl1, const VS2 &sl2) throw();
290  template <class VS1,class VS2> friend bool _vsvsleq(const VS1 &sl1, const VS2 &sl2) throw();
291  template <class VS> friend bool _vsnot(const VS &sl) throw();
292  template <class VS> friend void *_vsvoid(const VS &sl) throw();
293  template <class V> friend std::ostream &_vout(std::ostream &s, const V &rv) throw();
294  template <class V> friend std::istream &_vin(std::istream &s, V &rv) throw();
295 
296 template <class V,class MV2,class S> friend V &_vmvassign(V &v,const MV2 &rv) throw();
297  template <class MV,class S,class E> friend E _mvsdiv(const MV &rv, const S &s) throw();
298 
299 #endif
300 
301  private:
302  int *dat;
303  int l,u,size;
304 
305  public:
306  //------ Konstruktoren ----------------------------------------------------
308  INLINE intvector () throw();
309 #ifdef OLD_CXSC
310  explicit INLINE intvector(const class index &i) throw(); // for backwards compatibility
312 #endif
313  explicit INLINE intvector(const int &i1,const int &i2)
315 #if(CXSC_INDEX_CHECK)
316  throw(ERROR_INTVECTOR_WRONG_BOUNDARIES,ERROR_INTVECTOR_NO_MORE_MEMORY);
317 #else
318  throw();
319 #endif
320  INLINE intvector(const intmatrix_subv &) throw();
323  explicit INLINE intvector(const int &) throw();
325  explicit INLINE intvector(const intmatrix &)
326 #if(CXSC_INDEX_CHECK)
327  throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
328 #else
329  throw();
330 #endif
331  explicit INLINE intvector(const intmatrix_slice &sl)
333 #if(CXSC_INDEX_CHECK)
334  throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
335 #else
336  throw();
337 #endif
338  INLINE intvector(const intvector_slice &rs) throw();
341  INLINE intvector(const intvector &v) throw();
343  INLINE intvector &operator =(const intvector &rv) throw();
345  INLINE intvector &operator =(const intvector_slice &sl) throw();
347  INLINE intvector &operator =(const int &r) throw();
349  INLINE intvector &operator =(const intmatrix &)
350 #if(CXSC_INDEX_CHECK)
351  throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
352 #else
353  throw();
354 #endif
355  INLINE intvector &operator =(const intmatrix_slice &)
357 #if(CXSC_INDEX_CHECK)
358  throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
359 #else
360  throw();
361 #endif
362  INLINE intvector &operator =(const intmatrix_subv &) throw();
364 
365  //--------- Destruktor ----------------------------------------------------
366  INLINE ~intvector() { delete [] dat; }
367 
368  //------ Standardfunktionen -----------------------------------------------
369 
371  friend INLINE int Lb(const intvector &rv) throw() { return rv.l; }
373  friend INLINE int Ub(const intvector &rv) throw() { return rv.u; }
375  friend INLINE int VecLen(const intvector &rv) throw() { return rv.size; }
377  friend INLINE intvector &SetLb(intvector &rv, const int &l) throw() { rv.l=l; rv.u=l+rv.size-1; return rv; }
379  friend INLINE intvector &SetUb(intvector &rv, const int &u) throw() { rv.u=u; rv.l=u-rv.size+1; return rv; }
381  INLINE int & operator [](const int &i)
382 #if(CXSC_INDEX_CHECK)
383  throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC);
384 #else
385  throw();
386 #endif
387  INLINE const int &operator [](const int &i) const
389 #if(CXSC_INDEX_CHECK)
390  throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC);
391 #else
392  throw();
393 #endif
394  INLINE intvector & operator ()() throw() { return *this; }
397  INLINE intvector_slice operator ()(const int &i)
398 #if(CXSC_INDEX_CHECK)
399  throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG);
400 #else
401  throw();
402 #endif
403  INLINE intvector_slice operator ()(const int &i1,const int &i2)
405 #if(CXSC_INDEX_CHECK)
406  throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG);
407 #else
408  throw();
409 #endif
410 
411  INLINE operator void*() throw();
412 //#else
413 //#endif
414 };
415 
417 
423 {
424  friend class intvector;
425  friend class intmatrix;
426  private:
427  int *dat;
428  int l,u,size;
429  int start,end;
430 
431  public:
432 //#if(CXSC_INDEX_CHECK)
433 #ifdef _CXSC_FRIEND_TPL
434 //------------------------- Templates -------------------------------------------
435  template <class VS1,class VS2> friend VS1 & _vsvsassign(VS1 &sl1,const VS2 &sl2)
436 #if(CXSC_INDEX_CHECK)
437  throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
438 #else
439  throw();
440 #endif
441  template <class V,class VS,class S> friend V & _vvsassign(V &rv,const VS &sl) throw();
442  template <class VS,class V> friend VS & _vsvassign(VS &sl,const V &rv)
443 #if(CXSC_INDEX_CHECK)
444  throw(ERROR__OP_WITH_WRONG_DIM<VS>);
445 #else
446  throw();
447 #endif
448  template <class VS,class S> friend VS & _vssassign(VS &sl,const S &r) throw();
449  //-------- vector-scalar ------------------
450  template <class VS,class S> friend VS &_vssmultassign(VS &rv,const S &r) throw();
451  template <class VS,class S> friend VS &_vssdivassign(VS &rv,const S &r) throw();
452 
453  template <class VS,class V> friend bool _vsveq(const VS &sl, const V &rv) throw();
454  template <class VS,class V> friend bool _vsvneq(const VS &sl, const V &rv) throw();
455  template <class VS,class V> friend bool _vsvless(const VS &sl, const V &rv) throw();
456  template <class VS,class V> friend bool _vsvleq(const VS &sl, const V &rv) throw();
457  template <class V,class VS> friend bool _vvsless(const V &rv, const VS &sl) throw();
458  template <class V,class VS> friend bool _vvsleq(const V &rv, const VS &sl) throw();
459  template <class VS,class E> friend E _vsabs(const VS &sl) throw();
460  template <class VS1,class VS2> friend bool _vsvseq(const VS1 &sl1, const VS2 &sl2) throw();
461  template <class VS1,class VS2> friend bool _vsvsneq(const VS1 &sl1, const VS2 &sl2) throw();
462  template <class VS1,class VS2> friend bool _vsvsless(const VS1 &sl1, const VS2 &sl2) throw();
463  template <class VS1,class VS2> friend bool _vsvsleq(const VS1 &sl1, const VS2 &sl2) throw();
464  template <class VS> friend bool _vsnot(const VS &sl) throw();
465  template <class VS> friend void *_vsvoid(const VS &sl) throw();
466  template <class V> friend std::ostream &_vsout(std::ostream &s, const V &rv) throw();
467  template <class V> friend std::istream &_vsin(std::istream &s, V &rv) throw();
468  //------- vector-matrix ----------------
469  //------- vector-vector -----------------
470  template <class DP,class VS,class V> friend void _vsvaccu(DP &dp, const VS & sl, const V &rv)
471 #if(CXSC_INDEX_CHECK)
472  throw(OP_WITH_WRONG_DIM);
473 #else
474  throw();
475 #endif
476  template <class DP,class VS1,class VS2> friend void _vsvsaccu(DP &dp, const VS1 & sl1, const VS2 &sl2)
477 #if(CXSC_INDEX_CHECK)
478  throw(OP_WITH_WRONG_DIM);
479 #else
480  throw();
481 #endif
482  template <class VS,class S,class E> friend E _vssdiv(const VS &sl, const S &s) throw();
483  template <class VS,class S,class E> friend E _vssmult(const VS &sl, const S &s) throw();
484  template <class VS,class V,class E> friend E _vsvmult(const VS & sl, const V &rv)
485 #if(CXSC_INDEX_CHECK)
486  throw(ERROR__OP_WITH_WRONG_DIM<V>);
487 #else
488  throw();
489 #endif
490  template <class V,class VS,class E> friend E _vvsplus(const V &rv,const VS &sl)
491 #if(CXSC_INDEX_CHECK)
492  throw(ERROR__OP_WITH_WRONG_DIM<V>);
493 #else
494  throw();
495 #endif
496  template <class VS1,class VS2,class E> friend E _vsvsplus(const VS1 &s1,const VS2 &s2)
497 #if(CXSC_INDEX_CHECK)
498  throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
499 #else
500  throw();
501 #endif
502  template <class VS1,class VS2,class E> friend E _vsvsminus(const VS1 &s1,const VS2 &s2)
503 #if(CXSC_INDEX_CHECK)
504  throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
505 #else
506  throw();
507 #endif
508  template <class V,class VS> friend V &_vvsplusassign(V &rv, const VS &sl)
509 #if(CXSC_INDEX_CHECK)
510  throw(ERROR__OP_WITH_WRONG_DIM<V>);
511 #else
512  throw();
513 #endif
514  template <class VS,class V> friend VS &_vsvplusassign(VS &sl, const V &rv)
515 #if(CXSC_INDEX_CHECK)
516  throw(ERROR__OP_WITH_WRONG_DIM<VS>);
517 #else
518  throw();
519 #endif
520  template <class VS1,class VS2> friend VS1 &_vsvsplusassign(VS1 &sl1, const VS2 &sl2)
521 #if(CXSC_INDEX_CHECK)
522  throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
523 #else
524  throw();
525 #endif
526  template <class VS1,class VS2> friend VS1 &_vsvsminusassign(VS1 &sl1, const VS2 &sl2)
527 #if(CXSC_INDEX_CHECK)
528  throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
529 #else
530  throw();
531 #endif
532  template <class V,class VS> friend V &_vvsminusassign(V &rv, const VS &sl)
533 #if(CXSC_INDEX_CHECK)
534  throw(ERROR__OP_WITH_WRONG_DIM<V>);
535 #else
536  throw();
537 #endif
538  template <class VS,class V> friend VS &_vsvminusassign(VS &sl, const V &rv)
539 #if(CXSC_INDEX_CHECK)
540  throw(ERROR__OP_WITH_WRONG_DIM<VS>);
541 #else
542  throw();
543 #endif
544  template <class VS,class V> friend V _vsminus(const VS &sl) throw();
545  template <class V,class VS,class E> friend E _vvsminus(const V &rv, const VS &sl)
546 #if(CXSC_INDEX_CHECK)
547  throw(ERROR__OP_WITH_WRONG_DIM<E>);
548 #else
549  throw();
550 #endif
551  template <class VS,class V,class E> friend E _vsvminus(const VS &sl,const V &rv)
552 #if(CXSC_INDEX_CHECK)
553  throw(ERROR__OP_WITH_WRONG_DIM<E>);
554 #else
555  throw();
556 #endif
557  template <class VS1,class VS2,class E> friend E _vsvsmult(const VS1 & sl1, const VS2 &sl2)
558 #if(CXSC_INDEX_CHECK)
559  throw(ERROR__OP_WITH_WRONG_DIM<VS1>);
560 #else
561  throw();
562 #endif
563 
564 #endif
565 
566 
567  //--------------------- Konstruktoren -----------------------------------
569  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) { }
571  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) { }
572  public:
574  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) { }
575  public:
577  INLINE intvector_slice & operator =(const intvector_slice &sl)
578 #if(CXSC_INDEX_CHECK)
579  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
580 #else
581  throw();
582 #endif
583  INLINE intvector_slice & operator =(const intvector &rv)
585 #if(CXSC_INDEX_CHECK)
586  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
587 #else
588  throw();
589 #endif
590  INLINE intvector_slice & operator =(const int &r) throw();
593  INLINE intvector_slice & operator =(const intmatrix &m)
594 #if(CXSC_INDEX_CHECK)
595  throw(ERROR__OP_WITH_WRONG_DIM<intvector>,ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
596 #else
597  throw();
598 #endif
599  INLINE intvector_slice & operator =(const intmatrix_slice &m)
601 #if(CXSC_INDEX_CHECK)
602  throw(ERROR__OP_WITH_WRONG_DIM<intvector>,ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
603 #else
604  throw();
605 #endif
606  INLINE intvector_slice &operator =(const intmatrix_subv &) throw();
608 
609  //--------------------- Standardfunktionen ------------------------------
610 
612  friend INLINE int Lb(const intvector_slice &sl) throw() { return sl.start; }
614  friend INLINE int Ub(const intvector_slice &sl) throw() { return sl.end; }
616  friend INLINE int VecLen(const intvector_slice &sl) throw() { return sl.end-sl.start+1; }
618  INLINE int & operator [](const int &i)
619 #if(CXSC_INDEX_CHECK)
620  throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC);
621 #else
622  throw();
623 #endif
624  INLINE const int & operator [](const int &i) const
626 #if(CXSC_INDEX_CHECK)
627  throw(ERROR_INTVECTOR_ELEMENT_NOT_IN_VEC);
628 #else
629  throw();
630 #endif
631  INLINE intvector_slice & operator ()() throw() { return *this; }
634  INLINE intvector_slice operator ()(const int &i)
635 #if(CXSC_INDEX_CHECK)
636  throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG);
637 #else
638  throw();
639 #endif
640  INLINE intvector_slice operator ()(const int &i1,const int &i2)
642 #if(CXSC_INDEX_CHECK)
643  throw(ERROR_INTVECTOR_SUB_ARRAY_TOO_BIG);
644 #else
645  throw();
646 #endif
647 
649  INLINE intvector_slice &operator /=(const int &r) throw();
651  INLINE intvector_slice &operator *=(const int &r) throw();
653  INLINE intvector_slice &operator *=(const intmatrix &m)
654 #if(CXSC_INDEX_CHECK)
655  throw(ERROR_INTMATRIX_OP_WITH_WRONG_DIM);
656 #else
657  throw();
658 #endif
659  INLINE intvector_slice &operator +=(const intvector &rv)
661 #if(CXSC_INDEX_CHECK)
662  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
663 #else
664  throw();
665 #endif
666  INLINE intvector_slice &operator +=(const intvector_slice &sl2)
668 #if(CXSC_INDEX_CHECK)
669  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
670 #else
671  throw();
672 #endif
673  INLINE intvector_slice &operator -=(const intvector &rv)
675 #if(CXSC_INDEX_CHECK)
676  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
677 #else
678  throw();
679 #endif
680  INLINE intvector_slice &operator -=(const intvector_slice &sl2)
682 #if(CXSC_INDEX_CHECK)
683  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
684 #else
685  throw();
686 #endif
687  INLINE operator void*() throw();
688 //#else
689 //#endif
690 };
691 
692 //======================== Vector Functions =============================
693 
695  INLINE intvector _intvector(const int &r) throw();
696 // INLINE intvector _intvector(const intmatrix &m) throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
697 // INLINE intvector _intvector(const intmatrix_slice &sl) throw(ERROR_INTMATRIX_TYPE_CAST_OF_THICK_OBJ);
698 
700  INLINE void Resize(intvector &rv) throw();
702  INLINE void Resize(intvector &rv, const int &len)
703 #if(CXSC_INDEX_CHECK)
704  throw(ERROR__WRONG_BOUNDARIES<intvector>);
705 #else
706  throw();
707 #endif
708  INLINE void Resize(intvector &rv, const int &lb, const int &ub)
710 #if(CXSC_INDEX_CHECK)
711  throw(ERROR__WRONG_BOUNDARIES<intvector>);
712 #else
713  throw();
714 #endif
715 
717  INLINE intvector abs(const intvector &rv) throw();
719  INLINE intvector abs(const intvector_slice &sl) throw();
721  INLINE bool operator !(const intvector &rv) throw();
723  INLINE bool operator !(const intvector_slice &sl) throw();
724 
725 //======================= Vector / Scalar ===============================
726 
728  INLINE intvector operator *(const intvector &rv, const int &s) throw();
730  INLINE intvector operator *(const intvector_slice &sl, const int &s) throw();
732  INLINE intvector operator *(const int &s, const intvector &rv) throw();
734  INLINE intvector operator *(const int &s, const intvector_slice &sl) throw();
736  INLINE intvector &operator *=(intvector &rv,const int &r) throw();
737 
739  INLINE intvector operator /(const intvector &rv, const int &s) throw();
741  INLINE intvector operator /(const intvector_slice &sl, const int &s) throw();
743  INLINE intvector &operator /=(intvector &rv,const int &r) throw();
744 
745 //======================= Vector / Vector ===============================
746 
747 
748 
750  INLINE void accumulate(dotprecision &dp, const intvector & rv1, const intvector &rv2)
751 #if(CXSC_INDEX_CHECK)
752  throw(OP_WITH_WRONG_DIM);
753 #else
754  throw();
755 #endif
756  INLINE void accumulate(dotprecision &dp, const intvector & rv1, const intmatrix_subv &rv2)
758 #if(CXSC_INDEX_CHECK)
759  throw(OP_WITH_WRONG_DIM);
760 #else
761  throw();
762 #endif
763  INLINE void accumulate(dotprecision &dp, const intmatrix_subv & rv1, const intvector &rv2)
765 #if(CXSC_INDEX_CHECK)
766  throw(OP_WITH_WRONG_DIM);
767 #else
768  throw();
769 #endif
770  INLINE void accumulate(dotprecision &dp,const intvector_slice &sl,const intvector &rv)
772 #if(CXSC_INDEX_CHECK)
773  throw(OP_WITH_WRONG_DIM);
774 #else
775  throw();
776 #endif
777  INLINE void accumulate(dotprecision &dp,const intvector &rv,const intvector_slice &sl)
779 #if(CXSC_INDEX_CHECK)
780  throw(OP_WITH_WRONG_DIM);
781 #else
782  throw();
783 #endif
784  INLINE void accumulate(dotprecision &dp, const intvector_slice & sl1, const intvector_slice &sl2)
786 #if(CXSC_INDEX_CHECK)
787  throw(OP_WITH_WRONG_DIM);
788 #else
789  throw();
790 #endif
791 
792 
794  INLINE int operator *(const intvector & rv1, const intvector &rv2)
795 #if(CXSC_INDEX_CHECK)
796  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
797 #else
798  throw();
799 #endif
800  INLINE int operator *(const intvector_slice &sl, const intvector &rv)
802 #if(CXSC_INDEX_CHECK)
803  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
804 #else
805  throw();
806 #endif
807  INLINE int operator *(const intvector &rv, const intvector_slice &sl)
809 #if(CXSC_INDEX_CHECK)
810  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
811 #else
812  throw();
813 #endif
814  INLINE int operator *(const intvector_slice & sl1, const intvector_slice &sl2)
816 #if(CXSC_INDEX_CHECK)
817  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
818 #else
819  throw();
820 #endif
821 
823  INLINE const intvector &operator +(const intvector &rv) throw();
825  INLINE intvector operator +(const intvector_slice &sl) throw();
827  INLINE intvector operator +(const intvector &rv1, const intvector &rv2)
828 #if(CXSC_INDEX_CHECK)
829  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
830 #else
831  throw();
832 #endif
833  INLINE intvector operator +(const intvector &rv, const intvector_slice &sl)
835 #if(CXSC_INDEX_CHECK)
836  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
837 #else
838  throw();
839 #endif
840  INLINE intvector operator +(const intvector_slice &sl, const intvector &rv)
842 #if(CXSC_INDEX_CHECK)
843  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
844 #else
845  throw();
846 #endif
847  INLINE intvector operator +(const intvector_slice &sl1, const intvector_slice &sl2)
849 #if(CXSC_INDEX_CHECK)
850  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
851 #else
852  throw();
853 #endif
854  INLINE intvector & operator +=(intvector &rv1, const intvector &rv2)
856 #if(CXSC_INDEX_CHECK)
857  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
858 #else
859  throw();
860 #endif
861  INLINE intvector &operator +=(intvector &rv, const intvector_slice &sl)
863 #if(CXSC_INDEX_CHECK)
864  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
865 #else
866  throw();
867 #endif
868 
870  INLINE intvector operator -(const intvector &rv) throw();
872  INLINE intvector operator -(const intvector_slice &sl) throw();
874  INLINE intvector operator -(const intvector &rv1, const intvector &rv2)
875 #if(CXSC_INDEX_CHECK)
876  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
877 #else
878  throw();
879 #endif
880  INLINE intvector operator -(const intvector &rv, const intvector_slice &sl)
882 #if(CXSC_INDEX_CHECK)
883  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
884 #else
885  throw();
886 #endif
887  INLINE intvector operator -(const intvector_slice &sl, const intvector &rv)
889 #if(CXSC_INDEX_CHECK)
890  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
891 #else
892  throw();
893 #endif
894  INLINE intvector operator -(const intvector_slice &sl1, const intvector_slice &sl2)
896 #if(CXSC_INDEX_CHECK)
897  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
898 #else
899  throw();
900 #endif
901  INLINE intvector & operator -=(intvector &rv1, const intvector &rv2)
903 #if(CXSC_INDEX_CHECK)
904  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
905 #else
906  throw();
907 #endif
908  INLINE intvector &operator -=(intvector &rv, const intvector_slice &sl)
910 #if(CXSC_INDEX_CHECK)
911  throw(ERROR__OP_WITH_WRONG_DIM<intvector>);
912 #else
913  throw();
914 #endif
915 
917  INLINE bool operator ==(const intvector &rv1, const intvector &rv2) throw();
919  INLINE bool operator ==(const intvector_slice &sl1, const intvector_slice &sl2) throw();
921  INLINE bool operator ==(const intvector_slice &sl, const intvector &rv) throw();
923  INLINE bool operator ==(const intvector &rv, const intvector_slice &sl) throw();
925  INLINE bool operator !=(const intvector &rv1, const intvector &rv2) throw();
927  INLINE bool operator !=(const intvector_slice &sl1, const intvector_slice &sl2) throw();
929  INLINE bool operator !=(const intvector_slice &sl, const intvector &rv) throw();
931  INLINE bool operator !=(const intvector &rv, const intvector_slice &sl) throw();
933  INLINE bool operator <(const intvector &rv1, const intvector &rv2) throw();
935  INLINE bool operator <(const intvector_slice &sl1, const intvector_slice &sl2) throw();
937  INLINE bool operator < (const intvector_slice &sl, const intvector &rv) throw();
939  INLINE bool operator < (const intvector &rv, const intvector_slice &sl) throw();
941  INLINE bool operator <=(const intvector &rv1, const intvector &rv2) throw();
943  INLINE bool operator <=(const intvector_slice &sl1, const intvector_slice &sl2) throw();
945  INLINE bool operator <=(const intvector_slice &sl, const intvector &rv) throw();
947  INLINE bool operator <=(const intvector &rv, const intvector_slice &sl) throw();
949  INLINE bool operator >(const intvector &rv1, const intvector &rv2) throw();
951  INLINE bool operator >(const intvector_slice &sl1, const intvector_slice &sl2) throw();
953  INLINE bool operator >(const intvector_slice &sl, const intvector &rv) throw();
955  INLINE bool operator >(const intvector &rv, const intvector_slice &sl) throw();
957  INLINE bool operator >=(const intvector &rv1, const intvector &rv2) throw();
959  INLINE bool operator >=(const intvector_slice &sl1, const intvector_slice &sl2) throw();
961  INLINE bool operator >=(const intvector_slice &sl, const intvector &rv) throw();
963  INLINE bool operator >=(const intvector &rv, const intvector_slice &sl) throw();
964 
966  INLINE std::ostream &operator <<(std::ostream &s, const intvector &rv) throw();
968  INLINE std::ostream &operator <<(std::ostream &o, const intvector_slice &sl) throw();
970  INLINE std::istream &operator >>(std::istream &s, intvector &rv) throw();
972  INLINE std::istream &operator >>(std::istream &s, intvector_slice &rv) throw();
973 
974 
975  INLINE intvector perminv(const intvector&);
976 
977 extern void DoubleSize ( intvector& );
979 extern std::ostream& operator<< ( std::ostream&, intvector& );
980 
981 
982 
983 } // namespace cxsc
984 
985 #ifdef _CXSC_INCL_INL
986 #include "intvector.inl"
987 #include "vector.inl"
988 #endif
989 
990 
991 #endif
992 
intvector & operator()()
Operator for accessing the whole vector.
Definition: intvector.hpp:395
int & operator[](const int &i)
Operator for accessing the single elements of the vector.
Definition: intvector.inl:115
cimatrix & operator/=(cimatrix &m, const cinterval &c)
Implementation of division and allocation operation.
Definition: cimatrix.inl:1623
The Data Type intmatrix.
Definition: intmatrix.hpp:313
friend intvector & SetUb(intvector &rv, const int &u)
Sets the upper bound of the vector.
Definition: intvector.hpp:379
friend int VecLen(const intvector_slice &sl)
Returns the dimension of the vector.
Definition: intvector.hpp:616
The namespace cxsc, providing all functionality of the class library C-XSC.
Definition: cdot.cpp:29
civector operator*(const cimatrix_subv &rv, const cinterval &s)
Implementation of multiplication operation.
Definition: cimatrix.inl:731
The Data Type intmatrix_subv.
Definition: intmatrix.hpp:45
intvector_slice(const intvector_slice &a)
Constructor of class intvector_slice.
Definition: intvector.hpp:574
intvector_slice & operator()()
Operator for accessing the whole vector.
Definition: intvector.hpp:632
intvector_slice(intvector_slice &a, const int &lb, const int &ub)
Constructor of class intvector_slice.
Definition: intvector.hpp:571
void DoubleSize(cimatrix &A)
Doubles the size of the matrix.
Definition: cimatrix.cpp:83
friend int Ub(const intvector &rv)
Returns the upper bound of the vector.
Definition: intvector.hpp:373
intvector_slice & operator-=(const intvector &rv)
Implementation of subtraction and allocation operation.
Definition: intvector.inl:396
friend intvector & SetLb(intvector &rv, const int &l)
Sets the lower bound of the vector.
Definition: intvector.hpp:377
friend int VecLen(const intvector &rv)
Returns the dimension of the vector.
Definition: intvector.hpp:375
friend int Ub(const intvector_slice &sl)
Returns the upper bound of the vector.
Definition: intvector.hpp:614
int & operator[](const int &i)
Operator for accessing the single elements of the vector.
Definition: intvector.inl:76
void Resize(cimatrix &A)
Resizes the matrix.
Definition: cimatrix.inl:1211
intvector_slice & operator+=(const intvector &rv)
Implementation of addition and allocation operation.
Definition: intvector.inl:337
intvector_slice & operator*=(const int &r)
Implementation of multiplication and allocation operation.
Definition: intvector.inl:250
friend int Lb(const intvector &rv)
Returns the lower bound of the vector.
Definition: intvector.hpp:371
The Data Type intvector_slice.
Definition: intvector.hpp:422
The Data Type intmatrix_slice.
Definition: intmatrix.hpp:593
intvector _intvector(const int &r)
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC...
Definition: intvector.inl:220
intvector_slice & operator/=(const int &r)
Implementation of division and allocation operation.
Definition: intvector.inl:255
cdotprecision & operator+=(cdotprecision &cd, const l_complex &lc)
Implementation of standard algebraic addition and allocation operation.
Definition: cdot.inl:251
intvector_slice(intvector &a, const int &lb, const int &ub)
Constructor of class intvector_slice.
Definition: intvector.hpp:569
intvector()
Constructor of class intvector.
Definition: intvector.inl:33
civector operator/(const cimatrix_subv &rv, const cinterval &s)
Implementation of division operation.
Definition: cimatrix.inl:730
intvector_slice & operator=(const intvector_slice &sl)
Constructor of class intvector_slice.
Definition: intvector.inl:197
friend int Lb(const intvector_slice &sl)
Returns the lower bound of the vector.
Definition: intvector.hpp:612
intvector & operator=(const intvector &rv)
Implementation of standard assigning operator.
Definition: intvector.inl:193
cimatrix & operator*=(cimatrix &m, const cinterval &c)
Implementation of multiplication and allocation operation.
Definition: cimatrix.inl:1605
The Data Type intvector.
Definition: intvector.hpp:51
ivector abs(const cimatrix_subv &mv)
Returns the absolute value of the matrix.
Definition: cimatrix.inl:737