26 #ifndef _CXSC_CVECTOR_INL_INCLUDED
27 #define _CXSC_CVECTOR_INL_INCLUDED
41 INLINE
cvector::cvector(
const class index &i) noexcept:l(1),u(i._int()),size(i._int())
49 :l(i1),u(i2),size(i2-i1+1)
51 noexcept: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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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*() noexcept {
return _vvoid(*
this); }
282 #if(CXSC_INDEX_CHECK)
287 {
return _vsvsassign(*
this,sl); }
289 #if(CXSC_INDEX_CHECK)
294 {
return _vsvassign(*
this,rv); }
297 #if(CXSC_INDEX_CHECK)
302 {
return _vsvassign(*
this,
cvector(m)); }
304 #if(CXSC_INDEX_CHECK)
309 {
return _vsvsassign(*
this,sl); }
311 #if(CXSC_INDEX_CHECK)
316 {
return _vsvassign(*
this,rv); }
318 INLINE cvector_slice::operator
void*() noexcept {
return _vsvoid(*
this); }
324 #if(CXSC_INDEX_CHECK)
331 #if(CXSC_INDEX_CHECK)
336 {
return _vsvsetre(iv,rv); }
338 #if(CXSC_INDEX_CHECK)
343 {
return _vvssetre(iv,rv); }
345 #if(CXSC_INDEX_CHECK)
350 {
return _vsvssetre(iv,rv); }
353 #if(CXSC_INDEX_CHECK)
358 {
return _vvsetim(iv,rv); }
360 #if(CXSC_INDEX_CHECK)
365 {
return _vsvsetim(iv,rv); }
367 #if(CXSC_INDEX_CHECK)
372 {
return _vvssetim(iv,rv); }
374 #if(CXSC_INDEX_CHECK)
379 {
return _vsvssetim(iv,rv); }
388 #if(CXSC_INDEX_CHECK)
393 { _vresize<class cvector,class complex>(rv,len); }
395 #if(CXSC_INDEX_CHECK)
400 { _vresize<class cvector,class complex>(rv,lb,ub); }
407 INLINE
rvector Im(
const cvector &v) noexcept {
return _vim<cvector,rvector>(v); }
409 INLINE
rvector Re(
const cvector &v) noexcept {
return _vre<cvector,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); }
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); }
466 #if(CXSC_INDEX_CHECK)
471 {
return _vvcmult<cvector,cvector,complex>(rv1,rv2); }
473 #if(CXSC_INDEX_CHECK)
478 {
return _vsvcmult<cvector_slice,cvector,complex>(sl,rv); }
480 #if(CXSC_INDEX_CHECK)
485 {
return _vsvcmult<cvector_slice,cvector,complex>(sl,rv); }
487 #if(CXSC_INDEX_CHECK)
492 {
return _vsvscmult<cvector_slice,cvector_slice,complex>(sl1,sl2); }
497 #if(CXSC_INDEX_CHECK)
502 {
return _vvplus<cvector,cvector,cvector>(rv1,rv2); }
504 #if(CXSC_INDEX_CHECK)
509 {
return _vvsplus<cvector,cvector_slice,cvector>(rv,sl); }
511 #if(CXSC_INDEX_CHECK)
516 {
return _vvsplus<cvector,cvector_slice,cvector>(rv,sl); }
518 #if(CXSC_INDEX_CHECK)
523 {
return _vsvsplus<cvector_slice,cvector_slice,cvector>(sl1,sl2); }
525 #if(CXSC_INDEX_CHECK)
530 {
return _vvplusassign(rv1,rv2); }
532 #if(CXSC_INDEX_CHECK)
537 {
return _vvsplusassign(rv,sl); }
539 #if(CXSC_INDEX_CHECK)
544 {
return _vsvplusassign(*
this,rv); }
546 #if(CXSC_INDEX_CHECK)
551 {
return _vsvsplusassign(*
this,sl2); }
556 #if(CXSC_INDEX_CHECK)
561 {
return _vvminus<cvector,cvector,cvector>(rv1,rv2); }
563 #if(CXSC_INDEX_CHECK)
568 {
return _vvsminus<cvector,cvector_slice,cvector>(rv,sl); }
570 #if(CXSC_INDEX_CHECK)
575 {
return _vsvminus<cvector_slice,cvector,cvector>(sl,rv); }
577 #if(CXSC_INDEX_CHECK)
582 {
return _vsvsminus<cvector_slice,cvector_slice,cvector>(sl1,sl2); }
584 #if(CXSC_INDEX_CHECK)
589 {
return _vvminusassign(rv1,rv2); }
591 #if(CXSC_INDEX_CHECK)
596 {
return _vvsminusassign(rv,sl); }
598 #if(CXSC_INDEX_CHECK)
603 {
return _vsvminusassign(*
this,rv); }
605 #if(CXSC_INDEX_CHECK)
610 {
return _vsvsminusassign(*
this,sl2); }
612 INLINE
bool operator ==(
const cvector &rv1,
const cvector &rv2) noexcept {
return _vveq(rv1,rv2); }
616 INLINE
bool operator !=(
const cvector &rv1,
const cvector &rv2) noexcept {
return _vvneq(rv1,rv2); }
643 #if(CXSC_INDEX_CHECK)
648 {
return _vvcmult<rvector,cvector,complex>(rv1,rv2); }
650 #if(CXSC_INDEX_CHECK)
655 {
return _vsvcmult<rvector_slice,cvector,complex>(sl,rv); }
657 #if(CXSC_INDEX_CHECK)
662 {
return _vsvcmult<cvector_slice,rvector,complex>(sl,rv); }
664 #if(CXSC_INDEX_CHECK)
669 {
return _vsvscmult<rvector_slice,cvector_slice,complex>(sl1,sl2); }
672 #if(CXSC_INDEX_CHECK)
677 {
return _vvcmult<rvector,cvector,complex>(rv2,rv1); }
679 #if(CXSC_INDEX_CHECK)
684 {
return _vsvcmult<cvector_slice,rvector,complex>(sl,rv); }
686 #if(CXSC_INDEX_CHECK)
691 {
return _vsvcmult<rvector_slice,cvector,complex>(sl,rv); }
693 #if(CXSC_INDEX_CHECK)
698 {
return _vsvscmult<rvector_slice,cvector_slice,complex>(sl2,sl1); }
701 #if(CXSC_INDEX_CHECK)
706 {
return _vvplus<rvector,cvector,cvector>(rv1,rv2); }
708 #if(CXSC_INDEX_CHECK)
713 {
return _vvsplus<rvector,cvector_slice,cvector>(rv,sl); }
715 #if(CXSC_INDEX_CHECK)
720 {
return _vvsplus<cvector,rvector_slice,cvector>(rv,sl); }
722 #if(CXSC_INDEX_CHECK)
727 {
return _vsvsplus<rvector_slice,cvector_slice,cvector>(sl1,sl2); }
730 #if(CXSC_INDEX_CHECK)
735 {
return _vvplus<rvector,cvector,cvector>(rv2,rv1); }
737 #if(CXSC_INDEX_CHECK)
742 {
return _vvsplus<cvector,rvector_slice,cvector>(rv,sl); }
744 #if(CXSC_INDEX_CHECK)
749 {
return _vvsplus<rvector,cvector_slice,cvector>(rv,sl); }
751 #if(CXSC_INDEX_CHECK)
756 {
return _vsvsplus<rvector_slice,cvector_slice,cvector>(sl2,sl1); }
759 #if(CXSC_INDEX_CHECK)
764 {
return _vvplusassign(rv1,rv2); }
766 #if(CXSC_INDEX_CHECK)
771 {
return _vvsplusassign(rv,sl); }
773 #if(CXSC_INDEX_CHECK)
778 {
return _vsvplusassign(*
this,rv); }
780 #if(CXSC_INDEX_CHECK)
785 {
return _vsvsplusassign(*
this,sl2); }
788 #if(CXSC_INDEX_CHECK)
793 {
return _vvminus<rvector,cvector,cvector>(rv1,rv2); }
795 #if(CXSC_INDEX_CHECK)
800 {
return _vvsminus<rvector,cvector_slice,cvector>(rv,sl); }
802 #if(CXSC_INDEX_CHECK)
807 {
return _vsvminus<rvector_slice,cvector,cvector>(sl,rv); }
809 #if(CXSC_INDEX_CHECK)
814 {
return _vsvsminus<rvector_slice,cvector_slice,cvector>(sl1,sl2); }
817 #if(CXSC_INDEX_CHECK)
822 {
return _vvminus<cvector,rvector,cvector>(rv1,rv2); }
824 #if(CXSC_INDEX_CHECK)
829 {
return _vvsminus<cvector,rvector_slice,cvector>(rv,sl); }
831 #if(CXSC_INDEX_CHECK)
836 {
return _vsvminus<cvector_slice,rvector,cvector>(sl,rv); }
838 #if(CXSC_INDEX_CHECK)
843 {
return _vsvsminus<cvector_slice,rvector_slice,cvector>(sl1,sl2); }
846 #if(CXSC_INDEX_CHECK)
851 {
return _vvminusassign(rv1,rv2); }
853 #if(CXSC_INDEX_CHECK)
858 {
return _vvsminusassign(rv,sl); }
860 #if(CXSC_INDEX_CHECK)
865 {
return _vsvminusassign(*
this,rv); }
867 #if(CXSC_INDEX_CHECK)
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)];
complex(void) noexcept
Constructor of class complex.
The Data Type cvector_slice.
cvector_slice & operator/=(const complex &r) noexcept
Implementation of division and allocation operation.
cvector_slice & operator-=(const cvector &rv) noexcept
Implementation of subtraction and allocation operation.
cvector_slice & operator()() noexcept
Operator for accessing the whole vector.
cvector_slice & operator+=(const cvector &rv) noexcept
Implementation of addition and allocation operation.
cvector_slice & operator=(const scvector &sl)
Implementation of standard assigning operator.
cvector_slice & operator*=(const complex &r) noexcept
Implementation of multiplication and allocation operation.
complex & operator[](const int &i) const noexcept
Operator for accessing the single elements of the vector (read-only)
friend int Lb(const cvector &rv) noexcept
Returns the lower bound of the vector.
cvector() noexcept
Constructor of class cvector.
friend int VecLen(const cvector &rv) noexcept
Returns the dimension of the vector.
cvector & operator=(const cvector &rv) noexcept
Implementation of standard assigning operator.
cvector & operator()() noexcept
Operator for accessing the whole vector.
complex & operator[](const int &i) const noexcept
Operator for accessing the single elements of the vector (read-only)
The Data Type rmatrix_subv.
The Data Type rvector_slice.
The namespace cxsc, providing all functionality of the class library C-XSC.
civector operator/(const cimatrix_subv &rv, const cinterval &s) noexcept
Implementation of division operation.
cdotprecision & operator+=(cdotprecision &cd, const l_complex &lc) noexcept
Implementation of standard algebraic addition and allocation operation.
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.
civector operator*(const cimatrix_subv &rv, const cinterval &s) noexcept
Implementation of multiplication operation.
void Resize(cimatrix &A) noexcept
Resizes the matrix.
cimatrix & operator/=(cimatrix &m, const cinterval &c) noexcept
Implementation of division and allocation operation.