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
29namespace cxsc {
30
31 INLINE cvector::cvector () noexcept:dat(NULL),l(1),u(0),size(0)
32 {
33 }
34
35 INLINE cvector::cvector(const int &i) noexcept: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) noexcept: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 :l(i1),u(i2),size(i2-i1+1)
50#else
51 noexcept: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) noexcept: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) noexcept: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) noexcept: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) noexcept: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) noexcept: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) noexcept: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
103#else
104 noexcept
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
116#else
117 noexcept
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
129#else
130 noexcept
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
142#else
143 noexcept
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
160#if(CXSC_INDEX_CHECK)
161
162#else
163 noexcept
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
182#else
183 noexcept
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
195#else
196 noexcept
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
208#else
209 noexcept
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
221#else
222 noexcept
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
233#if(CXSC_INDEX_CHECK)
234
235#else
236 noexcept
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) noexcept { return cvector(r); }
257 INLINE cvector _cvector(const real &r) noexcept { return cvector(r); }
263 INLINE cvector _cvector(const rvector_slice &rs) noexcept { return cvector(rs); }
269 INLINE cvector _cvector(const rvector &rs) noexcept { return cvector(rs); }
275 INLINE cvector _cvector(const rmatrix_subv &rs) noexcept { return cvector(rs); }
276 INLINE cvector &cvector::operator =(const cvector &rv) noexcept { return _vvassign<cvector,cvector,complex>(*this,rv); }
277 INLINE cvector &cvector::operator =(const complex &r) noexcept { return _vsassign<cvector,complex>(*this,r); }
278 INLINE cvector &cvector::operator =(const rvector &rv) noexcept { return _vvassign<cvector,rvector,complex>(*this,rv); }
279 INLINE cvector &cvector::operator =(const real &r) noexcept { return _vsassign<cvector,real>(*this,r); }
280 INLINE cvector::operator void*() noexcept { return _vvoid(*this); }
282#if(CXSC_INDEX_CHECK)
283
284#else
285 noexcept
286#endif
287 { return _vsvsassign(*this,sl); }
289#if(CXSC_INDEX_CHECK)
290
291#else
292 noexcept
293#endif
294 { return _vsvassign(*this,rv); }
295 INLINE cvector_slice & cvector_slice::operator =(const complex &r) noexcept { return _vssassign<cvector_slice,complex>(*this,r); }
297#if(CXSC_INDEX_CHECK)
298
299#else
300 noexcept
301#endif
302 { return _vsvassign(*this,cvector(m)); }
304#if(CXSC_INDEX_CHECK)
305
306#else
307 noexcept
308#endif
309 { return _vsvsassign(*this,sl); }
311#if(CXSC_INDEX_CHECK)
312
313#else
314 noexcept
315#endif
316 { return _vsvassign(*this,rv); }
317 INLINE cvector_slice & cvector_slice::operator =(const real &r) noexcept { return _vssassign(*this,r); }
318 INLINE cvector_slice::operator void*() noexcept { return _vsvoid(*this); }
319
320//=======================================================================
321//======================== Vector Functions =============================
322
323 INLINE cvector &SetRe(cvector &iv,const rvector &rv)
324#if(CXSC_INDEX_CHECK)
325
326#else
327 noexcept
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
333#else
334 noexcept
335#endif
336 { return _vsvsetre(iv,rv); }
337 INLINE cvector &SetRe(cvector &iv,const rvector_slice &rv)
338#if(CXSC_INDEX_CHECK)
339
340#else
341 noexcept
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
347#else
348 noexcept
349#endif
350 { return _vsvssetre(iv,rv); }
351
352 INLINE cvector &SetIm(cvector &iv,const rvector &rv)
353#if(CXSC_INDEX_CHECK)
354
355#else
356 noexcept
357#endif
358 { return _vvsetim(iv,rv); }
359 INLINE cvector_slice &SetIm(cvector_slice &iv,const rvector &rv)
360#if(CXSC_INDEX_CHECK)
361
362#else
363 noexcept
364#endif
365 { return _vsvsetim(iv,rv); }
366 INLINE cvector &SetIm(cvector &iv,const rvector_slice &rv)
367#if(CXSC_INDEX_CHECK)
368
369#else
370 noexcept
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
376#else
377 noexcept
378#endif
379 { return _vsvssetim(iv,rv); }
380
381 INLINE cvector &SetRe(cvector &iv,const real &r) noexcept { return _vssetre(iv,r); }
382 INLINE cvector &SetIm(cvector &iv,const real &r) noexcept { return _vssetim(iv,r); }
383 INLINE cvector_slice &SetRe(cvector_slice &iv,const real &r) noexcept { return _vsssetre(iv,r); }
384 INLINE cvector_slice &SetIm(cvector_slice &iv,const real &r) noexcept { return _vsssetim(iv,r); }
385
386 INLINE void Resize(cvector &rv) noexcept { _vresize(rv); }
387 INLINE void Resize(cvector &rv, const int &len)
388#if(CXSC_INDEX_CHECK)
389
390#else
391 noexcept
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
397#else
398 noexcept
399#endif
400 { _vresize<class cvector,class complex>(rv,lb,ub); }
401
402 INLINE cvector conj(const cvector &rv) noexcept { return _vconj<cvector>(rv); }
403 INLINE cvector conj(const cvector_slice &sl) noexcept { return _vsconj<cvector_slice,cvector>(sl); }
404
405 INLINE rvector abs(const cvector &rv) noexcept { return _vabs<cvector,rvector>(rv); }
406 INLINE rvector abs(const cvector_slice &sl) noexcept { return _vsabs<cvector_slice,rvector>(sl); }
407 INLINE rvector Im(const cvector &v) noexcept { return _vim<cvector,rvector>(v); }
408 INLINE rvector Im(const cvector_slice &v) noexcept { return _vsim<cvector_slice,rvector>(v); }
409 INLINE rvector Re(const cvector &v) noexcept { return _vre<cvector,rvector>(v); }
410 INLINE rvector Re(const cvector_slice &v) noexcept { return _vsre<cvector_slice,rvector>(v); }
411 INLINE bool operator !(const cvector &rv) noexcept { return _vnot(rv); }
412 INLINE bool operator !(const cvector_slice &sl) noexcept { return _vsnot(sl); }
413
414//======================= Vector / Scalar ===============================
415
416//----------------------------- complex ---------------------------
417
418 INLINE cvector operator *(const cvector &rv, const complex &s) noexcept { return _vsmult<cvector,complex,cvector>(rv,s); }
419 INLINE cvector operator *(const cvector_slice &sl, const complex &s) noexcept { return _vssmult<cvector_slice,complex,cvector>(sl,s); }
420 INLINE cvector operator *(const complex &s, const cvector &rv) noexcept { return _vsmult<cvector,complex,cvector>(rv,s); }
421 INLINE cvector operator *(const complex &s, const cvector_slice &sl) noexcept { return _vssmult<cvector_slice,complex,cvector>(sl,s); }
422 INLINE cvector &operator *=(cvector &rv,const complex &r) noexcept { return _vsmultassign(rv,r); }
423 INLINE cvector_slice &cvector_slice::operator *=(const complex &r) noexcept { return _vssmultassign(*this,r); }
424
425 INLINE cvector operator /(const cvector &rv, const complex &s) noexcept { return _vsdiv<cvector,complex,cvector>(rv,s); }
426 INLINE cvector operator /(const cvector_slice &sl, const complex &s) noexcept { return _vssdiv<cvector_slice,complex,cvector>(sl,s); }
427 INLINE cvector &operator /=(cvector &rv,const complex &r) noexcept { return _vsdivassign(rv,r); }
428 INLINE cvector_slice &cvector_slice::operator /=(const complex &r) noexcept { return _vssdivassign(*this,r); }
429
430//---------------------------- Real --------------------------------------
431
432 INLINE cvector operator *(const cvector &rv, const real &s) noexcept { return _vsmult<cvector,real,cvector>(rv,s); }
433 INLINE cvector operator *(const cvector_slice &sl, const real &s) noexcept { return _vssmult<cvector_slice,real,cvector>(sl,s); }
434 INLINE cvector operator *(const real &s, const cvector &rv) noexcept { return _vsmult<cvector,real,cvector>(rv,s); }
435 INLINE cvector operator *(const real &s, const cvector_slice &sl) noexcept { return _vssmult<cvector_slice,real,cvector>(sl,s); }
436 INLINE cvector &operator *=(cvector &rv,const real &r) noexcept { return _vsmultassign(rv,r); }
437 INLINE cvector_slice &cvector_slice::operator *=(const real &r) noexcept { return _vssmultassign(*this,r); }
438
439 INLINE cvector operator /(const cvector &rv, const real &s) noexcept { return _vsdiv<cvector,real,cvector>(rv,s); }
440 INLINE cvector operator /(const cvector_slice &sl, const real &s) noexcept { return _vssdiv<cvector_slice,real,cvector>(sl,s); }
441 INLINE cvector &operator /=(cvector &rv,const real &r) noexcept { return _vsdivassign(rv,r); }
442 INLINE cvector_slice &cvector_slice::operator /=(const real &r) noexcept { return _vssdivassign(*this,r); }
443
444 INLINE cvector operator *(const rvector &rv, const complex &s) noexcept { return _vsmult<rvector,complex,cvector>(rv,s); }
445 INLINE cvector operator *(const rvector_slice &sl, const complex &s) noexcept { return _vssmult<rvector_slice,complex,cvector>(sl,s); }
446 INLINE cvector operator *(const complex &s, const rvector &rv) noexcept { return _vsmult<rvector,complex,cvector>(rv,s); }
447 INLINE cvector operator *(const complex &s, const rvector_slice &sl) noexcept { return _vssmult<rvector_slice,complex,cvector>(sl,s); }
448
449 INLINE cvector operator /(const rvector &rv, const complex &s) noexcept { return _vsdiv<rvector,complex,cvector>(rv,s); }
450 INLINE cvector operator /(const rvector_slice &sl, const complex &s) noexcept { 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) noexcept { return _vout(s,rv); }
456 INLINE std::ostream &operator <<(std::ostream &o, const cvector_slice &sl) noexcept { return _vsout(o,sl); }
457 INLINE std::istream &operator >>(std::istream &s, cvector &rv) noexcept { return _vin(s,rv); }
458 INLINE std::istream &operator >>(std::istream &s, cvector_slice &rv) noexcept { return _vsin(s,rv); }
459
460//----------------------- complex / complex ---------------------------
461 INLINE cvector & cvector::operator =(const cvector_slice &sl) noexcept { 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
468#else
469 noexcept
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
475#else
476 noexcept
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
482#else
483 noexcept
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
489#else
490 noexcept
491#endif
492 { return _vsvscmult<cvector_slice,cvector_slice,complex>(sl1,sl2); }
493
494 INLINE const cvector &operator +(const cvector &rv) noexcept { return rv; }
495 INLINE cvector operator +(const cvector_slice &sl) noexcept { return sl; }
496 INLINE cvector operator +(const cvector &rv1, const cvector &rv2)
497#if(CXSC_INDEX_CHECK)
498
499#else
500 noexcept
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
506#else
507 noexcept
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
513#else
514 noexcept
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
520#else
521 noexcept
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
527#else
528 noexcept
529#endif
530 { return _vvplusassign(rv1,rv2); }
531 INLINE cvector &operator +=(cvector &rv, const cvector_slice &sl)
532#if(CXSC_INDEX_CHECK)
533
534#else
535 noexcept
536#endif
537 { return _vvsplusassign(rv,sl); }
539#if(CXSC_INDEX_CHECK)
540
541#else
542 noexcept
543#endif
544 { return _vsvplusassign(*this,rv); }
546#if(CXSC_INDEX_CHECK)
547
548#else
549 noexcept
550#endif
551 { return _vsvsplusassign(*this,sl2); }
552
553 INLINE cvector operator -(const cvector &rv) noexcept { return _vminus(rv); }
554 INLINE cvector operator -(const cvector_slice &sl) noexcept { return _vsminus<cvector_slice,cvector>(sl); }
555 INLINE cvector operator -(const cvector &rv1, const cvector &rv2)
556#if(CXSC_INDEX_CHECK)
557
558#else
559 noexcept
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
565#else
566 noexcept
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
572#else
573 noexcept
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
579#else
580 noexcept
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
586#else
587 noexcept
588#endif
589 { return _vvminusassign(rv1,rv2); }
590 INLINE cvector &operator -=(cvector &rv, const cvector_slice &sl)
591#if(CXSC_INDEX_CHECK)
592
593#else
594 noexcept
595#endif
596 { return _vvsminusassign(rv,sl); }
598#if(CXSC_INDEX_CHECK)
599
600#else
601 noexcept
602#endif
603 { return _vsvminusassign(*this,rv); }
605#if(CXSC_INDEX_CHECK)
606
607#else
608 noexcept
609#endif
610 { return _vsvsminusassign(*this,sl2); }
611
612 INLINE bool operator ==(const cvector &rv1, const cvector &rv2) noexcept { return _vveq(rv1,rv2); }
613 INLINE bool operator ==(const cvector_slice &sl1, const cvector_slice &sl2) noexcept { return _vsvseq(sl1,sl2); }
614 INLINE bool operator ==(const cvector_slice &sl, const cvector &rv) noexcept { return _vsveq(sl,rv); }
615 INLINE bool operator ==(const cvector &rv, const cvector_slice &sl) noexcept { return _vsveq(sl,rv); }
616 INLINE bool operator !=(const cvector &rv1, const cvector &rv2) noexcept { return _vvneq(rv1,rv2); }
617 INLINE bool operator !=(const cvector_slice &sl1, const cvector_slice &sl2) noexcept { return _vsvsneq(sl1,sl2); }
618 INLINE bool operator !=(const cvector_slice &sl, const cvector &rv) noexcept { return _vsvneq(sl,rv); }
619 INLINE bool operator !=(const cvector &rv, const cvector_slice &sl) noexcept { return _vsvneq(sl,rv); }
620/* INLINE bool operator <(const cvector &rv1, const cvector &rv2) noexcept { return _vvless(rv1,rv2); }
621 INLINE bool operator <(const cvector_slice &sl1, const cvector_slice &sl2) noexcept { return _vsvsless(sl1,sl2); }
622 INLINE bool operator < (const cvector_slice &sl, const cvector &rv) noexcept { return _vsvless(sl,rv); }
623 INLINE bool operator < (const cvector &rv, const cvector_slice &sl) noexcept { return _vvsless(rv,sl); }
624 INLINE bool operator <=(const cvector &rv1, const cvector &rv2) noexcept { return _vvleq(rv1,rv2); }
625 INLINE bool operator <=(const cvector_slice &sl1, const cvector_slice &sl2) noexcept { return _vsvsleq(sl1,sl2); }
626 INLINE bool operator <=(const cvector_slice &sl, const cvector &rv) noexcept { return _vsvleq(sl,rv); }
627 INLINE bool operator <=(const cvector &rv, const cvector_slice &sl) noexcept { return _vvsleq(rv,sl); }
628 INLINE bool operator >(const cvector &rv1, const cvector &rv2) noexcept { return _vvless(rv2,rv1); }
629 INLINE bool operator >(const cvector_slice &sl1, const cvector_slice &sl2) noexcept { return _vsvsless(sl2,sl1); }
630 INLINE bool operator >(const cvector_slice &sl, const cvector &rv) noexcept { return _vvsless(rv,sl); }
631 INLINE bool operator >(const cvector &rv, const cvector_slice &sl) noexcept { return _vsvless(sl,rv); }
632 INLINE bool operator >=(const cvector &rv1, const cvector &rv2) noexcept { return _vvleq(rv2,rv1); }
633 INLINE bool operator >=(const cvector_slice &sl1, const cvector_slice &sl2) noexcept { return _vsvsleq(sl2,sl1); }
634 INLINE bool operator >=(const cvector_slice &sl, const cvector &rv) noexcept { return _vvsleq(rv,sl); }
635 INLINE bool operator >=(const cvector &rv, const cvector_slice &sl) noexcept { return _vsvleq(sl,rv); }
636*/
637//-------------------------------- complex / Real --------------------------------
638
639 INLINE cvector & cvector::operator =(const rvector_slice &sl) noexcept { 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
645#else
646 noexcept
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
652#else
653 noexcept
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
659#else
660 noexcept
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
666#else
667 noexcept
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
674#else
675 noexcept
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
681#else
682 noexcept
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
688#else
689 noexcept
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
695#else
696 noexcept
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
703#else
704 noexcept
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
710#else
711 noexcept
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
717#else
718 noexcept
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
724#else
725 noexcept
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
732#else
733 noexcept
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
739#else
740 noexcept
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
746#else
747 noexcept
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
753#else
754 noexcept
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
761#else
762 noexcept
763#endif
764 { return _vvplusassign(rv1,rv2); }
765 INLINE cvector &operator +=(cvector &rv, const rvector_slice &sl)
766#if(CXSC_INDEX_CHECK)
767
768#else
769 noexcept
770#endif
771 { return _vvsplusassign(rv,sl); }
773#if(CXSC_INDEX_CHECK)
774
775#else
776 noexcept
777#endif
778 { return _vsvplusassign(*this,rv); }
780#if(CXSC_INDEX_CHECK)
781
782#else
783 noexcept
784#endif
785 { return _vsvsplusassign(*this,sl2); }
786
787 INLINE cvector operator -(const rvector &rv1, const cvector &rv2)
788#if(CXSC_INDEX_CHECK)
789
790#else
791 noexcept
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
797#else
798 noexcept
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
804#else
805 noexcept
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
811#else
812 noexcept
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
819#else
820 noexcept
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
826#else
827 noexcept
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
833#else
834 noexcept
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
840#else
841 noexcept
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
848#else
849 noexcept
850#endif
851 { return _vvminusassign(rv1,rv2); }
852 INLINE cvector &operator -=(cvector &rv, const rvector_slice &sl)
853#if(CXSC_INDEX_CHECK)
854
855#else
856 noexcept
857#endif
858 { return _vvsminusassign(rv,sl); }
860#if(CXSC_INDEX_CHECK)
861
862#else
863 noexcept
864#endif
865 { return _vsvminusassign(*this,rv); }
867#if(CXSC_INDEX_CHECK)
868
869#else
870 noexcept
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
The Data Type cmatrix.
Definition cmatrix.hpp:514
The Scalar Type complex.
Definition complex.hpp:50
complex(void) noexcept
Constructor of class complex.
Definition complex.hpp:59
The Data Type cvector_slice.
Definition cvector.hpp:845
cvector_slice & operator()() noexcept
Operator for accessing the whole vector.
Definition cvector.hpp:1326
cvector_slice & operator/=(const complex &r) noexcept
Implementation of division and allocation operation.
Definition cvector.inl:428
cvector_slice & operator-=(const cvector &rv) noexcept
Implementation of subtraction and allocation operation.
Definition cvector.inl:597
cvector_slice & operator+=(const cvector &rv) noexcept
Implementation of addition and allocation operation.
Definition cvector.inl:538
cvector_slice & operator=(const scvector &sl)
Implementation of standard assigning operator.
cvector_slice & operator*=(const complex &r) noexcept
Implementation of multiplication and allocation operation.
Definition cvector.inl:423
complex & operator[](const int &i) const noexcept
Operator for accessing the single elements of the vector (read-only)
Definition cvector.inl:100
The Data Type cvector.
Definition cvector.hpp:58
friend int Lb(const cvector &rv) noexcept
Returns the lower bound of the vector.
Definition cvector.hpp:791
cvector() noexcept
Constructor of class cvector.
Definition cvector.inl:31
friend int VecLen(const cvector &rv) noexcept
Returns the dimension of the vector.
Definition cvector.hpp:795
cvector & operator=(const cvector &rv) noexcept
Implementation of standard assigning operator.
Definition cvector.inl:276
cvector & operator()() noexcept
Operator for accessing the whole vector.
Definition cvector.hpp:817
complex & operator[](const int &i) const noexcept
Operator for accessing the single elements of the vector (read-only)
Definition cvector.inl:126
The Data Type intvector.
Definition intvector.hpp:52
The Scalar Type real.
Definition real.hpp:114
The Data Type rmatrix_subv.
Definition rmatrix.hpp:54
The Data Type rvector_slice.
Definition rvector.hpp:1064
The Data Type rvector.
Definition rvector.hpp:58
The namespace cxsc, providing all functionality of the class library C-XSC.
Definition cdot.cpp:29
cdotprecision & operator+=(cdotprecision &cd, const l_complex &lc) noexcept
Implementation of standard algebraic addition and allocation operation.
Definition cdot.inl:251
civector operator/(const cimatrix_subv &rv, const cinterval &s) noexcept
Implementation of division operation.
Definition cimatrix.inl:730
cimatrix & operator*=(cimatrix &m, const cinterval &c) noexcept
Implementation of multiplication and allocation operation.
ivector abs(const cimatrix_subv &mv) noexcept
Returns the absolute value of the matrix.
Definition cimatrix.inl:737
civector operator*(const cimatrix_subv &rv, const cinterval &s) noexcept
Implementation of multiplication operation.
Definition cimatrix.inl:731
void Resize(cimatrix &A) noexcept
Resizes the matrix.
cimatrix & operator/=(cimatrix &m, const cinterval &c) noexcept
Implementation of division and allocation operation.