26 #ifndef _CXSC_RVECTOR_INL_INCLUDED 27 #define _CXSC_RVECTOR_INL_INCLUDED 29 #include "rvector.hpp" 30 #include "intvector.hpp" 52 INLINE
rvector::rvector(
const class index &i)
throw():l(1),u(i._int()),size(i._int())
54 dat=
new real[i._int()];
65 throw(ERROR_RVECTOR_WRONG_BOUNDARIES,ERROR_RVECTOR_NO_MORE_MEMORY):l(i1),u(i2),size(i2-i1+1)
67 throw():l(i1),u(i2),size(i2-i1+1)
71 if(i1>i2) cxscthrow(ERROR_RVECTOR_WRONG_BOUNDARIES(
"rvector::rvector(const int &i1,const int &i2)"));
79 for(
int i=0, j=l-rs.l;i<size;i++,j++)
86 for (
int i=0;i<size;i++)
98 for(
int i=0;i<size;i++)
103 #if(CXSC_INDEX_CHECK) 104 throw(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC)
109 #if(CXSC_INDEX_CHECK) 110 if(i<l||i>u) cxscthrow(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC(
"real & rvector::operator [](const int &i) const"));
116 #if(CXSC_INDEX_CHECK) 117 throw(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC)
122 #if(CXSC_INDEX_CHECK) 123 if(i<l||i>u) cxscthrow(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC(
"real & rvector::operator [](const int &i)"));
129 #if(CXSC_INDEX_CHECK) 130 throw(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC)
135 #if(CXSC_INDEX_CHECK) 136 if(i<start||i>end) cxscthrow(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC(
"real & rvector_slice::operator [](const int &i)"));
142 #if(CXSC_INDEX_CHECK) 143 throw(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC)
148 #if(CXSC_INDEX_CHECK) 149 if(i<start||i>end) cxscthrow(ERROR_RVECTOR_ELEMENT_NOT_IN_VEC(
"real & rvector_slice::operator [](const int &i) const"));
165 #if(CXSC_INDEX_CHECK) 166 throw(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG)
171 #if(CXSC_INDEX_CHECK) 172 if(1<l||i>u) cxscthrow(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG(
"rvector_slice rvector::operator ()(const int &i)"));
188 #if(CXSC_INDEX_CHECK) 189 throw(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG)
194 #if(CXSC_INDEX_CHECK) 195 if(i1<l||i2>u) cxscthrow(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG(
"rvector_slice rvector::operator ()(const int &i1,const int &i2)"));
201 #if(CXSC_INDEX_CHECK) 202 throw(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG)
207 #if(CXSC_INDEX_CHECK) 208 if(1<start||i>end) cxscthrow(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG(
"rvector_slice rvector_slice::operator ()(const int &i)"));
214 #if(CXSC_INDEX_CHECK) 215 throw(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG)
220 #if(CXSC_INDEX_CHECK) 221 if(i1<start||i2>end) cxscthrow(ERROR_RVECTOR_SUB_ARRAY_TOO_BIG(
"rvector_slice rvector_slice::operator ()(const int &i1,const int &i2)"));
227 #if(CXSC_INDEX_CHECK) 228 throw(ERROR_RVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_RVECTOR_USE_OF_UNINITIALIZED_OBJ)
233 #if(CXSC_INDEX_CHECK) 234 if(rv.size>1) cxscthrow(ERROR_RVECTOR_TYPE_CAST_OF_THICK_OBJ(
"real::real(const rvector &rv)"));
235 else if(rv.size<1) cxscthrow(ERROR_RVECTOR_USE_OF_UNINITIALIZED_OBJ(
"real::real(const rvector &rv)"));
241 #if(CXSC_INDEX_CHECK) 242 throw(ERROR_RVECTOR_TYPE_CAST_OF_THICK_OBJ,ERROR_RVECTOR_USE_OF_UNINITIALIZED_OBJ)
247 #if(CXSC_INDEX_CHECK) 248 if(sl.size>1) cxscthrow(ERROR_RVECTOR_TYPE_CAST_OF_THICK_OBJ(
"real::real(const rvector_slice &sl)"));
249 else if(sl.size<1) cxscthrow(ERROR_RVECTOR_USE_OF_UNINITIALIZED_OBJ(
"real::real(const rvector_slice &sl)"));
251 *
this=sl.dat[sl.start-sl.l];
256 INLINE rvector::operator
void*()
throw() {
return _vvoid(*
this); }
259 #if(CXSC_INDEX_CHECK) 260 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
264 {
return _vsvsassign<rvector_slice,rvector_slice>(*
this,sl); }
266 #if(CXSC_INDEX_CHECK) 267 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
271 {
return _vsvassign<rvector_slice,rvector>(*
this,rv); }
273 INLINE rvector_slice::operator
void*()
throw() {
return _vsvoid(*
this); }
285 #if(CXSC_INDEX_CHECK) 286 throw(ERROR__WRONG_BOUNDARIES<rvector>)
290 { _vresize<class rvector,class real>(rv,len); }
292 #if(CXSC_INDEX_CHECK) 293 throw(ERROR__WRONG_BOUNDARIES<rvector>)
297 { _vresize<class rvector,class real>(rv,lb,ub); }
301 INLINE
bool operator !(
const rvector &rv)
throw() {
return _vnot(rv); }
302 INLINE
bool operator !(
const rvector_slice &sl)
throw() {
return _vsnot(sl); }
325 #if(CXSC_INDEX_CHECK) 326 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
330 {
return _vvmult<rvector,rvector,real>(rv1,rv2); }
332 #if(CXSC_INDEX_CHECK) 333 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
337 {
return _vsvmult<rvector_slice,rvector,real>(sl,rv); }
339 #if(CXSC_INDEX_CHECK) 340 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
344 {
return _vsvmult<rvector_slice,rvector,real>(sl,rv); }
346 #if(CXSC_INDEX_CHECK) 347 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
351 {
return _vsvsmult<rvector_slice,rvector_slice,real>(sl1,sl2); }
356 #if(CXSC_INDEX_CHECK) 357 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
361 {
return _vvplus<rvector,rvector,rvector>(rv1,rv2); }
363 #if(CXSC_INDEX_CHECK) 364 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
368 {
return _vvsplus<rvector,rvector_slice,rvector>(rv,sl); }
370 #if(CXSC_INDEX_CHECK) 371 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
375 {
return _vvsplus<rvector,rvector_slice,rvector>(rv,sl); }
377 #if(CXSC_INDEX_CHECK) 378 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
382 {
return _vsvsplus<rvector_slice,rvector_slice,rvector>(sl1,sl2); }
384 #if(CXSC_INDEX_CHECK) 385 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
389 {
return _vvplusassign(rv1,rv2); }
391 #if(CXSC_INDEX_CHECK) 392 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
396 {
return _vvsplusassign(rv,sl); }
398 #if(CXSC_INDEX_CHECK) 399 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
403 {
return _vsvplusassign(*
this,rv); }
405 #if(CXSC_INDEX_CHECK) 406 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
410 {
return _vsvsplusassign(*
this,sl2); }
415 #if(CXSC_INDEX_CHECK) 416 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
420 {
return _vvminus<rvector,rvector,rvector>(rv1,rv2); }
422 #if(CXSC_INDEX_CHECK) 423 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
427 {
return _vvsminus<rvector,rvector_slice,rvector>(rv,sl); }
429 #if(CXSC_INDEX_CHECK) 430 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
434 {
return _vsvminus<rvector_slice,rvector,rvector>(sl,rv); }
436 #if(CXSC_INDEX_CHECK) 437 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
441 {
return _vsvsminus<rvector_slice,rvector_slice,rvector>(sl1,sl2); }
443 #if(CXSC_INDEX_CHECK) 444 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
448 {
return _vvminusassign(rv1,rv2); }
450 #if(CXSC_INDEX_CHECK) 451 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
455 {
return _vvsminusassign(rv,sl); }
457 #if(CXSC_INDEX_CHECK) 458 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
462 {
return _vsvminusassign(*
this,rv); }
464 #if(CXSC_INDEX_CHECK) 465 throw(ERROR__OP_WITH_WRONG_DIM<rvector>)
469 {
return _vsvsminusassign(*
this,sl2); }
471 INLINE
bool operator ==(
const rvector &rv1,
const rvector &rv2)
throw() {
return _vveq(rv1,rv2); }
475 INLINE
bool operator !=(
const rvector &rv1,
const rvector &rv2)
throw() {
return _vvneq(rv1,rv2); }
479 INLINE
bool operator <(
const rvector &rv1,
const rvector &rv2)
throw() {
return _vvless(rv1,rv2); }
483 INLINE
bool operator <=(
const rvector &rv1,
const rvector &rv2)
throw() {
return _vvleq(rv1,rv2); }
487 INLINE
bool operator >(
const rvector &rv1,
const rvector &rv2)
throw() {
return _vvless(rv2,rv1); }
491 INLINE
bool operator >=(
const rvector &rv1,
const rvector &rv2)
throw() {
return _vvleq(rv2,rv1); }
496 INLINE std::ostream &operator <<(std::ostream &s,
const rvector &rv)
throw() {
return _vout(s,rv); }
497 INLINE std::ostream &operator <<(std::ostream &o,
const rvector_slice &sl)
throw() {
return _vsout(o,sl); }
498 INLINE std::istream &operator >>(std::istream &s,
rvector &rv)
throw() {
return _vin(s,rv); }
499 INLINE std::istream &operator >>(std::istream &s,
rvector_slice &rv)
throw() {
return _vsin(s,rv); }
504 for(
int i=0 ; i<
VecLen(x) ; i++)
505 x[i+
Lb(x)] = (*this)[p[i+
Lb(p)]+
Lb(*
this)];
rvector_slice & operator-=(const rvector &rv)
Implementation of subtraction and allocation operation.
cimatrix & operator/=(cimatrix &m, const cinterval &c)
Implementation of division and allocation operation.
rvector & operator=(const rvector &rv)
Implementation of standard assigning operator.
rvector & operator()()
Operator for accessing the whole vector.
int Lb(const cimatrix &rm, const int &i)
Returns the lower bound index.
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.
rvector_slice & operator/=(const real &r)
Implementation of division and allocation operation.
rvector_slice & operator()()
Operator for accessing the whole vector.
int VecLen(const scimatrix_subv &S)
Returns the length of the subvector.
friend int Lb(const rvector &rv)
Returns the lower bound of the vector.
The Data Type rvector_slice.
rvector _rvector(const real &r)
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
real & operator[](const int &i) const
Operator for accessing the single elements of the vector (read-only)
rvector_slice & operator=(const rvector_slice &sl)
Implementation of standard assigning operator.
friend int VecLen(const rvector &rv)
Returns the dimension of the vector.
rvector_slice & operator*=(const real &r)
Implementation of multiplication and allocation operation.
void Resize(cimatrix &A)
Resizes the matrix.
real(void)
Constructor of class real.
cdotprecision & operator+=(cdotprecision &cd, const l_complex &lc)
Implementation of standard algebraic addition and allocation operation.
real & operator[](const int &i)
Operator for accessing the single elements of the vector.
rvector()
Constructor of class rvector.
int Ub(const cimatrix &rm, const int &i)
Returns the upper bound index.
civector operator/(const cimatrix_subv &rv, const cinterval &s)
Implementation of division operation.
rvector_slice & operator+=(const rvector &rv)
Implementation of addition and allocation operation.
cimatrix & operator*=(cimatrix &m, const cinterval &c)
Implementation of multiplication and allocation operation.
ivector abs(const cimatrix_subv &mv)
Returns the absolute value of the matrix.