26 #ifndef _CXSC_CVECTOR_INL_INCLUDED 27 #define _CXSC_CVECTOR_INL_INCLUDED 41 INLINE
cvector::cvector(
const class index &i)
throw():l(1),u(i._int()),size(i._int())
49 throw(ERROR_CVECTOR_WRONG_BOUNDARIES,ERROR_CVECTOR_NO_MORE_MEMORY):l(i1),u(i2),size(i2-i1+1)
51 throw():l(i1),u(i2),size(i2-i1+1)
55 if(i1>i2) cxscthrow(ERROR_CVECTOR_WRONG_BOUNDARIES(
"cvector::cvector(const int &i1,const int &i2)"));
63 for(
int i=0, j=l-rs.l;i<size;i++,j++)
70 for (
int i=0;i<size;i++)
83 for(
int i=0, j=l-rs.l;i<size;i++,j++)
90 for (
int i=0;i<size;i++)
101 #if(CXSC_INDEX_CHECK) 102 throw(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC)
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"));
114 #if(CXSC_INDEX_CHECK) 115 throw(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC)
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)"));
127 #if(CXSC_INDEX_CHECK) 128 throw(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC)
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"));
140 #if(CXSC_INDEX_CHECK) 141 throw(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC)
146 #if(CXSC_INDEX_CHECK) 147 if(i<l||i>u) cxscthrow(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC(
"complex & cvector::operator [](const int &i)"));
160 #if(CXSC_INDEX_CHECK) 161 throw(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG)
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)"));
180 #if(CXSC_INDEX_CHECK) 181 throw(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG)
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)"));
193 #if(CXSC_INDEX_CHECK) 194 throw(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG)
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)"));
206 #if(CXSC_INDEX_CHECK) 207 throw(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG)
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)"));
219 #if(CXSC_INDEX_CHECK) 220 throw(ERROR_CVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_CVECTOR_USE_OF_UNINITIALIZED_OBJ)
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)"));
233 #if(CXSC_INDEX_CHECK) 234 throw(ERROR_CVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_CVECTOR_USE_OF_UNINITIALIZED_OBJ)
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)"));
243 *
this=sl.dat[sl.start-sl.l];
280 INLINE cvector::operator
void*()
throw() {
return _vvoid(*
this); }
282 #if(CXSC_INDEX_CHECK) 283 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
287 {
return _vsvsassign(*
this,sl); }
289 #if(CXSC_INDEX_CHECK) 290 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
294 {
return _vsvassign(*
this,rv); }
297 #if(CXSC_INDEX_CHECK) 298 throw(ERROR__OP_WITH_WRONG_DIM<cvector>,ERROR_CMATRIX_TYPE_CAST_OF_THICK_OBJ)
302 {
return _vsvassign(*
this,
cvector(m)); }
304 #if(CXSC_INDEX_CHECK) 305 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
309 {
return _vsvsassign(*
this,sl); }
311 #if(CXSC_INDEX_CHECK) 312 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
316 {
return _vsvassign(*
this,rv); }
318 INLINE cvector_slice::operator
void*()
throw() {
return _vsvoid(*
this); }
324 #if(CXSC_INDEX_CHECK) 325 throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
331 #if(CXSC_INDEX_CHECK) 332 throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
336 {
return _vsvsetre(iv,rv); }
338 #if(CXSC_INDEX_CHECK) 339 throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
343 {
return _vvssetre(iv,rv); }
345 #if(CXSC_INDEX_CHECK) 346 throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
350 {
return _vsvssetre(iv,rv); }
353 #if(CXSC_INDEX_CHECK) 354 throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
358 {
return _vvsetim(iv,rv); }
360 #if(CXSC_INDEX_CHECK) 361 throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
365 {
return _vsvsetim(iv,rv); }
367 #if(CXSC_INDEX_CHECK) 368 throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
372 {
return _vvssetim(iv,rv); }
374 #if(CXSC_INDEX_CHECK) 375 throw(ERROR_CMATRIX_OP_WITH_WRONG_DIM)
379 {
return _vsvssetim(iv,rv); }
388 #if(CXSC_INDEX_CHECK) 389 throw(ERROR__WRONG_BOUNDARIES<cvector>)
393 { _vresize<class cvector,class complex>(rv,len); }
395 #if(CXSC_INDEX_CHECK) 396 throw(ERROR__WRONG_BOUNDARIES<cvector>)
400 { _vresize<class cvector,class complex>(rv,lb,ub); }
411 INLINE
bool operator !(
const cvector &rv)
throw() {
return _vnot(rv); }
412 INLINE
bool operator !(
const cvector_slice &sl)
throw() {
return _vsnot(sl); }
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); }
466 #if(CXSC_INDEX_CHECK) 467 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
471 {
return _vvcmult<cvector,cvector,complex>(rv1,rv2); }
473 #if(CXSC_INDEX_CHECK) 474 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
478 {
return _vsvcmult<cvector_slice,cvector,complex>(sl,rv); }
480 #if(CXSC_INDEX_CHECK) 481 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
485 {
return _vsvcmult<cvector_slice,cvector,complex>(sl,rv); }
487 #if(CXSC_INDEX_CHECK) 488 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
492 {
return _vsvscmult<cvector_slice,cvector_slice,complex>(sl1,sl2); }
497 #if(CXSC_INDEX_CHECK) 498 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
502 {
return _vvplus<cvector,cvector,cvector>(rv1,rv2); }
504 #if(CXSC_INDEX_CHECK) 505 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
509 {
return _vvsplus<cvector,cvector_slice,cvector>(rv,sl); }
511 #if(CXSC_INDEX_CHECK) 512 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
516 {
return _vvsplus<cvector,cvector_slice,cvector>(rv,sl); }
518 #if(CXSC_INDEX_CHECK) 519 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
523 {
return _vsvsplus<cvector_slice,cvector_slice,cvector>(sl1,sl2); }
525 #if(CXSC_INDEX_CHECK) 526 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
530 {
return _vvplusassign(rv1,rv2); }
532 #if(CXSC_INDEX_CHECK) 533 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
537 {
return _vvsplusassign(rv,sl); }
539 #if(CXSC_INDEX_CHECK) 540 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
544 {
return _vsvplusassign(*
this,rv); }
546 #if(CXSC_INDEX_CHECK) 547 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
551 {
return _vsvsplusassign(*
this,sl2); }
556 #if(CXSC_INDEX_CHECK) 557 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
561 {
return _vvminus<cvector,cvector,cvector>(rv1,rv2); }
563 #if(CXSC_INDEX_CHECK) 564 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
568 {
return _vvsminus<cvector,cvector_slice,cvector>(rv,sl); }
570 #if(CXSC_INDEX_CHECK) 571 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
575 {
return _vsvminus<cvector_slice,cvector,cvector>(sl,rv); }
577 #if(CXSC_INDEX_CHECK) 578 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
582 {
return _vsvsminus<cvector_slice,cvector_slice,cvector>(sl1,sl2); }
584 #if(CXSC_INDEX_CHECK) 585 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
589 {
return _vvminusassign(rv1,rv2); }
591 #if(CXSC_INDEX_CHECK) 592 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
596 {
return _vvsminusassign(rv,sl); }
598 #if(CXSC_INDEX_CHECK) 599 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
603 {
return _vsvminusassign(*
this,rv); }
605 #if(CXSC_INDEX_CHECK) 606 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
610 {
return _vsvsminusassign(*
this,sl2); }
612 INLINE
bool operator ==(
const cvector &rv1,
const cvector &rv2)
throw() {
return _vveq(rv1,rv2); }
616 INLINE
bool operator !=(
const cvector &rv1,
const cvector &rv2)
throw() {
return _vvneq(rv1,rv2); }
643 #if(CXSC_INDEX_CHECK) 644 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
648 {
return _vvcmult<rvector,cvector,complex>(rv1,rv2); }
650 #if(CXSC_INDEX_CHECK) 651 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
655 {
return _vsvcmult<rvector_slice,cvector,complex>(sl,rv); }
657 #if(CXSC_INDEX_CHECK) 658 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
662 {
return _vsvcmult<cvector_slice,rvector,complex>(sl,rv); }
664 #if(CXSC_INDEX_CHECK) 665 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
669 {
return _vsvscmult<rvector_slice,cvector_slice,complex>(sl1,sl2); }
672 #if(CXSC_INDEX_CHECK) 673 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
677 {
return _vvcmult<rvector,cvector,complex>(rv2,rv1); }
679 #if(CXSC_INDEX_CHECK) 680 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
684 {
return _vsvcmult<cvector_slice,rvector,complex>(sl,rv); }
686 #if(CXSC_INDEX_CHECK) 687 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
691 {
return _vsvcmult<rvector_slice,cvector,complex>(sl,rv); }
693 #if(CXSC_INDEX_CHECK) 694 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
698 {
return _vsvscmult<rvector_slice,cvector_slice,complex>(sl2,sl1); }
701 #if(CXSC_INDEX_CHECK) 702 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
706 {
return _vvplus<rvector,cvector,cvector>(rv1,rv2); }
708 #if(CXSC_INDEX_CHECK) 709 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
713 {
return _vvsplus<rvector,cvector_slice,cvector>(rv,sl); }
715 #if(CXSC_INDEX_CHECK) 716 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
720 {
return _vvsplus<cvector,rvector_slice,cvector>(rv,sl); }
722 #if(CXSC_INDEX_CHECK) 723 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
727 {
return _vsvsplus<rvector_slice,cvector_slice,cvector>(sl1,sl2); }
730 #if(CXSC_INDEX_CHECK) 731 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
735 {
return _vvplus<rvector,cvector,cvector>(rv2,rv1); }
737 #if(CXSC_INDEX_CHECK) 738 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
742 {
return _vvsplus<cvector,rvector_slice,cvector>(rv,sl); }
744 #if(CXSC_INDEX_CHECK) 745 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
749 {
return _vvsplus<rvector,cvector_slice,cvector>(rv,sl); }
751 #if(CXSC_INDEX_CHECK) 752 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
756 {
return _vsvsplus<rvector_slice,cvector_slice,cvector>(sl2,sl1); }
759 #if(CXSC_INDEX_CHECK) 760 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
764 {
return _vvplusassign(rv1,rv2); }
766 #if(CXSC_INDEX_CHECK) 767 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
771 {
return _vvsplusassign(rv,sl); }
773 #if(CXSC_INDEX_CHECK) 774 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
778 {
return _vsvplusassign(*
this,rv); }
780 #if(CXSC_INDEX_CHECK) 781 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
785 {
return _vsvsplusassign(*
this,sl2); }
788 #if(CXSC_INDEX_CHECK) 789 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
793 {
return _vvminus<rvector,cvector,cvector>(rv1,rv2); }
795 #if(CXSC_INDEX_CHECK) 796 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
800 {
return _vvsminus<rvector,cvector_slice,cvector>(rv,sl); }
802 #if(CXSC_INDEX_CHECK) 803 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
807 {
return _vsvminus<rvector_slice,cvector,cvector>(sl,rv); }
809 #if(CXSC_INDEX_CHECK) 810 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
814 {
return _vsvsminus<rvector_slice,cvector_slice,cvector>(sl1,sl2); }
817 #if(CXSC_INDEX_CHECK) 818 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
822 {
return _vvminus<cvector,rvector,cvector>(rv1,rv2); }
824 #if(CXSC_INDEX_CHECK) 825 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
829 {
return _vvsminus<cvector,rvector_slice,cvector>(rv,sl); }
831 #if(CXSC_INDEX_CHECK) 832 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
836 {
return _vsvminus<cvector_slice,rvector,cvector>(sl,rv); }
838 #if(CXSC_INDEX_CHECK) 839 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
843 {
return _vsvsminus<cvector_slice,rvector_slice,cvector>(sl1,sl2); }
846 #if(CXSC_INDEX_CHECK) 847 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
851 {
return _vvminusassign(rv1,rv2); }
853 #if(CXSC_INDEX_CHECK) 854 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
858 {
return _vvsminusassign(rv,sl); }
860 #if(CXSC_INDEX_CHECK) 861 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
865 {
return _vsvminusassign(*
this,rv); }
867 #if(CXSC_INDEX_CHECK) 868 throw(ERROR__OP_WITH_WRONG_DIM<cvector>)
872 {
return _vsvsminusassign(*
this,sl2); }
877 for(
int i=0 ; i<
VecLen(x) ; i++)
878 x[i+
Lb(x)] = (*this)[p[i+
Lb(p)]+
Lb(*
this)];
884 #endif // _CXSC_CVECTOR_INL_INCLUDED cvector_slice & operator/=(const complex &r)
Implementation of division and allocation operation.
cimatrix & operator/=(cimatrix &m, const cinterval &c)
Implementation of division and allocation operation.
friend int Lb(const cvector &rv)
Returns the lower bound of the vector.
cvector_slice & operator*=(const complex &r)
Implementation of multiplication and allocation operation.
cvector_slice & operator+=(const cvector &rv)
Implementation of addition and allocation operation.
The namespace cxsc, providing all functionality of the class library C-XSC.
civector operator*(const cimatrix_subv &rv, const cinterval &s)
Implementation of multiplication operation.
cvector & operator()()
Operator for accessing the whole vector.
cvector & operator=(const cvector &rv)
Implementation of standard assigning operator.
The Data Type rvector_slice.
cvector_slice & operator-=(const cvector &rv)
Implementation of subtraction and allocation operation.
The Data Type rmatrix_subv.
complex & operator[](const int &i) const
Operator for accessing the single elements of the vector (read-only)
void Resize(cimatrix &A)
Resizes the matrix.
cvector_slice & operator=(const scvector &sl)
Implementation of standard assigning operator.
friend int VecLen(const cvector &rv)
Returns the dimension of the vector.
cvector()
Constructor of class cvector.
cdotprecision & operator+=(cdotprecision &cd, const l_complex &lc)
Implementation of standard algebraic addition and allocation operation.
complex(void)
Constructor of class complex.
civector operator/(const cimatrix_subv &rv, const cinterval &s)
Implementation of division operation.
The Data Type cvector_slice.
cimatrix & operator*=(cimatrix &m, const cinterval &c)
Implementation of multiplication and allocation operation.
cvector_slice & operator()()
Operator for accessing the whole vector.
complex & operator[](const int &i) const
Operator for accessing the single elements of the vector (read-only)
ivector abs(const cimatrix_subv &mv)
Returns the absolute value of the matrix.