C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
cvector.inl
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: cvector.inl,v 1.28 2014/01/30 17:23:44 cxsc Exp $ */
25 
26 #ifndef _CXSC_CVECTOR_INL_INCLUDED
27 #define _CXSC_CVECTOR_INL_INCLUDED
28 
29 namespace cxsc {
30 
31  INLINE cvector::cvector () throw():dat(NULL),l(1),u(0),size(0)
32  {
33  }
34 
35  INLINE cvector::cvector(const int &i) throw():l(1),u(i),size(i)
36  {
37  dat=new complex[i];
38  }
39 
40 #ifdef OLD_CXSC
41  INLINE cvector::cvector(const class index &i) throw():l(1),u(i._int()),size(i._int())
42  {
43  dat=new complex[i._int()];
44  }
45 #endif
46 
47  INLINE cvector::cvector(const int &i1,const int &i2)
48 #if(CXSC_INDEX_CHECK)
49  throw(ERROR_CVECTOR_WRONG_BOUNDARIES,ERROR_CVECTOR_NO_MORE_MEMORY):l(i1),u(i2),size(i2-i1+1)
50 #else
51  throw():l(i1),u(i2),size(i2-i1+1)
52 #endif
53  {
54 #if(CXSC_INDEX_CHECK)
55  if(i1>i2) cxscthrow(ERROR_CVECTOR_WRONG_BOUNDARIES("cvector::cvector(const int &i1,const int &i2)"));
56 #endif
57  dat=new complex[size];
58  }
59 
60  INLINE cvector::cvector(const cvector_slice &rs) throw():l(rs.start),u(rs.end),size(rs.end-rs.start+1)
61  {
62  dat=new complex[size];
63  for(int i=0, j=l-rs.l;i<size;i++,j++)
64  dat[i]=rs.dat[j];
65  }
66 
67  INLINE cvector::cvector(const cvector &v) throw():l(v.l),u(v.u),size(v.size)
68  {
69  dat=new complex[size];
70  for (int i=0;i<size;i++)
71  dat[i]=v.dat[i];
72  }
73 
74  INLINE cvector::cvector(const complex &r) throw():l(1),u(1),size(1)
75  {
76  dat=new complex[1];
77  *dat=r;
78  }
79 
80  INLINE cvector::cvector(const rvector_slice &rs) throw():l(rs.start),u(rs.end),size(rs.end-rs.start+1)
81  {
82  dat=new complex[size];
83  for(int i=0, j=l-rs.l;i<size;i++,j++)
84  dat[i]=rs.dat[j];
85  }
86 
87  INLINE cvector::cvector(const rvector &v) throw():l(v.l),u(v.u),size(v.size)
88  {
89  dat=new complex[size];
90  for (int i=0;i<size;i++)
91  dat[i]=v.dat[i];
92  }
93 
94  INLINE cvector::cvector(const real &r) throw():l(1),u(1),size(1)
95  {
96  dat=new complex[1];
97  *dat=r;
98  }
99 
100  INLINE complex & cvector_slice::operator [](const int &i) const
101 #if(CXSC_INDEX_CHECK)
102  throw(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC)
103 #else
104  throw()
105 #endif
106  {
107 #if(CXSC_INDEX_CHECK)
108  if(i<start||i>end) cxscthrow(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC("complex & cvector_slice::operator [](const int &i) const"));
109 #endif
110  return dat[i-l];
111  }
112 
113  INLINE complex & cvector_slice::operator [](const int &i)
114 #if(CXSC_INDEX_CHECK)
115  throw(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC)
116 #else
117  throw()
118 #endif
119  {
120 #if(CXSC_INDEX_CHECK)
121  if(i<start||i>end) cxscthrow(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC("complex & cvector_slice::operator [](const int &i)"));
122 #endif
123  return dat[i-l];
124  }
125 
126  INLINE complex & cvector::operator [](const int &i) const
127 #if(CXSC_INDEX_CHECK)
128  throw(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC)
129 #else
130  throw()
131 #endif
132  {
133 #if(CXSC_INDEX_CHECK)
134  if(i<l||i>u) cxscthrow(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC("complex & cvector::operator [](const int &i) const"));
135 #endif
136  return dat[i-l];
137  }
138 
139  INLINE complex & cvector::operator [](const int &i)
140 #if(CXSC_INDEX_CHECK)
141  throw(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC)
142 #else
143  throw()
144 #endif
145  {
146 #if(CXSC_INDEX_CHECK)
147  if(i<l||i>u) cxscthrow(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC("complex & cvector::operator [](const int &i)"));
148 #endif
149  return dat[i-l];
150  }
151 
152 
159  INLINE cvector_slice cvector::operator ()(const int &i)
160 #if(CXSC_INDEX_CHECK)
161  throw(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG)
162 #else
163  throw()
164 #endif
165  {
166 #if(CXSC_INDEX_CHECK)
167  if(1<l||i>u) cxscthrow(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG("cvector_slice cvector::operator ()(const int &i)"));
168 #endif
169  return cvector_slice(*this,1,i);
170  }
171 
179  INLINE cvector_slice cvector::operator ()(const int &i1,const int &i2)
180 #if(CXSC_INDEX_CHECK)
181  throw(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG)
182 #else
183  throw()
184 #endif
185  {
186 #if(CXSC_INDEX_CHECK)
187  if(i1<l||i2>u) cxscthrow(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG("cvector_slice cvector::operator ()(const int &i1,const int &i2)"));
188 #endif
189  return cvector_slice(*this,i1,i2);
190  }
191 
193 #if(CXSC_INDEX_CHECK)
194  throw(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG)
195 #else
196  throw()
197 #endif
198  {
199 #if(CXSC_INDEX_CHECK)
200  if(1<start||i>end) cxscthrow(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG("cvector_slice cvector_slice::operator ()(const int &i)"));
201 #endif
202  return cvector_slice(*this,1,i);
203  }
204 
205  INLINE cvector_slice cvector_slice::operator ()(const int &i1,const int &i2)
206 #if(CXSC_INDEX_CHECK)
207  throw(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG)
208 #else
209  throw()
210 #endif
211  {
212 #if(CXSC_INDEX_CHECK)
213  if(i1<start||i2>end) cxscthrow(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG("cvector_slice cvector_slice::operator ()(const int &i1,const int &i2)"));
214 #endif
215  return cvector_slice(*this,i1,i2);
216  }
217 
218  INLINE complex::complex(const cvector &rv)
219 #if(CXSC_INDEX_CHECK)
220  throw(ERROR_CVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_CVECTOR_USE_OF_UNINITIALIZED_OBJ)
221 #else
222  throw()
223 #endif
224  {
225 #if(CXSC_INDEX_CHECK)
226  if(rv.size>1) cxscthrow(ERROR_CVECTOR_TYPE_CAST_OF_THICK_OBJ("complex::complex(const cvector &rv)"));
227  else if(rv.size<1) cxscthrow(ERROR_CVECTOR_USE_OF_UNINITIALIZED_OBJ("complex::complex(const cvector &rv)"));
228 #endif
229  *this=rv.dat[0];
230  }
231 
232  INLINE complex::complex(const cvector_slice &sl)
233 #if(CXSC_INDEX_CHECK)
234  throw(ERROR_CVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_CVECTOR_USE_OF_UNINITIALIZED_OBJ)
235 #else
236  throw()
237 #endif
238  {
239 #if(CXSC_INDEX_CHECK)
240  if(sl.size>1) cxscthrow(ERROR_CVECTOR_TYPE_CAST_OF_THICK_OBJ("complex::complex(const cvector_slice &sl)"));
241  else if(sl.size<1) cxscthrow(ERROR_CVECTOR_USE_OF_UNINITIALIZED_OBJ("complex::complex(const cvector_slice &sl)"));
242 #endif
243  *this=sl.dat[sl.start-sl.l];
244  }
245 
251  INLINE cvector _cvector(const complex &r) throw() { return cvector(r); }
257  INLINE cvector _cvector(const real &r) throw() { return cvector(r); }
263  INLINE cvector _cvector(const rvector_slice &rs) throw() { return cvector(rs); }
269  INLINE cvector _cvector(const rvector &rs) throw() { return cvector(rs); }
275  INLINE cvector _cvector(const rmatrix_subv &rs) throw() { return cvector(rs); }
276  INLINE cvector &cvector::operator =(const cvector &rv) throw() { return _vvassign<cvector,cvector,complex>(*this,rv); }
277  INLINE cvector &cvector::operator =(const complex &r) throw() { return _vsassign<cvector,complex>(*this,r); }
278  INLINE cvector &cvector::operator =(const rvector &rv) throw() { return _vvassign<cvector,rvector,complex>(*this,rv); }
279  INLINE cvector &cvector::operator =(const real &r) throw() { return _vsassign<cvector,real>(*this,r); }
280  INLINE cvector::operator void*() throw() { return _vvoid(*this); }
282 #if(CXSC_INDEX_CHECK)
283  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
284 #else
285  throw()
286 #endif
287  { return _vsvsassign(*this,sl); }
289 #if(CXSC_INDEX_CHECK)
290  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
291 #else
292  throw()
293 #endif
294  { return _vsvassign(*this,rv); }
295  INLINE cvector_slice & cvector_slice::operator =(const complex &r) throw() { return _vssassign<cvector_slice,complex>(*this,r); }
297 #if(CXSC_INDEX_CHECK)
298  throw(ERROR__OP_WITH_WRONG_DIM<cvector>,ERROR_CMATRIX_TYPE_CAST_OF_THICK_OBJ)
299 #else
300  throw()
301 #endif
302  { return _vsvassign(*this,cvector(m)); }
304 #if(CXSC_INDEX_CHECK)
305  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
306 #else
307  throw()
308 #endif
309  { return _vsvsassign(*this,sl); }
311 #if(CXSC_INDEX_CHECK)
312  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
313 #else
314  throw()
315 #endif
316  { return _vsvassign(*this,rv); }
317  INLINE cvector_slice & cvector_slice::operator =(const real &r) throw() { return _vssassign(*this,r); }
318  INLINE cvector_slice::operator void*() throw() { return _vsvoid(*this); }
319 
320 //=======================================================================
321 //======================== Vector Functions =============================
322 
323  INLINE cvector &SetRe(cvector &iv,const rvector &rv)
324 #if(CXSC_INDEX_CHECK)
325  throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
326 #else
327  throw()
328 #endif
329  { return iv;} // S.W. temp return _vvsetre(iv,rv); }
330  INLINE cvector_slice &SetRe(cvector_slice &iv,const rvector &rv)
331 #if(CXSC_INDEX_CHECK)
332  throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
333 #else
334  throw()
335 #endif
336  { return _vsvsetre(iv,rv); }
337  INLINE cvector &SetRe(cvector &iv,const rvector_slice &rv)
338 #if(CXSC_INDEX_CHECK)
339  throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
340 #else
341  throw()
342 #endif
343  { return _vvssetre(iv,rv); }
344  INLINE cvector_slice &SetRe(cvector_slice &iv,const rvector_slice &rv)
345 #if(CXSC_INDEX_CHECK)
346  throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
347 #else
348  throw()
349 #endif
350  { return _vsvssetre(iv,rv); }
351 
352  INLINE cvector &SetIm(cvector &iv,const rvector &rv)
353 #if(CXSC_INDEX_CHECK)
354  throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
355 #else
356  throw()
357 #endif
358  { return _vvsetim(iv,rv); }
359  INLINE cvector_slice &SetIm(cvector_slice &iv,const rvector &rv)
360 #if(CXSC_INDEX_CHECK)
361  throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
362 #else
363  throw()
364 #endif
365  { return _vsvsetim(iv,rv); }
366  INLINE cvector &SetIm(cvector &iv,const rvector_slice &rv)
367 #if(CXSC_INDEX_CHECK)
368  throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
369 #else
370  throw()
371 #endif
372  { return _vvssetim(iv,rv); }
373  INLINE cvector_slice &SetIm(cvector_slice &iv,const rvector_slice &rv)
374 #if(CXSC_INDEX_CHECK)
375  throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
376 #else
377  throw()
378 #endif
379  { return _vsvssetim(iv,rv); }
380 
381  INLINE cvector &SetRe(cvector &iv,const real &r) throw() { return _vssetre(iv,r); }
382  INLINE cvector &SetIm(cvector &iv,const real &r) throw() { return _vssetim(iv,r); }
383  INLINE cvector_slice &SetRe(cvector_slice &iv,const real &r) throw() { return _vsssetre(iv,r); }
384  INLINE cvector_slice &SetIm(cvector_slice &iv,const real &r) throw() { return _vsssetim(iv,r); }
385 
386  INLINE void Resize(cvector &rv) throw() { _vresize(rv); }
387  INLINE void Resize(cvector &rv, const int &len)
388 #if(CXSC_INDEX_CHECK)
389  throw(ERROR__WRONG_BOUNDARIES<cvector>)
390 #else
391  throw()
392 #endif
393  { _vresize<class cvector,class complex>(rv,len); }
394  INLINE void Resize(cvector &rv, const int &lb, const int &ub)
395 #if(CXSC_INDEX_CHECK)
396  throw(ERROR__WRONG_BOUNDARIES<cvector>)
397 #else
398  throw()
399 #endif
400  { _vresize<class cvector,class complex>(rv,lb,ub); }
401 
402  INLINE cvector conj(const cvector &rv) throw() { return _vconj<cvector>(rv); }
403  INLINE cvector conj(const cvector_slice &sl) throw() { return _vsconj<cvector_slice,cvector>(sl); }
404 
405  INLINE rvector abs(const cvector &rv) throw() { return _vabs<cvector,rvector>(rv); }
406  INLINE rvector abs(const cvector_slice &sl) throw() { return _vsabs<cvector_slice,rvector>(sl); }
407  INLINE rvector Im(const cvector &v) throw() { return _vim<cvector,rvector>(v); }
408  INLINE rvector Im(const cvector_slice &v) throw() { return _vsim<cvector_slice,rvector>(v); }
409  INLINE rvector Re(const cvector &v) throw() { return _vre<cvector,rvector>(v); }
410  INLINE rvector Re(const cvector_slice &v) throw() { return _vsre<cvector_slice,rvector>(v); }
411  INLINE bool operator !(const cvector &rv) throw() { return _vnot(rv); }
412  INLINE bool operator !(const cvector_slice &sl) throw() { return _vsnot(sl); }
413 
414 //======================= Vector / Scalar ===============================
415 
416 //----------------------------- complex ---------------------------
417 
418  INLINE cvector operator *(const cvector &rv, const complex &s) throw() { return _vsmult<cvector,complex,cvector>(rv,s); }
419  INLINE cvector operator *(const cvector_slice &sl, const complex &s) throw() { return _vssmult<cvector_slice,complex,cvector>(sl,s); }
420  INLINE cvector operator *(const complex &s, const cvector &rv) throw() { return _vsmult<cvector,complex,cvector>(rv,s); }
421  INLINE cvector operator *(const complex &s, const cvector_slice &sl) throw() { return _vssmult<cvector_slice,complex,cvector>(sl,s); }
422  INLINE cvector &operator *=(cvector &rv,const complex &r) throw() { return _vsmultassign(rv,r); }
423  INLINE cvector_slice &cvector_slice::operator *=(const complex &r) throw() { return _vssmultassign(*this,r); }
424 
425  INLINE cvector operator /(const cvector &rv, const complex &s) throw() { return _vsdiv<cvector,complex,cvector>(rv,s); }
426  INLINE cvector operator /(const cvector_slice &sl, const complex &s) throw() { return _vssdiv<cvector_slice,complex,cvector>(sl,s); }
427  INLINE cvector &operator /=(cvector &rv,const complex &r) throw() { return _vsdivassign(rv,r); }
428  INLINE cvector_slice &cvector_slice::operator /=(const complex &r) throw() { return _vssdivassign(*this,r); }
429 
430 //---------------------------- Real --------------------------------------
431 
432  INLINE cvector operator *(const cvector &rv, const real &s) throw() { return _vsmult<cvector,real,cvector>(rv,s); }
433  INLINE cvector operator *(const cvector_slice &sl, const real &s) throw() { return _vssmult<cvector_slice,real,cvector>(sl,s); }
434  INLINE cvector operator *(const real &s, const cvector &rv) throw() { return _vsmult<cvector,real,cvector>(rv,s); }
435  INLINE cvector operator *(const real &s, const cvector_slice &sl) throw() { return _vssmult<cvector_slice,real,cvector>(sl,s); }
436  INLINE cvector &operator *=(cvector &rv,const real &r) throw() { return _vsmultassign(rv,r); }
437  INLINE cvector_slice &cvector_slice::operator *=(const real &r) throw() { return _vssmultassign(*this,r); }
438 
439  INLINE cvector operator /(const cvector &rv, const real &s) throw() { return _vsdiv<cvector,real,cvector>(rv,s); }
440  INLINE cvector operator /(const cvector_slice &sl, const real &s) throw() { return _vssdiv<cvector_slice,real,cvector>(sl,s); }
441  INLINE cvector &operator /=(cvector &rv,const real &r) throw() { return _vsdivassign(rv,r); }
442  INLINE cvector_slice &cvector_slice::operator /=(const real &r) throw() { return _vssdivassign(*this,r); }
443 
444  INLINE cvector operator *(const rvector &rv, const complex &s) throw() { return _vsmult<rvector,complex,cvector>(rv,s); }
445  INLINE cvector operator *(const rvector_slice &sl, const complex &s) throw() { return _vssmult<rvector_slice,complex,cvector>(sl,s); }
446  INLINE cvector operator *(const complex &s, const rvector &rv) throw() { return _vsmult<rvector,complex,cvector>(rv,s); }
447  INLINE cvector operator *(const complex &s, const rvector_slice &sl) throw() { return _vssmult<rvector_slice,complex,cvector>(sl,s); }
448 
449  INLINE cvector operator /(const rvector &rv, const complex &s) throw() { return _vsdiv<rvector,complex,cvector>(rv,s); }
450  INLINE cvector operator /(const rvector_slice &sl, const complex &s) throw() { return _vssdiv<rvector_slice,complex,cvector>(sl,s); }
451 
452 //======================= Vector / Vector ===============================
453 
454 
455  INLINE std::ostream &operator <<(std::ostream &s, const cvector &rv) throw() { return _vout(s,rv); }
456  INLINE std::ostream &operator <<(std::ostream &o, const cvector_slice &sl) throw() { return _vsout(o,sl); }
457  INLINE std::istream &operator >>(std::istream &s, cvector &rv) throw() { return _vin(s,rv); }
458  INLINE std::istream &operator >>(std::istream &s, cvector_slice &rv) throw() { return _vsin(s,rv); }
459 
460 //----------------------- complex / complex ---------------------------
461  INLINE cvector & cvector::operator =(const cvector_slice &sl) throw() { return _vvsassign<cvector,cvector_slice,complex>(*this,sl); }
462 
463 
464 
465  INLINE complex operator *(const cvector & rv1, const cvector &rv2)
466 #if(CXSC_INDEX_CHECK)
467  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
468 #else
469  throw()
470 #endif
471  { return _vvcmult<cvector,cvector,complex>(rv1,rv2); }
472  INLINE complex operator *(const cvector_slice &sl, const cvector &rv)
473 #if(CXSC_INDEX_CHECK)
474  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
475 #else
476  throw()
477 #endif
478  { return _vsvcmult<cvector_slice,cvector,complex>(sl,rv); }
479  INLINE complex operator *(const cvector &rv, const cvector_slice &sl)
480 #if(CXSC_INDEX_CHECK)
481  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
482 #else
483  throw()
484 #endif
485  { return _vsvcmult<cvector_slice,cvector,complex>(sl,rv); }
486  INLINE complex operator *(const cvector_slice & sl1, const cvector_slice &sl2)
487 #if(CXSC_INDEX_CHECK)
488  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
489 #else
490  throw()
491 #endif
492  { return _vsvscmult<cvector_slice,cvector_slice,complex>(sl1,sl2); }
493 
494  INLINE const cvector &operator +(const cvector &rv) throw() { return rv; }
495  INLINE cvector operator +(const cvector_slice &sl) throw() { return sl; }
496  INLINE cvector operator +(const cvector &rv1, const cvector &rv2)
497 #if(CXSC_INDEX_CHECK)
498  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
499 #else
500  throw()
501 #endif
502  { return _vvplus<cvector,cvector,cvector>(rv1,rv2); }
503  INLINE cvector operator +(const cvector &rv, const cvector_slice &sl)
504 #if(CXSC_INDEX_CHECK)
505  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
506 #else
507  throw()
508 #endif
509  { return _vvsplus<cvector,cvector_slice,cvector>(rv,sl); }
510  INLINE cvector operator +(const cvector_slice &sl, const cvector &rv)
511 #if(CXSC_INDEX_CHECK)
512  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
513 #else
514  throw()
515 #endif
516  { return _vvsplus<cvector,cvector_slice,cvector>(rv,sl); }
517  INLINE cvector operator +(const cvector_slice &sl1, const cvector_slice &sl2)
518 #if(CXSC_INDEX_CHECK)
519  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
520 #else
521  throw()
522 #endif
523  { return _vsvsplus<cvector_slice,cvector_slice,cvector>(sl1,sl2); }
524  INLINE cvector & operator +=(cvector &rv1, const cvector &rv2)
525 #if(CXSC_INDEX_CHECK)
526  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
527 #else
528  throw()
529 #endif
530  { return _vvplusassign(rv1,rv2); }
531  INLINE cvector &operator +=(cvector &rv, const cvector_slice &sl)
532 #if(CXSC_INDEX_CHECK)
533  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
534 #else
535  throw()
536 #endif
537  { return _vvsplusassign(rv,sl); }
539 #if(CXSC_INDEX_CHECK)
540  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
541 #else
542  throw()
543 #endif
544  { return _vsvplusassign(*this,rv); }
546 #if(CXSC_INDEX_CHECK)
547  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
548 #else
549  throw()
550 #endif
551  { return _vsvsplusassign(*this,sl2); }
552 
553  INLINE cvector operator -(const cvector &rv) throw() { return _vminus(rv); }
554  INLINE cvector operator -(const cvector_slice &sl) throw() { return _vsminus<cvector_slice,cvector>(sl); }
555  INLINE cvector operator -(const cvector &rv1, const cvector &rv2)
556 #if(CXSC_INDEX_CHECK)
557  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
558 #else
559  throw()
560 #endif
561  { return _vvminus<cvector,cvector,cvector>(rv1,rv2); }
562  INLINE cvector operator -(const cvector &rv, const cvector_slice &sl)
563 #if(CXSC_INDEX_CHECK)
564  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
565 #else
566  throw()
567 #endif
568  { return _vvsminus<cvector,cvector_slice,cvector>(rv,sl); }
569  INLINE cvector operator -(const cvector_slice &sl, const cvector &rv)
570 #if(CXSC_INDEX_CHECK)
571  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
572 #else
573  throw()
574 #endif
575  { return _vsvminus<cvector_slice,cvector,cvector>(sl,rv); }
576  INLINE cvector operator -(const cvector_slice &sl1, const cvector_slice &sl2)
577 #if(CXSC_INDEX_CHECK)
578  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
579 #else
580  throw()
581 #endif
582  { return _vsvsminus<cvector_slice,cvector_slice,cvector>(sl1,sl2); }
583  INLINE cvector & operator -=(cvector &rv1, const cvector &rv2)
584 #if(CXSC_INDEX_CHECK)
585  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
586 #else
587  throw()
588 #endif
589  { return _vvminusassign(rv1,rv2); }
590  INLINE cvector &operator -=(cvector &rv, const cvector_slice &sl)
591 #if(CXSC_INDEX_CHECK)
592  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
593 #else
594  throw()
595 #endif
596  { return _vvsminusassign(rv,sl); }
598 #if(CXSC_INDEX_CHECK)
599  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
600 #else
601  throw()
602 #endif
603  { return _vsvminusassign(*this,rv); }
605 #if(CXSC_INDEX_CHECK)
606  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
607 #else
608  throw()
609 #endif
610  { return _vsvsminusassign(*this,sl2); }
611 
612  INLINE bool operator ==(const cvector &rv1, const cvector &rv2) throw() { return _vveq(rv1,rv2); }
613  INLINE bool operator ==(const cvector_slice &sl1, const cvector_slice &sl2) throw() { return _vsvseq(sl1,sl2); }
614  INLINE bool operator ==(const cvector_slice &sl, const cvector &rv) throw() { return _vsveq(sl,rv); }
615  INLINE bool operator ==(const cvector &rv, const cvector_slice &sl) throw() { return _vsveq(sl,rv); }
616  INLINE bool operator !=(const cvector &rv1, const cvector &rv2) throw() { return _vvneq(rv1,rv2); }
617  INLINE bool operator !=(const cvector_slice &sl1, const cvector_slice &sl2) throw() { return _vsvsneq(sl1,sl2); }
618  INLINE bool operator !=(const cvector_slice &sl, const cvector &rv) throw() { return _vsvneq(sl,rv); }
619  INLINE bool operator !=(const cvector &rv, const cvector_slice &sl) throw() { return _vsvneq(sl,rv); }
620 /* INLINE bool operator <(const cvector &rv1, const cvector &rv2) throw() { return _vvless(rv1,rv2); }
621  INLINE bool operator <(const cvector_slice &sl1, const cvector_slice &sl2) throw() { return _vsvsless(sl1,sl2); }
622  INLINE bool operator < (const cvector_slice &sl, const cvector &rv) throw() { return _vsvless(sl,rv); }
623  INLINE bool operator < (const cvector &rv, const cvector_slice &sl) throw() { return _vvsless(rv,sl); }
624  INLINE bool operator <=(const cvector &rv1, const cvector &rv2) throw() { return _vvleq(rv1,rv2); }
625  INLINE bool operator <=(const cvector_slice &sl1, const cvector_slice &sl2) throw() { return _vsvsleq(sl1,sl2); }
626  INLINE bool operator <=(const cvector_slice &sl, const cvector &rv) throw() { return _vsvleq(sl,rv); }
627  INLINE bool operator <=(const cvector &rv, const cvector_slice &sl) throw() { return _vvsleq(rv,sl); }
628  INLINE bool operator >(const cvector &rv1, const cvector &rv2) throw() { return _vvless(rv2,rv1); }
629  INLINE bool operator >(const cvector_slice &sl1, const cvector_slice &sl2) throw() { return _vsvsless(sl2,sl1); }
630  INLINE bool operator >(const cvector_slice &sl, const cvector &rv) throw() { return _vvsless(rv,sl); }
631  INLINE bool operator >(const cvector &rv, const cvector_slice &sl) throw() { return _vsvless(sl,rv); }
632  INLINE bool operator >=(const cvector &rv1, const cvector &rv2) throw() { return _vvleq(rv2,rv1); }
633  INLINE bool operator >=(const cvector_slice &sl1, const cvector_slice &sl2) throw() { return _vsvsleq(sl2,sl1); }
634  INLINE bool operator >=(const cvector_slice &sl, const cvector &rv) throw() { return _vvsleq(rv,sl); }
635  INLINE bool operator >=(const cvector &rv, const cvector_slice &sl) throw() { return _vsvleq(sl,rv); }
636 */
637 //-------------------------------- complex / Real --------------------------------
638 
639  INLINE cvector & cvector::operator =(const rvector_slice &sl) throw() { return _vvsassign<cvector,rvector_slice,complex>(*this,sl); }
640 
641 
642  INLINE complex operator *(const rvector & rv1, const cvector &rv2)
643 #if(CXSC_INDEX_CHECK)
644  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
645 #else
646  throw()
647 #endif
648  { return _vvcmult<rvector,cvector,complex>(rv1,rv2); }
649  INLINE complex operator *(const rvector_slice &sl, const cvector &rv)
650 #if(CXSC_INDEX_CHECK)
651  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
652 #else
653  throw()
654 #endif
655  { return _vsvcmult<rvector_slice,cvector,complex>(sl,rv); }
656  INLINE complex operator *(const rvector &rv, const cvector_slice &sl)
657 #if(CXSC_INDEX_CHECK)
658  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
659 #else
660  throw()
661 #endif
662  { return _vsvcmult<cvector_slice,rvector,complex>(sl,rv); }
663  INLINE complex operator *(const rvector_slice & sl1, const cvector_slice &sl2)
664 #if(CXSC_INDEX_CHECK)
665  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
666 #else
667  throw()
668 #endif
669  { return _vsvscmult<rvector_slice,cvector_slice,complex>(sl1,sl2); }
670 
671  INLINE complex operator *(const cvector & rv1, const rvector &rv2)
672 #if(CXSC_INDEX_CHECK)
673  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
674 #else
675  throw()
676 #endif
677  { return _vvcmult<rvector,cvector,complex>(rv2,rv1); }
678  INLINE complex operator *(const cvector_slice &sl, const rvector &rv)
679 #if(CXSC_INDEX_CHECK)
680  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
681 #else
682  throw()
683 #endif
684  { return _vsvcmult<cvector_slice,rvector,complex>(sl,rv); }
685  INLINE complex operator *(const cvector &rv, const rvector_slice &sl)
686 #if(CXSC_INDEX_CHECK)
687  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
688 #else
689  throw()
690 #endif
691  { return _vsvcmult<rvector_slice,cvector,complex>(sl,rv); }
692  INLINE complex operator *(const cvector_slice & sl1, const rvector_slice &sl2)
693 #if(CXSC_INDEX_CHECK)
694  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
695 #else
696  throw()
697 #endif
698  { return _vsvscmult<rvector_slice,cvector_slice,complex>(sl2,sl1); }
699 
700  INLINE cvector operator +(const rvector &rv1, const cvector &rv2)
701 #if(CXSC_INDEX_CHECK)
702  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
703 #else
704  throw()
705 #endif
706  { return _vvplus<rvector,cvector,cvector>(rv1,rv2); }
707  INLINE cvector operator +(const rvector &rv, const cvector_slice &sl)
708 #if(CXSC_INDEX_CHECK)
709  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
710 #else
711  throw()
712 #endif
713  { return _vvsplus<rvector,cvector_slice,cvector>(rv,sl); }
714  INLINE cvector operator +(const rvector_slice &sl, const cvector &rv)
715 #if(CXSC_INDEX_CHECK)
716  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
717 #else
718  throw()
719 #endif
720  { return _vvsplus<cvector,rvector_slice,cvector>(rv,sl); }
721  INLINE cvector operator +(const rvector_slice &sl1, const cvector_slice &sl2)
722 #if(CXSC_INDEX_CHECK)
723  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
724 #else
725  throw()
726 #endif
727  { return _vsvsplus<rvector_slice,cvector_slice,cvector>(sl1,sl2); }
728 
729  INLINE cvector operator +(const cvector &rv1, const rvector &rv2)
730 #if(CXSC_INDEX_CHECK)
731  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
732 #else
733  throw()
734 #endif
735  { return _vvplus<rvector,cvector,cvector>(rv2,rv1); }
736  INLINE cvector operator +(const cvector &rv, const rvector_slice &sl)
737 #if(CXSC_INDEX_CHECK)
738  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
739 #else
740  throw()
741 #endif
742  { return _vvsplus<cvector,rvector_slice,cvector>(rv,sl); }
743  INLINE cvector operator +(const cvector_slice &sl, const rvector &rv)
744 #if(CXSC_INDEX_CHECK)
745  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
746 #else
747  throw()
748 #endif
749  { return _vvsplus<rvector,cvector_slice,cvector>(rv,sl); }
750  INLINE cvector operator +(const cvector_slice &sl1, const rvector_slice &sl2)
751 #if(CXSC_INDEX_CHECK)
752  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
753 #else
754  throw()
755 #endif
756  { return _vsvsplus<rvector_slice,cvector_slice,cvector>(sl2,sl1); }
757 
758  INLINE cvector & operator +=(cvector &rv1, const rvector &rv2)
759 #if(CXSC_INDEX_CHECK)
760  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
761 #else
762  throw()
763 #endif
764  { return _vvplusassign(rv1,rv2); }
765  INLINE cvector &operator +=(cvector &rv, const rvector_slice &sl)
766 #if(CXSC_INDEX_CHECK)
767  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
768 #else
769  throw()
770 #endif
771  { return _vvsplusassign(rv,sl); }
773 #if(CXSC_INDEX_CHECK)
774  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
775 #else
776  throw()
777 #endif
778  { return _vsvplusassign(*this,rv); }
780 #if(CXSC_INDEX_CHECK)
781  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
782 #else
783  throw()
784 #endif
785  { return _vsvsplusassign(*this,sl2); }
786 
787  INLINE cvector operator -(const rvector &rv1, const cvector &rv2)
788 #if(CXSC_INDEX_CHECK)
789  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
790 #else
791  throw()
792 #endif
793  { return _vvminus<rvector,cvector,cvector>(rv1,rv2); }
794  INLINE cvector operator -(const rvector &rv, const cvector_slice &sl)
795 #if(CXSC_INDEX_CHECK)
796  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
797 #else
798  throw()
799 #endif
800  { return _vvsminus<rvector,cvector_slice,cvector>(rv,sl); }
801  INLINE cvector operator -(const rvector_slice &sl, const cvector &rv)
802 #if(CXSC_INDEX_CHECK)
803  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
804 #else
805  throw()
806 #endif
807  { return _vsvminus<rvector_slice,cvector,cvector>(sl,rv); }
808  INLINE cvector operator -(const rvector_slice &sl1, const cvector_slice &sl2)
809 #if(CXSC_INDEX_CHECK)
810  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
811 #else
812  throw()
813 #endif
814  { return _vsvsminus<rvector_slice,cvector_slice,cvector>(sl1,sl2); }
815 
816  INLINE cvector operator -(const cvector &rv1, const rvector &rv2)
817 #if(CXSC_INDEX_CHECK)
818  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
819 #else
820  throw()
821 #endif
822  { return _vvminus<cvector,rvector,cvector>(rv1,rv2); }
823  INLINE cvector operator -(const cvector &rv, const rvector_slice &sl)
824 #if(CXSC_INDEX_CHECK)
825  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
826 #else
827  throw()
828 #endif
829  { return _vvsminus<cvector,rvector_slice,cvector>(rv,sl); }
830  INLINE cvector operator -(const cvector_slice &sl, const rvector &rv)
831 #if(CXSC_INDEX_CHECK)
832  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
833 #else
834  throw()
835 #endif
836  { return _vsvminus<cvector_slice,rvector,cvector>(sl,rv); }
837  INLINE cvector operator -(const cvector_slice &sl1, const rvector_slice &sl2)
838 #if(CXSC_INDEX_CHECK)
839  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
840 #else
841  throw()
842 #endif
843  { return _vsvsminus<cvector_slice,rvector_slice,cvector>(sl1,sl2); }
844 
845  INLINE cvector & operator -=(cvector &rv1, const rvector &rv2)
846 #if(CXSC_INDEX_CHECK)
847  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
848 #else
849  throw()
850 #endif
851  { return _vvminusassign(rv1,rv2); }
852  INLINE cvector &operator -=(cvector &rv, const rvector_slice &sl)
853 #if(CXSC_INDEX_CHECK)
854  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
855 #else
856  throw()
857 #endif
858  { return _vvsminusassign(rv,sl); }
860 #if(CXSC_INDEX_CHECK)
861  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
862 #else
863  throw()
864 #endif
865  { return _vsvminusassign(*this,rv); }
867 #if(CXSC_INDEX_CHECK)
868  throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
869 #else
870  throw()
871 #endif
872  { return _vsvsminusassign(*this,sl2); }
873 
876  cvector x(*this);
877  for(int i=0 ; i<VecLen(x) ; i++)
878  x[i+Lb(x)] = (*this)[p[i+Lb(p)]+Lb(*this)];
879  return x;
880  }
881 
882 } // namespace cxsc
883 
884 #endif // _CXSC_CVECTOR_INL_INCLUDED
885 
cxsc::cvector::operator=
cvector & operator=(const cvector &rv)
Implementation of standard assigning operator.
Definition: cvector.inl:276
cxsc::cmatrix
The Data Type cmatrix.
Definition: cmatrix.hpp:513
cxsc::cvector_slice::operator=
cvector_slice & operator=(const scvector &sl)
Implementation of standard assigning operator.
Definition: scvector.hpp:1545
cxsc::operator*=
cimatrix & operator*=(cimatrix &m, const cinterval &c)
Implementation of multiplication and allocation operation.
Definition: cimatrix.inl:1605
cxsc::cvector::operator[]
complex & operator[](const int &i) const
Operator for accessing the single elements of the vector (read-only)
Definition: cvector.inl:126
cxsc::intvector
The Data Type intvector.
Definition: intvector.hpp:51
cxsc::cvector
The Data Type cvector.
Definition: cvector.hpp:57
cxsc::complex::complex
complex(void)
Constructor of class complex.
Definition: complex.hpp:59
cxsc::rvector
The Data Type rvector.
Definition: rvector.hpp:57
cxsc::cvector_slice::operator[]
complex & operator[](const int &i) const
Operator for accessing the single elements of the vector (read-only)
Definition: cvector.inl:100
cxsc::cvector::VecLen
friend int VecLen(const cvector &rv)
Returns the dimension of the vector.
Definition: cvector.hpp:795
cxsc::cvector::cvector
cvector()
Constructor of class cvector.
Definition: cvector.inl:31
cxsc::cvector::operator()
cvector & operator()()
Operator for accessing the whole vector.
Definition: cvector.hpp:817
cxsc::cvector_slice::operator()
cvector_slice & operator()()
Operator for accessing the whole vector.
Definition: cvector.hpp:1326
cxsc::rvector_slice
The Data Type rvector_slice.
Definition: rvector.hpp:1063
cxsc::abs
ivector abs(const cimatrix_subv &mv)
Returns the absolute value of the matrix.
Definition: cimatrix.inl:737
cxsc::cvector_slice::operator/=
cvector_slice & operator/=(const complex &r)
Implementation of division and allocation operation.
Definition: cvector.inl:428
cxsc::operator*
civector operator*(const cimatrix_subv &rv, const cinterval &s)
Implementation of multiplication operation.
Definition: cimatrix.inl:731
cxsc::operator/=
cimatrix & operator/=(cimatrix &m, const cinterval &c)
Implementation of division and allocation operation.
Definition: cimatrix.inl:1623
cxsc::rmatrix_subv
The Data Type rmatrix_subv.
Definition: rmatrix.hpp:53
cxsc::cvector_slice::operator+=
cvector_slice & operator+=(const cvector &rv)
Implementation of addition and allocation operation.
Definition: cvector.inl:538
cxsc
The namespace cxsc, providing all functionality of the class library C-XSC.
Definition: cdot.cpp:29
cxsc::cvector_slice::operator*=
cvector_slice & operator*=(const complex &r)
Implementation of multiplication and allocation operation.
Definition: cvector.inl:423
cxsc::operator+=
cdotprecision & operator+=(cdotprecision &cd, const l_complex &lc)
Implementation of standard algebraic addition and allocation operation.
Definition: cdot.inl:251
cxsc::operator/
civector operator/(const cimatrix_subv &rv, const cinterval &s)
Implementation of division operation.
Definition: cimatrix.inl:730
cxsc::cvector::Lb
friend int Lb(const cvector &rv)
Returns the lower bound of the vector.
Definition: cvector.hpp:791
cxsc::cvector_slice::operator-=
cvector_slice & operator-=(const cvector &rv)
Implementation of subtraction and allocation operation.
Definition: cvector.inl:597
cxsc::complex
The Scalar Type complex.
Definition: complex.hpp:49
cxsc::cvector_slice
The Data Type cvector_slice.
Definition: cvector.hpp:844
cxsc::Resize
void Resize(cimatrix &A)
Resizes the matrix.
Definition: cimatrix.inl:1211
cxsc::real
The Scalar Type real.
Definition: real.hpp:113