--- matrix/vector.cpp.orig Mon May 13 14:07:45 2002 +++ matrix/vector.cpp Thu Nov 30 23:49:51 2006 @@ -51,16 +51,16 @@ if(this==&b) return *this ; - if ( n() != b.n()) + if ( this->n() != b.n()) { - resize(b.n()) ; + this->resize(b.n()) ; } - sze = b.n() ; + this->sze = b.n() ; T *pa, *pb ; - pa = x-1 ; + pa = this->x-1 ; pb = b.x-1 ; - for(int i=n();i>0;--i){ + for(int i=this->n();i>0;--i){ *(++pa) = *(++pb) ; } return *this; @@ -79,13 +79,13 @@ template Vector& Vector::operator=(const BasicArray &b) { - if ( size() != b.size()) + if ( this->size() != b.size()) { - resize(b.size()) ; + this->resize(b.size()) ; } T *ptr ; - ptr = x - 1 ; - for(int i=size()-1;i>=0;--i) + ptr = this->x - 1 ; + for(int i=this->size()-1;i>=0;--i) *(++ptr) = b[i] ; return *this; @@ -105,9 +105,9 @@ template T Vector::operator=(const T d) { - const int sz = size(); + const int sz = this->size(); T *ptr ; - ptr = x-1 ; + ptr = this->x-1 ; for (int i = sz; i > 0; --i) *(++ptr) = d ; @@ -130,19 +130,19 @@ template Vector& Vector::operator+=(const Vector &a) { - if ( a.size() != size()) + if ( a.size() != this->size()) { #ifdef USE_EXCEPTION - throw WrongSize(size(),a.size()) ; + throw WrongSize(this->size(),a.size()) ; #else Error error("Vector::operator+=(Vector&)"); - error << "Vector a += Vector b different sizes, a = " << size() << ", b = " << a.size() ; + error << "Vector a += Vector b different sizes, a = " << this->size() << ", b = " << a.size() ; error.fatal() ; #endif } - const int sz = size(); + const int sz = this->size(); T *ptr,*aptr ; - ptr = x-1 ; + ptr = this->x-1 ; aptr = a.x-1 ; for (int i = sz; i >0; --i) *(++ptr) += *(++aptr) ; @@ -165,20 +165,20 @@ template Vector& Vector::operator-=(const Vector &a) { - if ( a.size() != size()) + if ( a.size() != this->size()) { #ifdef USE_EXCEPTION - throw WrongSize(size(),a.size()) ; + throw WrongSize(this->size(),a.size()) ; #else Error error("Vector::operator-=(Vector&)"); - error << "Vector a -= Vector b different sizes, a = " << size() << ", b = " << a.size() ; + error << "Vector a -= Vector b different sizes, a = " << this->size() << ", b = " << a.size() ; error.fatal() ; #endif } - const int sz = size(); + const int sz = this->size(); T *ptr,*aptr ; - ptr = x-1 ; + ptr = this->x-1 ; aptr = a.x-1 ; for (int i = sz; i > 0; --i) *(++ptr) -= *(++aptr) ; @@ -391,7 +391,7 @@ } T *aptr,*bptr ; - aptr = &x[i]-1 ; + aptr = &this->x[i]-1 ; bptr = b.x-1 ; for ( int j = b.rows(); j > 0; --j) *(++aptr) = *(++bptr) ; @@ -429,7 +429,7 @@ Vector subvec(l) ; T *aptr, *bptr ; - aptr = &x[i] - 1 ; + aptr = &this->x[i] - 1 ; bptr = subvec.x -1 ; for ( int j = l; j > 0; --j) *(++bptr) = *(++aptr) ; @@ -449,12 +449,12 @@ */ template int Vector::minIndex() const { - T min = x[0] ; + T min = this->x[0] ; int index = 0 ; - for(int i=1;in();i++){ + if(this->x[i]<=min){ + min = this->x[i] ; index = i ; } } @@ -523,12 +523,12 @@ T a ; T *v1,*v2 ; - ir = sze-1 ; + ir = this->sze-1 ; l = 0 ; while(1){ if(ir-lx[l] ; for(j=l+1;j<=ir;++j){ a = *(++v1) ; v2 = v1 ; @@ -547,31 +547,31 @@ } else{ k=(l+ir) >> 1 ; - swap(x[k],x[l+1]) ; - if(x[l+1] > x[ir]){ - swap(x[l+1],x[ir]) ; + swap(this->x[k],this->x[l+1]) ; + if(this->x[l+1] > this->x[ir]){ + swap(this->x[l+1],this->x[ir]) ; } - if(x[l]> x[ir]){ - swap(x[l],x[ir]) ; + if(this->x[l]> this->x[ir]){ + swap(this->x[l],this->x[ir]) ; } - if(x[l+1] > x[l]){ - swap(x[l+1],x[l]) ; + if(this->x[l+1] > this->x[l]){ + swap(this->x[l+1],this->x[l]) ; } i=l+1 ; j=ir ; - a=x[l] ; - v1 = &x[i] ; - v2 = &x[j] ; + a=this->x[l] ; + v1 = &this->x[i] ; + v2 = &this->x[j] ; while(1){ while(*v1 < a) { ++i ; ++v1 ; } while(*v2 > a) { --j ; --v2 ; } if(jx[i],this->x[j]) ; } - x[l] = x[j] ; - x[j] = a ; + this->x[l] = this->x[j] ; + this->x[j] = a ; jstack += 2 ; if(jstack>=Nstack){ istack.resize(istack.n()+Nstack) ; // increase the vector size @@ -618,10 +618,10 @@ int jstack=0; T a ; - ir = sze-1 ; + ir = this->sze-1 ; l = 0 ; - index.resize(sze) ; + index.resize(this->sze) ; for(i=0;ix[indext] ; for(i=j-1;i>=0;--i){ - if(x[index[i]] <= a) break ; + if(this->x[index[i]] <= a) break ; index[i+1] = index[i] ; } index[i+1] = indext ; @@ -643,24 +643,24 @@ else{ k=(l+ir) >> 1 ; swap(index[k],index[l+1]) ; - if(x[index[l+1]] > x[index[ir]]){ + if(this->x[index[l+1]] > this->x[index[ir]]){ swap(index[l+1],index[ir]) ; } - if(x[index[l]]> x[index[ir]]){ + if(this->x[index[l]]> this->x[index[ir]]){ swap(index[l],index[ir]) ; } - if(x[index[l+1]] > x[index[l]]){ + if(this->x[index[l+1]] > this->x[index[l]]){ swap(index[l+1],index[l]) ; } i=l+1 ; j=ir ; indext = index[l] ; - a=x[indext] ; + a=this->x[indext] ; while(1){ - while(x[index[i]] < a) { ++i ; } - while(x[index[j]] > a) { --j ; } + while(this->x[index[i]] < a) { ++i ; } + while(this->x[index[j]] > a) { --j ; } if(jx[index[i]] == this->x[index[j]]) break ; swap(index[i],index[j]) ; }