C-XSC - A C++ Class Library for Extended Scientific Computing
2.5.4
|
00001 /* 00002 ** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4) 00003 ** 00004 ** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik, 00005 ** Universitaet Karlsruhe, Germany 00006 ** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie 00007 ** Universitaet Wuppertal, Germany 00008 ** 00009 ** This library is free software; you can redistribute it and/or 00010 ** modify it under the terms of the GNU Library General Public 00011 ** License as published by the Free Software Foundation; either 00012 ** version 2 of the License, or (at your option) any later version. 00013 ** 00014 ** This library is distributed in the hope that it will be useful, 00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 ** Library General Public License for more details. 00018 ** 00019 ** You should have received a copy of the GNU Library General Public 00020 ** License along with this library; if not, write to the Free 00021 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 00024 /* CVS $Id: rvector.inl,v 1.26 2014/01/30 17:23:48 cxsc Exp $ */ 00025 00026 #ifndef _CXSC_RVECTOR_INL_INCLUDED 00027 #define _CXSC_RVECTOR_INL_INCLUDED 00028 00029 #include "rvector.hpp" 00030 #include "intvector.hpp" 00031 00032 namespace cxsc { 00033 00037 INLINE rvector::rvector () throw():dat(NULL),l(1),u(0),size(0) 00038 { 00039 } 00040 00046 INLINE rvector::rvector(const int &i) throw():l(1),u(i),size(i) 00047 { 00048 dat=new real[i]; 00049 } 00050 00051 #ifdef OLD_CXSC 00052 INLINE rvector::rvector(const class index &i) throw():l(1),u(i._int()),size(i._int()) 00053 { 00054 dat=new real[i._int()]; 00055 } 00056 #endif 00057 00063 INLINE rvector::rvector(const int &i1,const int &i2) 00064 #if(CXSC_INDEX_CHECK) 00065 throw(ERROR_RVECTOR_WRONG_BOUNDARIES,ERROR_RVECTOR_NO_MORE_MEMORY):l(i1),u(i2),size(i2-i1+1) 00066 #else 00067 throw():l(i1),u(i2),size(i2-i1+1) 00068 #endif 00069 { 00070 #if(CXSC_INDEX_CHECK) 00071 if(i1>i2) cxscthrow(ERROR_RVECTOR_WRONG_BOUNDARIES("rvector::rvector(const int &i1,const int &i2)")); 00072 #endif 00073 dat=new real[size]; 00074 } 00075 00076 INLINE rvector::rvector(const rvector_slice &rs) throw():l(rs.start),u(rs.end),size(rs.end-rs.start+1) 00077 { 00078 dat=new real[size]; 00079 for(int i=0, j=l-rs.l;i<size;i++,j++) 00080 dat[i]=rs.dat[j]; 00081 } 00082 00083 INLINE rvector::rvector(const rvector &v) throw():l(v.l),u(v.u),size(v.size) 00084 { 00085 dat=new real[size]; 00086 for (int i=0;i<size;i++) 00087 dat[i]=v.dat[i]; 00088 } 00089 00090 INLINE rvector::rvector(const real &r) throw():l(1),u(1),size(1) 00091 { 00092 dat=new real[1]; 00093 *dat=r; 00094 } 00095 00096 INLINE rvector::rvector(const intvector& v) : l(Lb(v)),u(Ub(v)),size(VecLen(v)) { 00097 dat=new real[size]; 00098 for(int i=0;i<size;i++) 00099 dat[i] = v[i+l]; 00100 } 00101 00102 INLINE real & rvector::operator [](const int &i) const 00103 #if(CXSC_INDEX_CHECK) 00104 throw(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC) 00105 #else 00106 throw() 00107 #endif 00108 { 00109 #if(CXSC_INDEX_CHECK) 00110 if(i<l||i>u) cxscthrow(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC("real & rvector::operator [](const int &i) const")); 00111 #endif 00112 return dat[i-l]; 00113 } 00114 00115 INLINE real & rvector::operator [](const int &i) 00116 #if(CXSC_INDEX_CHECK) 00117 throw(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC) 00118 #else 00119 throw() 00120 #endif 00121 { 00122 #if(CXSC_INDEX_CHECK) 00123 if(i<l||i>u) cxscthrow(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC("real & rvector::operator [](const int &i)")); 00124 #endif 00125 return dat[i-l]; 00126 } 00127 00128 INLINE real & rvector_slice::operator [](const int &i) 00129 #if(CXSC_INDEX_CHECK) 00130 throw(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC) 00131 #else 00132 throw() 00133 #endif 00134 { 00135 #if(CXSC_INDEX_CHECK) 00136 if(i<start||i>end) cxscthrow(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC("real & rvector_slice::operator [](const int &i)")); 00137 #endif 00138 return dat[i-l]; 00139 } 00140 00141 INLINE real & rvector_slice::operator [](const int &i) const 00142 #if(CXSC_INDEX_CHECK) 00143 throw(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC) 00144 #else 00145 throw() 00146 #endif 00147 { 00148 #if(CXSC_INDEX_CHECK) 00149 if(i<start||i>end) cxscthrow(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC("real & rvector_slice::operator [](const int &i) const")); 00150 #endif 00151 return dat[i-l]; 00152 } 00153 00154 00164 INLINE rvector_slice rvector::operator ()(const int &i) 00165 #if(CXSC_INDEX_CHECK) 00166 throw(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG) 00167 #else 00168 throw() 00169 #endif 00170 { 00171 #if(CXSC_INDEX_CHECK) 00172 if(1<l||i>u) cxscthrow(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG("rvector_slice rvector::operator ()(const int &i)")); 00173 #endif 00174 return rvector_slice(*this,1,i); 00175 } 00176 00187 INLINE rvector_slice rvector::operator ()(const int &i1,const int &i2) 00188 #if(CXSC_INDEX_CHECK) 00189 throw(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG) 00190 #else 00191 throw() 00192 #endif 00193 { 00194 #if(CXSC_INDEX_CHECK) 00195 if(i1<l||i2>u) cxscthrow(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG("rvector_slice rvector::operator ()(const int &i1,const int &i2)")); 00196 #endif 00197 return rvector_slice(*this,i1,i2); 00198 } 00199 00200 INLINE rvector_slice rvector_slice::operator ()(const int &i) 00201 #if(CXSC_INDEX_CHECK) 00202 throw(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG) 00203 #else 00204 throw() 00205 #endif 00206 { 00207 #if(CXSC_INDEX_CHECK) 00208 if(1<start||i>end) cxscthrow(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG("rvector_slice rvector_slice::operator ()(const int &i)")); 00209 #endif 00210 return rvector_slice(*this,1,i); 00211 } 00212 00213 INLINE rvector_slice rvector_slice::operator ()(const int &i1,const int &i2) 00214 #if(CXSC_INDEX_CHECK) 00215 throw(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG) 00216 #else 00217 throw() 00218 #endif 00219 { 00220 #if(CXSC_INDEX_CHECK) 00221 if(i1<start||i2>end) cxscthrow(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG("rvector_slice rvector_slice::operator ()(const int &i1,const int &i2)")); 00222 #endif 00223 return rvector_slice(*this,i1,i2); 00224 } 00225 00226 INLINE real::real(const rvector &rv) 00227 #if(CXSC_INDEX_CHECK) 00228 throw(ERROR_RVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_RVECTOR_USE_OF_UNINITIALIZED_OBJ) 00229 #else 00230 throw() 00231 #endif 00232 { 00233 #if(CXSC_INDEX_CHECK) 00234 if(rv.size>1) cxscthrow(ERROR_RVECTOR_TYPE_CAST_OF_THICK_OBJ("real::real(const rvector &rv)")); 00235 else if(rv.size<1) cxscthrow(ERROR_RVECTOR_USE_OF_UNINITIALIZED_OBJ("real::real(const rvector &rv)")); 00236 #endif 00237 *this=rv.dat[0]; 00238 } 00239 00240 INLINE real::real(const rvector_slice &sl) 00241 #if(CXSC_INDEX_CHECK) 00242 throw(ERROR_RVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_RVECTOR_USE_OF_UNINITIALIZED_OBJ) 00243 #else 00244 throw() 00245 #endif 00246 { 00247 #if(CXSC_INDEX_CHECK) 00248 if(sl.size>1) cxscthrow(ERROR_RVECTOR_TYPE_CAST_OF_THICK_OBJ("real::real(const rvector_slice &sl)")); 00249 else if(sl.size<1) cxscthrow(ERROR_RVECTOR_USE_OF_UNINITIALIZED_OBJ("real::real(const rvector_slice &sl)")); 00250 #endif 00251 *this=sl.dat[sl.start-sl.l]; 00252 } 00253 00254 INLINE rvector &rvector::operator =(const rvector &rv) throw() { return _vvassign<rvector,rvector,real>(*this,rv); } 00255 INLINE rvector &rvector::operator =(const real &r) throw() { return _vsassign<rvector,real>(*this,r); } 00256 INLINE rvector::operator void*() throw() { return _vvoid(*this); } 00257 00258 INLINE rvector_slice & rvector_slice::operator =(const rvector_slice &sl) 00259 #if(CXSC_INDEX_CHECK) 00260 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00261 #else 00262 throw() 00263 #endif 00264 { return _vsvsassign<rvector_slice,rvector_slice>(*this,sl); } 00265 INLINE rvector_slice & rvector_slice::operator =(const rvector &rv) 00266 #if(CXSC_INDEX_CHECK) 00267 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00268 #else 00269 throw() 00270 #endif 00271 { return _vsvassign<rvector_slice,rvector>(*this,rv); } 00272 INLINE rvector_slice & rvector_slice::operator =(const real &r) throw() { return _vssassign<rvector_slice,real>(*this,r); } 00273 INLINE rvector_slice::operator void*() throw() { return _vsvoid(*this); } 00274 00275 //======================== Vector Functions ============================= 00281 INLINE rvector _rvector(const real &r) throw() { return rvector(r); } 00282 00283 INLINE void Resize(rvector &rv) throw() { _vresize(rv); } 00284 INLINE void Resize(rvector &rv, const int &len) 00285 #if(CXSC_INDEX_CHECK) 00286 throw(ERROR__WRONG_BOUNDARIES<rvector>) 00287 #else 00288 throw() 00289 #endif 00290 { _vresize<class rvector,class real>(rv,len); } 00291 INLINE void Resize(rvector &rv, const int &lb, const int &ub) 00292 #if(CXSC_INDEX_CHECK) 00293 throw(ERROR__WRONG_BOUNDARIES<rvector>) 00294 #else 00295 throw() 00296 #endif 00297 { _vresize<class rvector,class real>(rv,lb,ub); } 00298 00299 INLINE rvector abs(const rvector &rv) throw() { return _vabs<rvector,rvector>(rv); } 00300 INLINE rvector abs(const rvector_slice &sl) throw() { return _vsabs<rvector_slice,rvector>(sl); } 00301 INLINE bool operator !(const rvector &rv) throw() { return _vnot(rv); } 00302 INLINE bool operator !(const rvector_slice &sl) throw() { return _vsnot(sl); } 00303 00304 //======================= Vector / Scalar =============================== 00305 00306 INLINE rvector operator *(const rvector &rv, const real &s) throw() { return _vsmult<rvector,real,rvector>(rv,s); } 00307 INLINE rvector operator *(const rvector_slice &sl, const real &s) throw() { return _vssmult<rvector_slice,real,rvector>(sl,s); } 00308 INLINE rvector operator *(const real &s, const rvector &rv) throw() { return _vsmult<rvector,real,rvector>(rv,s); } 00309 INLINE rvector operator *(const real &s, const rvector_slice &sl) throw() { return _vssmult<rvector_slice,real,rvector>(sl,s); } 00310 INLINE rvector &operator *=(rvector &rv,const real &r) throw() { return _vsmultassign(rv,r); } 00311 INLINE rvector_slice &rvector_slice::operator *=(const real &r) throw() { return _vssmultassign(*this,r); } 00312 00313 INLINE rvector operator /(const rvector &rv, const real &s) throw() { return _vsdiv<rvector,real,rvector>(rv,s); } 00314 INLINE rvector operator /(const rvector_slice &sl, const real &s) throw() { return _vssdiv<rvector_slice,real,rvector>(sl,s); } 00315 INLINE rvector &operator /=(rvector &rv,const real &r) throw() { return _vsdivassign(rv,r); } 00316 INLINE rvector_slice &rvector_slice::operator /=(const real &r) throw() { return _vssdivassign(*this,r); } 00317 00318 //======================= Vector / Vector =============================== 00319 00320 INLINE rvector &rvector::operator =(const rvector_slice &sl) throw() { return _vvsassign<rvector,rvector_slice,real>(*this,sl); } 00321 00322 00323 00324 INLINE real operator *(const rvector & rv1, const rvector &rv2) 00325 #if(CXSC_INDEX_CHECK) 00326 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00327 #else 00328 throw() 00329 #endif 00330 { return _vvmult<rvector,rvector,real>(rv1,rv2); } 00331 INLINE real operator *(const rvector_slice &sl, const rvector &rv) 00332 #if(CXSC_INDEX_CHECK) 00333 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00334 #else 00335 throw() 00336 #endif 00337 { return _vsvmult<rvector_slice,rvector,real>(sl,rv); } 00338 INLINE real operator *(const rvector &rv, const rvector_slice &sl) 00339 #if(CXSC_INDEX_CHECK) 00340 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00341 #else 00342 throw() 00343 #endif 00344 { return _vsvmult<rvector_slice,rvector,real>(sl,rv); } 00345 INLINE real operator *(const rvector_slice & sl1, const rvector_slice &sl2) 00346 #if(CXSC_INDEX_CHECK) 00347 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00348 #else 00349 throw() 00350 #endif 00351 { return _vsvsmult<rvector_slice,rvector_slice,real>(sl1,sl2); } 00352 00353 INLINE const rvector &operator +(const rvector &rv) throw() { return rv; } 00354 INLINE rvector operator +(const rvector_slice &sl) throw() { return sl; } 00355 INLINE rvector operator +(const rvector &rv1, const rvector &rv2) 00356 #if(CXSC_INDEX_CHECK) 00357 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00358 #else 00359 throw() 00360 #endif 00361 { return _vvplus<rvector,rvector,rvector>(rv1,rv2); } 00362 INLINE rvector operator +(const rvector &rv, const rvector_slice &sl) 00363 #if(CXSC_INDEX_CHECK) 00364 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00365 #else 00366 throw() 00367 #endif 00368 { return _vvsplus<rvector,rvector_slice,rvector>(rv,sl); } 00369 INLINE rvector operator +(const rvector_slice &sl, const rvector &rv) 00370 #if(CXSC_INDEX_CHECK) 00371 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00372 #else 00373 throw() 00374 #endif 00375 { return _vvsplus<rvector,rvector_slice,rvector>(rv,sl); } 00376 INLINE rvector operator +(const rvector_slice &sl1, const rvector_slice &sl2) 00377 #if(CXSC_INDEX_CHECK) 00378 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00379 #else 00380 throw() 00381 #endif 00382 { return _vsvsplus<rvector_slice,rvector_slice,rvector>(sl1,sl2); } 00383 INLINE rvector & operator +=(rvector &rv1, const rvector &rv2) 00384 #if(CXSC_INDEX_CHECK) 00385 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00386 #else 00387 throw() 00388 #endif 00389 { return _vvplusassign(rv1,rv2); } 00390 INLINE rvector &operator +=(rvector &rv, const rvector_slice &sl) 00391 #if(CXSC_INDEX_CHECK) 00392 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00393 #else 00394 throw() 00395 #endif 00396 { return _vvsplusassign(rv,sl); } 00397 INLINE rvector_slice &rvector_slice::operator +=(const rvector &rv) 00398 #if(CXSC_INDEX_CHECK) 00399 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00400 #else 00401 throw() 00402 #endif 00403 { return _vsvplusassign(*this,rv); } 00404 INLINE rvector_slice &rvector_slice::operator +=(const rvector_slice &sl2) 00405 #if(CXSC_INDEX_CHECK) 00406 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00407 #else 00408 throw() 00409 #endif 00410 { return _vsvsplusassign(*this,sl2); } 00411 00412 INLINE rvector operator -(const rvector &rv) throw() { return _vminus(rv); } 00413 INLINE rvector operator -(const rvector_slice &sl) throw() { return _vsminus<rvector_slice,rvector>(sl); } 00414 INLINE rvector operator -(const rvector &rv1, const rvector &rv2) 00415 #if(CXSC_INDEX_CHECK) 00416 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00417 #else 00418 throw() 00419 #endif 00420 { return _vvminus<rvector,rvector,rvector>(rv1,rv2); } 00421 INLINE rvector operator -(const rvector &rv, const rvector_slice &sl) 00422 #if(CXSC_INDEX_CHECK) 00423 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00424 #else 00425 throw() 00426 #endif 00427 { return _vvsminus<rvector,rvector_slice,rvector>(rv,sl); } 00428 INLINE rvector operator -(const rvector_slice &sl, const rvector &rv) 00429 #if(CXSC_INDEX_CHECK) 00430 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00431 #else 00432 throw() 00433 #endif 00434 { return _vsvminus<rvector_slice,rvector,rvector>(sl,rv); } 00435 INLINE rvector operator -(const rvector_slice &sl1, const rvector_slice &sl2) 00436 #if(CXSC_INDEX_CHECK) 00437 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00438 #else 00439 throw() 00440 #endif 00441 { return _vsvsminus<rvector_slice,rvector_slice,rvector>(sl1,sl2); } 00442 INLINE rvector & operator -=(rvector &rv1, const rvector &rv2) 00443 #if(CXSC_INDEX_CHECK) 00444 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00445 #else 00446 throw() 00447 #endif 00448 { return _vvminusassign(rv1,rv2); } 00449 INLINE rvector &operator -=(rvector &rv, const rvector_slice &sl) 00450 #if(CXSC_INDEX_CHECK) 00451 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00452 #else 00453 throw() 00454 #endif 00455 { return _vvsminusassign(rv,sl); } 00456 INLINE rvector_slice &rvector_slice::operator -=(const rvector &rv) 00457 #if(CXSC_INDEX_CHECK) 00458 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00459 #else 00460 throw() 00461 #endif 00462 { return _vsvminusassign(*this,rv); } 00463 INLINE rvector_slice &rvector_slice::operator -=(const rvector_slice &sl2) 00464 #if(CXSC_INDEX_CHECK) 00465 throw(ERROR__OP_WITH_WRONG_DIM<rvector>) 00466 #else 00467 throw() 00468 #endif 00469 { return _vsvsminusassign(*this,sl2); } 00470 00471 INLINE bool operator ==(const rvector &rv1, const rvector &rv2) throw() { return _vveq(rv1,rv2); } 00472 INLINE bool operator ==(const rvector_slice &sl1, const rvector_slice &sl2) throw() { return _vsvseq(sl1,sl2); } 00473 INLINE bool operator ==(const rvector_slice &sl, const rvector &rv) throw() { return _vsveq(sl,rv); } 00474 INLINE bool operator ==(const rvector &rv, const rvector_slice &sl) throw() { return _vsveq(sl,rv); } 00475 INLINE bool operator !=(const rvector &rv1, const rvector &rv2) throw() { return _vvneq(rv1,rv2); } 00476 INLINE bool operator !=(const rvector_slice &sl1, const rvector_slice &sl2) throw() { return _vsvsneq(sl1,sl2); } 00477 INLINE bool operator !=(const rvector_slice &sl, const rvector &rv) throw() { return _vsvneq(sl,rv); } 00478 INLINE bool operator !=(const rvector &rv, const rvector_slice &sl) throw() { return _vsvneq(sl,rv); } 00479 INLINE bool operator <(const rvector &rv1, const rvector &rv2) throw() { return _vvless(rv1,rv2); } 00480 INLINE bool operator <(const rvector_slice &sl1, const rvector_slice &sl2) throw() { return _vsvsless(sl1,sl2); } 00481 INLINE bool operator < (const rvector_slice &sl, const rvector &rv) throw() { return _vsvless(sl,rv); } 00482 INLINE bool operator < (const rvector &rv, const rvector_slice &sl) throw() { return _vvsless(rv,sl); } 00483 INLINE bool operator <=(const rvector &rv1, const rvector &rv2) throw() { return _vvleq(rv1,rv2); } 00484 INLINE bool operator <=(const rvector_slice &sl1, const rvector_slice &sl2) throw() { return _vsvsleq(sl1,sl2); } 00485 INLINE bool operator <=(const rvector_slice &sl, const rvector &rv) throw() { return _vsvleq(sl,rv); } 00486 INLINE bool operator <=(const rvector &rv, const rvector_slice &sl) throw() { return _vvsleq(rv,sl); } 00487 INLINE bool operator >(const rvector &rv1, const rvector &rv2) throw() { return _vvless(rv2,rv1); } 00488 INLINE bool operator >(const rvector_slice &sl1, const rvector_slice &sl2) throw() { return _vsvsless(sl2,sl1); } 00489 INLINE bool operator >(const rvector_slice &sl, const rvector &rv) throw() { return _vvsless(rv,sl); } 00490 INLINE bool operator >(const rvector &rv, const rvector_slice &sl) throw() { return _vsvless(sl,rv); } 00491 INLINE bool operator >=(const rvector &rv1, const rvector &rv2) throw() { return _vvleq(rv2,rv1); } 00492 INLINE bool operator >=(const rvector_slice &sl1, const rvector_slice &sl2) throw() { return _vsvsleq(sl2,sl1); } 00493 INLINE bool operator >=(const rvector_slice &sl, const rvector &rv) throw() { return _vvsleq(rv,sl); } 00494 INLINE bool operator >=(const rvector &rv, const rvector_slice &sl) throw() { return _vsvleq(sl,rv); } 00495 00496 INLINE std::ostream &operator <<(std::ostream &s, const rvector &rv) throw() { return _vout(s,rv); } 00497 INLINE std::ostream &operator <<(std::ostream &o, const rvector_slice &sl) throw() { return _vsout(o,sl); } 00498 INLINE std::istream &operator >>(std::istream &s, rvector &rv) throw() { return _vin(s,rv); } 00499 INLINE std::istream &operator >>(std::istream &s, rvector_slice &rv) throw() { return _vsin(s,rv); } 00500 00502 INLINE rvector rvector::operator()(const intvector& p) { 00503 rvector x(*this); 00504 for(int i=0 ; i<VecLen(x) ; i++) 00505 x[i+Lb(x)] = (*this)[p[i+Lb(p)]+Lb(*this)]; 00506 return x; 00507 } 00508 00509 00510 00511 00512 } // namespace cxsc 00513 00514 #endif 00515