26 #ifndef _CXSC_IVECTOR_INL_INCLUDED
27 #define _CXSC_IVECTOR_INL_INCLUDED
41 INLINE
ivector::ivector(
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_IVECTOR_WRONG_BOUNDARIES(
"ivector::ivector(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<l||i>u) cxscthrow(ERROR_IVECTOR_ELEMENT_NOT_IN_VEC(
"interval & ivector::operator [](const int &i) const"));
114 #if(CXSC_INDEX_CHECK)
120 #if(CXSC_INDEX_CHECK)
121 if(i<l||i>u) cxscthrow(ERROR_IVECTOR_ELEMENT_NOT_IN_VEC(
"interval & ivector::operator [](const int &i)"));
127 #if(CXSC_INDEX_CHECK)
133 #if(CXSC_INDEX_CHECK)
134 if(i<start||i>end) cxscthrow(ERROR_IVECTOR_ELEMENT_NOT_IN_VEC(
"interval & ivector_slice::operator [](const int &i) const"));
140 #if(CXSC_INDEX_CHECK)
146 #if(CXSC_INDEX_CHECK)
147 if(i<start||i>end) cxscthrow(ERROR_IVECTOR_ELEMENT_NOT_IN_VEC(
"interval & ivector_slice::operator [](const int &i)"));
154 #if(CXSC_INDEX_CHECK)
160 #if(CXSC_INDEX_CHECK)
161 if(1<l||i>u) cxscthrow(ERROR_IVECTOR_SUB_ARRAY_TOO_BIG(
"ivector_slice ivector::operator ()(const int &i)"));
167 #if(CXSC_INDEX_CHECK)
173 #if(CXSC_INDEX_CHECK)
174 if(i1<l||i2>u) cxscthrow(ERROR_IVECTOR_SUB_ARRAY_TOO_BIG(
"ivector_slice ivector::operator ()(const int &i1,const int &i2)"));
180 #if(CXSC_INDEX_CHECK)
186 #if(CXSC_INDEX_CHECK)
187 if(1<start||i>end) cxscthrow(ERROR_IVECTOR_SUB_ARRAY_TOO_BIG(
"ivector_slice ivector_slice::operator ()(const int &i)"));
193 #if(CXSC_INDEX_CHECK)
199 #if(CXSC_INDEX_CHECK)
200 if(i1<start||i2>end) cxscthrow(ERROR_IVECTOR_SUB_ARRAY_TOO_BIG(
"ivector_slice ivector_slice::operator ()(const int &i1,const int &i2)"));
206 #if(CXSC_INDEX_CHECK)
212 #if(CXSC_INDEX_CHECK)
213 if(rv.size>1) cxscthrow(ERROR_IVECTOR_TYPE_CAST_OF_THICK_OBJ(
"interval::interval(const ivector &rv)"));
214 else if(rv.size<1) cxscthrow(ERROR_IVECTOR_USE_OF_UNINITIALIZED_OBJ(
"interval::interval(const ivector &rv)"));
220 #if(CXSC_INDEX_CHECK)
226 #if(CXSC_INDEX_CHECK)
227 if(sl.size>1) cxscthrow(ERROR_IVECTOR_TYPE_CAST_OF_THICK_OBJ(
"interval::interval(const ivector_slice &sl)"));
228 else if(sl.size<1) cxscthrow(ERROR_IVECTOR_USE_OF_UNINITIALIZED_OBJ(
"interval::interval(const ivector_slice &sl)"));
230 *
this=sl.dat[sl.start-sl.l];
267 INLINE ivector::operator
void*() noexcept {
return _vvoid(*
this); }
269 #if(CXSC_INDEX_CHECK)
274 {
return _vsvsassign(*
this,sl); }
276 #if(CXSC_INDEX_CHECK)
281 {
return _vsvassign(*
this,rv); }
284 #if(CXSC_INDEX_CHECK)
289 {
return _vsvassign(*
this,
ivector(m)); }
291 #if(CXSC_INDEX_CHECK)
296 {
return _vsvsassign(*
this,sl); }
298 #if(CXSC_INDEX_CHECK)
303 {
return _vsvassign(*
this,rv); }
305 INLINE ivector_slice::operator
void*() noexcept {
return _vsvoid(*
this); }
312 #if(CXSC_INDEX_CHECK)
317 {
return _vvsetinf(iv,rv); }
319 #if(CXSC_INDEX_CHECK)
324 {
return _vsvsetinf(iv,rv); }
326 #if(CXSC_INDEX_CHECK)
331 {
return _vvssetinf(iv,rv); }
333 #if(CXSC_INDEX_CHECK)
338 {
return _vsvssetinf(iv,rv); }
340 #if(CXSC_INDEX_CHECK)
345 {
return _vvusetinf(iv,rv); }
347 #if(CXSC_INDEX_CHECK)
352 {
return _vsvusetinf(iv,rv); }
354 #if(CXSC_INDEX_CHECK)
359 {
return _vvsusetinf(iv,rv); }
361 #if(CXSC_INDEX_CHECK)
366 {
return _vsvsusetinf(iv,rv); }
369 #if(CXSC_INDEX_CHECK)
374 {
return _vvsetsup(iv,rv); }
376 #if(CXSC_INDEX_CHECK)
381 {
return _vsvsetsup(iv,rv); }
383 #if(CXSC_INDEX_CHECK)
388 {
return _vvssetsup(iv,rv); }
390 #if(CXSC_INDEX_CHECK)
395 {
return _vsvssetsup(iv,rv); }
397 #if(CXSC_INDEX_CHECK)
402 {
return _vvusetsup(iv,rv); }
404 #if(CXSC_INDEX_CHECK)
409 {
return _vsvusetsup(iv,rv); }
411 #if(CXSC_INDEX_CHECK)
416 {
return _vvsusetsup(iv,rv); }
418 #if(CXSC_INDEX_CHECK)
423 {
return _vsvsusetsup(iv,rv); }
436 #if(CXSC_INDEX_CHECK)
441 { _vresize<class ivector,class interval>(rv,len); }
443 #if(CXSC_INDEX_CHECK)
448 { _vresize<class ivector,class interval>(rv,lb,ub); }
454 for(
int i=
Lb(rv) ; i<=
Ub(rv) ; i++)
458 INLINE rvector
absmin(
const ivector_slice &sl) noexcept {
459 rvector x(
Lb(sl),
Ub(sl));
460 for(
int i=
Lb(sl) ; i<=
Ub(sl) ; i++)
464 INLINE rvector
absmax(
const ivector &rv) noexcept {
465 rvector x(
Lb(rv),
Ub(rv));
466 for(
int i=
Lb(rv) ; i<=
Ub(rv) ; i++)
472 for(
int i=
Lb(sl) ; i<=
Ub(sl) ; i++)
480 INLINE
rvector Inf(
const ivector &v) noexcept {
return _vinf<ivector,rvector>(v); }
482 INLINE
rvector Sup(
const ivector &v) noexcept {
return _vsup<ivector,rvector>(v); }
484 INLINE
bool operator !(
const ivector &rv) noexcept {
return _vnot(rv); }
485 INLINE
bool operator !(
const ivector_slice &sl) noexcept {
return _vsnot(sl); }
528 INLINE std::ostream &operator <<(std::ostream &s,
const ivector &rv) noexcept {
return _vout(s,rv); }
529 INLINE std::ostream &operator <<(std::ostream &o,
const ivector_slice &sl) noexcept {
return _vsout(o,sl); }
530 INLINE std::istream &operator >>(std::istream &s,
ivector &rv) noexcept {
return _vin(s,rv); }
531 INLINE std::istream &operator >>(std::istream &s,
ivector_slice &rv) noexcept {
return _vsin(s,rv); }
538 #if(CXSC_INDEX_CHECK)
543 {
return _vvimult<ivector,ivector,interval>(rv1,rv2); }
545 #if(CXSC_INDEX_CHECK)
550 {
return _vsvimult<ivector_slice,ivector,interval>(sl,rv); }
552 #if(CXSC_INDEX_CHECK)
557 {
return _vsvimult<ivector_slice,ivector,interval>(sl,rv); }
559 #if(CXSC_INDEX_CHECK)
564 {
return _vsvsimult<ivector_slice,ivector_slice,interval>(sl1,sl2); }
569 #if(CXSC_INDEX_CHECK)
574 {
return _vvplus<ivector,ivector,ivector>(rv1,rv2); }
576 #if(CXSC_INDEX_CHECK)
581 {
return _vvsplus<ivector,ivector_slice,ivector>(rv,sl); }
583 #if(CXSC_INDEX_CHECK)
588 {
return _vvsplus<ivector,ivector_slice,ivector>(rv,sl); }
590 #if(CXSC_INDEX_CHECK)
595 {
return _vsvsplus<ivector_slice,ivector_slice,ivector>(sl1,sl2); }
597 #if(CXSC_INDEX_CHECK)
602 {
return _vvplusassign(rv1,rv2); }
604 #if(CXSC_INDEX_CHECK)
609 {
return _vvsplusassign(rv,sl); }
611 #if(CXSC_INDEX_CHECK)
616 {
return _vsvplusassign(*
this,rv); }
618 #if(CXSC_INDEX_CHECK)
623 {
return _vsvsplusassign(*
this,sl2); }
628 #if(CXSC_INDEX_CHECK)
633 {
return _vvminus<ivector,ivector,ivector>(rv1,rv2); }
635 #if(CXSC_INDEX_CHECK)
640 {
return _vvsminus<ivector,ivector_slice,ivector>(rv,sl); }
642 #if(CXSC_INDEX_CHECK)
647 {
return _vsvminus<ivector_slice,ivector,ivector>(sl,rv); }
649 #if(CXSC_INDEX_CHECK)
654 {
return _vsvsminus<ivector_slice,ivector_slice,ivector>(sl1,sl2); }
656 #if(CXSC_INDEX_CHECK)
661 {
return _vvminusassign(rv1,rv2); }
663 #if(CXSC_INDEX_CHECK)
668 {
return _vvsminusassign(rv,sl); }
670 #if(CXSC_INDEX_CHECK)
675 {
return _vsvminusassign(*
this,rv); }
677 #if(CXSC_INDEX_CHECK)
682 {
return _vsvsminusassign(*
this,sl2); }
685 #if(CXSC_INDEX_CHECK)
690 {
return _vvconv<ivector,ivector,ivector>(rv1,rv2); }
692 #if(CXSC_INDEX_CHECK)
697 {
return _vvsconv<ivector,ivector_slice,ivector>(rv,sl); }
699 #if(CXSC_INDEX_CHECK)
704 {
return _vvsconv<ivector,ivector_slice,ivector>(rv,sl); }
706 #if(CXSC_INDEX_CHECK)
711 {
return _vsvsconv<ivector_slice,ivector_slice,ivector>(sl1,sl2); }
713 #if(CXSC_INDEX_CHECK)
718 {
return _vvconvassign(rv1,rv2); }
720 #if(CXSC_INDEX_CHECK)
725 {
return _vvsconvassign(rv,sl); }
727 #if(CXSC_INDEX_CHECK)
732 {
return _vsvconvassign(*
this,rv); }
734 #if(CXSC_INDEX_CHECK)
739 {
return _vsvsconvassign(*
this,sl2); }
742 #if(CXSC_INDEX_CHECK)
747 {
return _vvsect<ivector,ivector,ivector>(rv1,rv2); }
749 #if(CXSC_INDEX_CHECK)
754 {
return _vvssect<ivector,ivector_slice,ivector>(rv,sl); }
756 #if(CXSC_INDEX_CHECK)
761 {
return _vvssect<ivector,ivector_slice,ivector>(rv,sl); }
763 #if(CXSC_INDEX_CHECK)
768 {
return _vsvssect<ivector_slice,ivector_slice,ivector>(sl1,sl2); }
770 #if(CXSC_INDEX_CHECK)
775 {
return _vvsectassign(rv1,rv2); }
777 #if(CXSC_INDEX_CHECK)
782 {
return _vvssectassign(rv,sl); }
784 #if(CXSC_INDEX_CHECK)
789 {
return _vsvsectassign(*
this,rv); }
791 #if(CXSC_INDEX_CHECK)
796 {
return _vsvssectassign(*
this,sl2); }
798 INLINE
bool operator ==(
const ivector &rv1,
const ivector &rv2) noexcept {
return _vveq(rv1,rv2); }
802 INLINE
bool operator !=(
const ivector &rv1,
const ivector &rv2) noexcept {
return _vvneq(rv1,rv2); }
806 INLINE
bool operator <(
const ivector &rv1,
const ivector &rv2) noexcept {
return _vvless(rv1,rv2); }
810 INLINE
bool operator <=(
const ivector &rv1,
const ivector &rv2) noexcept {
return _vvleq(rv1,rv2); }
814 INLINE
bool operator >(
const ivector &rv1,
const ivector &rv2) noexcept {
return _vvless(rv2,rv1); }
818 INLINE
bool operator >=(
const ivector &rv1,
const ivector &rv2) noexcept {
return _vvleq(rv2,rv1); }
829 #if(CXSC_INDEX_CHECK)
834 {
return _vvimult<rvector,ivector,interval>(rv1,rv2); }
836 #if(CXSC_INDEX_CHECK)
841 {
return _vsvimult<rvector_slice,ivector,interval>(sl,rv); }
843 #if(CXSC_INDEX_CHECK)
848 {
return _vsvimult<ivector_slice,rvector,interval>(sl,rv); }
850 #if(CXSC_INDEX_CHECK)
855 {
return _vsvsimult<rvector_slice,ivector_slice,interval>(sl1,sl2); }
858 #if(CXSC_INDEX_CHECK)
863 {
return _vvimult<rvector,ivector,interval>(rv2,rv1); }
865 #if(CXSC_INDEX_CHECK)
870 {
return _vsvimult<ivector_slice,rvector,interval>(sl,rv); }
872 #if(CXSC_INDEX_CHECK)
877 {
return _vsvimult<rvector_slice,ivector,interval>(sl,rv); }
879 #if(CXSC_INDEX_CHECK)
884 {
return _vsvsimult<rvector_slice,ivector_slice,interval>(sl2,sl1); }
887 #if(CXSC_INDEX_CHECK)
892 {
return _vvplus<rvector,ivector,ivector>(rv1,rv2); }
894 #if(CXSC_INDEX_CHECK)
899 {
return _vvsplus<rvector,ivector_slice,ivector>(rv,sl); }
901 #if(CXSC_INDEX_CHECK)
906 {
return _vvsplus<ivector,rvector_slice,ivector>(rv,sl); }
908 #if(CXSC_INDEX_CHECK)
913 {
return _vsvsplus<rvector_slice,ivector_slice,ivector>(sl1,sl2); }
916 #if(CXSC_INDEX_CHECK)
921 {
return _vvplus<rvector,ivector,ivector>(rv2,rv1); }
923 #if(CXSC_INDEX_CHECK)
928 {
return _vvsplus<ivector,rvector_slice,ivector>(rv,sl); }
930 #if(CXSC_INDEX_CHECK)
935 {
return _vvsplus<rvector,ivector_slice,ivector>(rv,sl); }
937 #if(CXSC_INDEX_CHECK)
942 {
return _vsvsplus<rvector_slice,ivector_slice,ivector>(sl2,sl1); }
945 #if(CXSC_INDEX_CHECK)
950 {
return _vvplusassign(rv1,rv2); }
952 #if(CXSC_INDEX_CHECK)
957 {
return _vvsplusassign(rv,sl); }
959 #if(CXSC_INDEX_CHECK)
964 {
return _vsvplusassign(*
this,rv); }
966 #if(CXSC_INDEX_CHECK)
971 {
return _vsvsplusassign(*
this,sl2); }
974 #if(CXSC_INDEX_CHECK)
979 {
return _vvminus<rvector,ivector,ivector>(rv1,rv2); }
981 #if(CXSC_INDEX_CHECK)
986 {
return _vvsminus<rvector,ivector_slice,ivector>(rv,sl); }
988 #if(CXSC_INDEX_CHECK)
993 {
return _vsvminus<rvector_slice,ivector,ivector>(sl,rv); }
995 #if(CXSC_INDEX_CHECK)
1000 {
return _vsvsminus<rvector_slice,ivector_slice,ivector>(sl1,sl2); }
1003 #if(CXSC_INDEX_CHECK)
1008 {
return _vvminus<ivector,rvector,ivector>(rv1,rv2); }
1010 #if(CXSC_INDEX_CHECK)
1015 {
return _vvsminus<ivector,rvector_slice,ivector>(rv,sl); }
1017 #if(CXSC_INDEX_CHECK)
1022 {
return _vsvminus<ivector_slice,rvector,ivector>(sl,rv); }
1024 #if(CXSC_INDEX_CHECK)
1029 {
return _vsvsminus<ivector_slice,rvector_slice,ivector>(sl1,sl2); }
1032 #if(CXSC_INDEX_CHECK)
1037 {
return _vvminusassign(rv1,rv2); }
1039 #if(CXSC_INDEX_CHECK)
1044 {
return _vvsminusassign(rv,sl); }
1046 #if(CXSC_INDEX_CHECK)
1051 {
return _vsvminusassign(*
this,rv); }
1053 #if(CXSC_INDEX_CHECK)
1058 {
return _vsvsminusassign(*
this,sl2); }
1061 #if(CXSC_INDEX_CHECK)
1066 {
return _vvconv<rvector,rvector,ivector>(rv1,rv2); }
1068 #if(CXSC_INDEX_CHECK)
1073 {
return _vvsconv<rvector,rvector_slice,ivector>(rv,sl); }
1075 #if(CXSC_INDEX_CHECK)
1080 {
return _vvsconv<rvector,rvector_slice,ivector>(rv,sl); }
1082 #if(CXSC_INDEX_CHECK)
1087 {
return _vsvsconv<rvector_slice,rvector_slice,ivector>(sl1,sl2); }
1089 #if(CXSC_INDEX_CHECK)
1094 {
return _vvconv<rvector,ivector,ivector>(rv1,rv2); }
1096 #if(CXSC_INDEX_CHECK)
1101 {
return _vvsconv<rvector,ivector_slice,ivector>(rv,sl); }
1103 #if(CXSC_INDEX_CHECK)
1108 {
return _vvsconv<ivector,rvector_slice,ivector>(rv,sl); }
1110 #if(CXSC_INDEX_CHECK)
1115 {
return _vsvsconv<rvector_slice,ivector_slice,ivector>(sl1,sl2); }
1118 #if(CXSC_INDEX_CHECK)
1123 {
return _vvconv<rvector,ivector,ivector>(rv2,rv1); }
1125 #if(CXSC_INDEX_CHECK)
1130 {
return _vvsconv<ivector,rvector_slice,ivector>(rv,sl); }
1132 #if(CXSC_INDEX_CHECK)
1137 {
return _vvsconv<rvector,ivector_slice,ivector>(rv,sl); }
1139 #if(CXSC_INDEX_CHECK)
1144 {
return _vsvsconv<rvector_slice,ivector_slice,ivector>(sl2,sl1); }
1147 #if(CXSC_INDEX_CHECK)
1152 {
return _vvconvassign(rv1,rv2); }
1154 #if(CXSC_INDEX_CHECK)
1159 {
return _vvsconvassign(rv,sl); }
1161 #if(CXSC_INDEX_CHECK)
1166 {
return _vsvconvassign(*
this,rv); }
1168 #if(CXSC_INDEX_CHECK)
1173 {
return _vsvsconvassign(*
this,sl2); }
1176 #if(CXSC_INDEX_CHECK)
1181 {
return _vvsect<rvector,ivector,ivector>(rv1,rv2); }
1183 #if(CXSC_INDEX_CHECK)
1188 {
return _vvssect<rvector,ivector_slice,ivector>(rv,sl); }
1190 #if(CXSC_INDEX_CHECK)
1195 {
return _vvssect<ivector,rvector_slice,ivector>(rv,sl); }
1197 #if(CXSC_INDEX_CHECK)
1202 {
return _vsvssect<rvector_slice,ivector_slice,ivector>(sl1,sl2); }
1205 #if(CXSC_INDEX_CHECK)
1210 {
return _vvsect<rvector,ivector,ivector>(rv2,rv1); }
1212 #if(CXSC_INDEX_CHECK)
1217 {
return _vvssect<ivector,rvector_slice,ivector>(rv,sl); }
1219 #if(CXSC_INDEX_CHECK)
1224 {
return _vvssect<rvector,ivector_slice,ivector>(rv,sl); }
1226 #if(CXSC_INDEX_CHECK)
1231 {
return _vsvssect<rvector_slice,ivector_slice,ivector>(sl2,sl1); }
1234 #if(CXSC_INDEX_CHECK)
1239 {
return _vvsectassign(rv1,rv2); }
1241 #if(CXSC_INDEX_CHECK)
1246 {
return _vvssectassign(rv,sl); }
1248 #if(CXSC_INDEX_CHECK)
1253 {
return _vsvsectassign(*
this,rv); }
1255 #if(CXSC_INDEX_CHECK)
1260 {
return _vsvssectassign(*
this,sl2); }
1266 for(
int i=0 ; i<
VecLen(x) ; i++)
1267 x[i+
Lb(x)] = (*this)[p[i+
Lb(p)]+
Lb(*
this)];
1273 #endif // _CXSC_IVECTOR_INL_INCLUDED