#ifndef __VALARRAY_CC #define __VALARRAY_CC #pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig /*************************************************************************** * * valaray.cc - Declarations for the Standard Library valarray * *************************************************************************** * * Copyright (c) 1994-1999 Rogue Wave Software, Inc. All Rights Reserved. * * This computer software is owned by Rogue Wave Software, Inc. and is * protected by U.S. copyright laws and other laws and by international * treaties. This computer software is furnished by Rogue Wave Software, * Inc. pursuant to a written license agreement and may be used, copied, * transmitted, and stored only in accordance with the terms of such * license and with the inclusion of the above copyright notice. This * computer software or any other copies thereof may not be provided or * otherwise made available to any other person. * * U.S. Government Restricted Rights. This computer software is provided * with Restricted Rights. Use, duplication, or disclosure by the * Government is subject to restrictions as set forth in subparagraph (c) * (1) (ii) of The Rights in Technical Data and Computer Software clause * at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the * Commercial Computer Software – Restricted Rights at 48 CFR 52.227-19, * as applicable. Manufacturer is Rogue Wave Software, Inc., 5500 * Flatiron Parkway, Boulder, Colorado 80301 USA. * **************************************************************************/ #if defined ( __SUNPRO_CC ) || defined (__EDG__) #include #endif #ifndef _RWSTD_NO_NAMESPACE namespace std { #endif #if !defined (_RWSTD_NO_NAMESPACE) && defined (_RWSTD_NO_NEW_HEADER) using ::abs; using ::cos; using ::sin; using ::tan; using ::asin; using ::acos; using ::atan; using ::atan2; using ::sinh; using ::cosh; using ::tanh; using ::exp; using ::log; using ::log10; using ::sqrt; using ::pow; #endif /***************************************************************** * * * VALARRAY MEMBER FUNCTIONS * * * ******************************************************************/ // unary operators template valarray valarray::operator+() const { valarray tmp_array(size()); for(size_t ind=0; ind< size(); ind++ ) tmp_array[ind] = +memory_array[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray valarray::operator-() const { valarray tmp_array(size()); for(size_t ind=0; ind< size(); ind++ ) tmp_array[ind] = -memory_array[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION template valarray valarray::operator~() const { valarray tmp_array(size()); for(size_t ind=0; ind< size(); ind++ ) tmp_array[ind] = ~memory_array[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray valarray::operator!() const { valarray tmp_array(size()); for(size_t ind=0; ind< size(); ind++ ) tmp_array[ind] = !memory_array[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } #endif // computed assignment template valarray& valarray::operator*= (const valarray& array) { size_t upper_l = ( size() < array.size() ) ? size() : array.size(); for(size_t ind=0; ind < upper_l; ind++) memory_array[ind]*= array[ind]; return *this; } template valarray& valarray::operator/= (const valarray& array) { size_t upper_l = ( size() < array.size() ) ? size() : array.size(); for(size_t ind=0; ind < upper_l; ind++) memory_array[ind]/= array[ind]; return *this; } template valarray& valarray::operator+= (const valarray& array) { size_t upper_l = ( size() < array.size() ) ? size() : array.size(); for(size_t ind=0; ind < upper_l; ind++) memory_array[ind]+= array[ind]; return *this; } template valarray& valarray::operator-= (const valarray& array) { size_t upper_l = ( size() < array.size() ) ? size() : array.size(); for(size_t ind=0; ind < upper_l; ind++) memory_array[ind]-= array[ind]; return *this; } #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION template valarray& valarray::operator%= (const valarray& array) { size_t upper_l = ( size() < array.size() ) ? size() : array.size(); for(size_t ind=0; ind < upper_l; ind++) memory_array[ind]%= array[ind]; return *this; } template valarray& valarray::operator^= (const valarray& array) { size_t upper_l = ( size() < array.size() ) ? size() : array.size(); for(size_t ind=0; ind < upper_l; ind++) memory_array[ind]^= array[ind]; return *this; } template valarray& valarray::operator&= (const valarray& array) { size_t upper_l = ( size() < array.size() ) ? size() : array.size(); for(size_t ind=0; ind < upper_l; ind++) memory_array[ind]&= array[ind]; return *this; } template valarray& valarray::operator|= (const valarray& array) { size_t upper_l = ( size() < array.size() ) ? size() : array.size(); for(size_t ind=0; ind < upper_l; ind++) memory_array[ind]|= array[ind]; return *this; } template valarray& valarray::operator<<= (const valarray& array) { size_t upper_l = ( size() < array.size() ) ? size() : array.size(); for(size_t ind=0; ind < upper_l; ind++) memory_array[ind]<<= array[ind]; return *this; } template valarray& valarray::operator>>= (const valarray& array) { size_t upper_l = ( size() < array.size() ) ? size() : array.size(); for(size_t ind=0; ind < upper_l; ind++) memory_array[ind]>>= array[ind]; return *this; } #endif template valarray& valarray::operator*= (const T& val) { for(size_t ind=0; ind < size(); ind++) memory_array[ind]*= val; return *this; } template valarray& valarray::operator/= (const T& val) { for(size_t ind=0; ind < size(); ind++) memory_array[ind]/= val; return *this; } template valarray& valarray::operator+= (const T& val) { for(size_t ind=0; ind < size(); ind++) memory_array[ind]+= val; return *this; } template valarray& valarray::operator-= (const T& val) { for(size_t ind=0; ind < size(); ind++) memory_array[ind]-= val; return *this; } #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION template valarray& valarray::operator%= (const T& val) { for(size_t ind=0; ind < size(); ind++) memory_array[ind]%= val; return *this; } template valarray& valarray::operator^= (const T& val) { for(size_t ind=0; ind < size(); ind++) memory_array[ind]^= val; return *this; } template valarray& valarray::operator&= (const T& val) { for(size_t ind=0; ind < size(); ind++) memory_array[ind]&= val; return *this; } template valarray& valarray::operator|= (const T& val) { for(size_t ind=0; ind < size(); ind++) memory_array[ind]|= val; return *this; } template valarray& valarray::operator<<= (const T& val) { for(size_t ind=0; ind < size(); ind++) memory_array[ind]<<= val; return *this; } template valarray& valarray::operator>>= (const T& val) { for(size_t ind=0; ind < size(); ind++) memory_array[ind]>>= val; return *this; } #endif // other valarray member functions template T valarray::sum() const { T tmp; if ( size() > 0 ) { tmp = memory_array[0]; for(size_t ind=1; ind valarray valarray::shift(int sh) const { valarray tmp_array(T(),size()); int right=0; int left=0; if ( sh < 0 ) right = -sh; else left = sh; for(size_t ind=left; ind< (size()-right); ind++ ) tmp_array[ind+right-left] = memory_array[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray valarray::cshift(int sh) const { valarray tmp_array(T(),size()); if ( sh >= 0 ) { for(size_t ind=0; ind< size(); ind++ ) tmp_array[ind] = memory_array[(ind+sh)%size()]; } else { for(size_t ind=size()+sh; ind< (2*size()+sh); ind++ ) tmp_array[ind-size()-sh] = memory_array[ind%size()]; } _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray valarray::apply(T func(T)) const { valarray tmp_array(size()); for(size_t ind=0; ind< size(); ind++ ) tmp_array[ind] = func(memory_array[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray valarray::apply(T func(const T&)) const { valarray tmp_array(size()); for(size_t ind=0; ind< size(); ind++ ) tmp_array[ind] = func(memory_array[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } // operator[] for slice template valarray valarray::operator[](slice sl) const { valarray tmp_array(sl.size()); size_t ind = sl.start(); size_t cpt = 0; while( cpt < sl.size() ) { tmp_array[cpt] = memory_array[ind]; ind+= sl.stride(); cpt++; } _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = sl.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } // copy ctor and assignment for slice template valarray::valarray(const slice_array& sl_ar) { valarray tmp_array(sl_ar.get_slice().size()); size_t ind = sl_ar.get_slice().start(); size_t cpt = 0; while( cpt < sl_ar.get_slice().size() ) { tmp_array[cpt] = (*(sl_ar.get_ref_mem_array()))[ind]; ind+= sl_ar.get_slice().stride(); cpt++; } memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),sl_ar.get_slice().size()); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); } template valarray& valarray::operator= (const slice_array& sl_ar) { valarray tmp_array(sl_ar.get_slice().size()); size_t ind = sl_ar.get_slice().start(); size_t cpt = 0; while( cpt < sl_ar.get_slice().size() ) { tmp_array[cpt] = (*(sl_ar.get_ref_mem_array()))[ind]; ind+= sl_ar.get_slice().stride(); cpt++; } if ( &memory_array == sl_ar.get_ref_mem_array() ) memory_array._RW_resize_without_copy(0); memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),sl_ar.get_slice().size()); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return *this; } // operator[] for gslice template valarray valarray::operator[](const gslice& sl) const { valarray tmp_array(sl.ind_numb()); gslice *gsl = (gslice *)&sl; size_t ind = gsl->next_ind(); size_t cpt = 0; while( !sl.is_reseted() ) { tmp_array[cpt] = memory_array[ind]; ind= gsl->next_ind(); cpt++; } _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = tmp_array.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } // copy ctor and assignment for gslice template valarray::valarray(const gslice_array& sl_ar) { gslice sl(sl_ar.get_slice()); valarray tmp_array(sl.ind_numb()); size_t ind = sl.next_ind(); size_t cpt = 0; while( !sl.is_reseted() ) { tmp_array[cpt] = (*(sl_ar.get_ref_mem_array()))[ind]; ind= sl.next_ind(); cpt++; } memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),tmp_array.size()); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); } template valarray& valarray::operator= (const gslice_array& sl_ar) { gslice sl(sl_ar.get_slice()); valarray tmp_array(sl.ind_numb()); size_t ind = sl.next_ind(); size_t cpt = 0; while( !sl.is_reseted() ) { tmp_array[cpt] = (*(sl_ar.get_ref_mem_array()))[ind]; ind= sl.next_ind(); cpt++; } if ( &memory_array == sl_ar.get_ref_mem_array() ) memory_array._RW_resize_without_copy(0); memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),tmp_array.size()); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return *this; } // operator[] for valarray[valarray] used with mask_array template valarray valarray::operator[](const valarray& array) const { size_t iter,size =0; for(iter=0; iter < array.size(); iter++ ) if ( array[iter] ) size++; valarray tmp_array(size); size_t cpt = 0; for( iter=0; iter < array.size(); iter++ ) if ( array[iter] ) tmp_array[cpt++] = memory_array[iter]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = size; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } // copy ctor and assignment for mask_array template valarray::valarray(const mask_array& mask) { mask_array *msk = (mask_array *)&mask; valarray* sec = msk->get_array_pt(); size_t iter,size =0; for(iter=0; iter < sec->size(); iter++ ) if ( (*sec)[iter] ) size++; valarray tmp_array(size); size_t cpt = 0; for( iter=0; iter < sec->size(); iter++ ) if ( (*sec)[iter] ) tmp_array[cpt++] = (*(mask.get_ref_mem_array()))[iter]; memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),size); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); } template valarray& valarray::operator= (const mask_array& mask) { mask_array *msk = (mask_array *)&mask; valarray* sec = msk->get_array_pt(); size_t iter,size =0; for(iter=0; iter < sec->size(); iter++ ) if ( (*sec)[iter] ) size++; valarray tmp_array(size); size_t cpt = 0; for( iter=0; iter < sec->size(); iter++ ) if ( (*sec)[iter] ) tmp_array[cpt++] = (*(mask.get_ref_mem_array()))[iter]; if ( &memory_array == mask.get_ref_mem_array() ) memory_array._RW_resize_without_copy(0); memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),size); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return *this; } // operator[] for valarray[valarray] used with indirect_array template valarray valarray::operator[](const valarray& array) const { valarray tmp_array(array.size()); for( size_t iter=0; iter < array.size(); iter++ ) tmp_array[iter] = memory_array[array[iter]]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = array.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } // copy ctor and assignment for indirect_array template valarray::valarray(const indirect_array& indir) { indirect_array *indr= (indirect_array *)&indir; valarray* sec = indr->get_array_pt(); valarray tmp_array(sec->size()); size_t cpt = 0; for(size_t iter=0; iter < sec->size(); iter++ ) tmp_array[cpt++] = (*(indir.get_ref_mem_array()))[(*sec)[iter]]; memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),sec->size()); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); } template valarray& valarray::operator= (const indirect_array& indir) { indirect_array *indr= (indirect_array *)&indir; valarray* sec = indr->get_array_pt(); valarray tmp_array(sec->size()); size_t cpt = 0; for(size_t iter=0; iter < sec->size(); iter++ ) tmp_array[cpt++] = (*(indir.get_ref_mem_array()))[(*sec)[iter]]; if ( &memory_array == indir.get_ref_mem_array() ) memory_array._RW_resize_without_copy(0); memory_array._replace(tmp_array._RW_get_memory_array()._RW_get_storage(),sec->size()); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return *this; } /* * * VALARRAY NON MEMBER FUNCTIONS * */ template valarray operator* (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]*b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator/ (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]/b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator% (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]%b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator+ (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]+b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator- (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]-b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator^ (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]^b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator& (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]&b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator| (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]|b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator<< (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]<)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator>> (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]>>b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator&& (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind] && b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator|| (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind] || b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } // with non array second parameter template valarray operator* (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]*b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator/ (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]/b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator% (const valarray& a,const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]%b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator+ (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]+b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator- (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]-b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator^ (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]^b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator& (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]&b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator| (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]|b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator<< (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]<)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator>> (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind]>>b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator&& (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind] && b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator|| (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a[ind] || b; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } // with non array first parameter template valarray operator* (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a*b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator/ (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a/b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator% (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a%b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator+ (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a+b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator- (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a-b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator^ (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a^b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator& (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a&b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator| (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a|b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator<< (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a<)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator>> (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a>>b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator&& (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a && b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator|| (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = a || b[ind]; _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } // comparison operators template valarray operator== (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind]==b[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator!= (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind]!=b[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator< (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind])* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator> (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind]>b[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator<= (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind]<=b[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator>= (const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind]>=b[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } // comparison operators, non valarray second param template valarray operator== (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind]==b); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator!= (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind]!=b); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator< (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind])* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator> (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind]>b); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator<= (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind]<=b); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator>= (const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a[ind]>=b); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } // comparison operators, non valarray first param template valarray operator== (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a==b[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator!= (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a!=b[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator< (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator> (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a>b[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator<= (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a<=b[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray operator>= (const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = (a>=b[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION // min and max functions template T valarray::min()const { T tmp; if ( size() > 0 ) { tmp = memory_array[0]; for(size_t ind=1; ind< size(); ind++) if ( memory_array[ind] < tmp ) tmp= memory_array[ind]; } return tmp; } template T valarray::max()const { T tmp; if ( size() > 0 ) { tmp = memory_array[0]; for(size_t ind=1; ind< size(); ind++) if ( memory_array[ind] > tmp ) tmp= memory_array[ind]; } return tmp; } #else template T min(const valarray& ar) { T tmp; if ( ar.size() > 0 ) { tmp = ar[0]; for(size_t ind=1; ind< ar.size(); ind++) if ( ar[ind] < tmp ) tmp= ar[ind]; } return tmp; } template T max(const valarray& ar) { T tmp; if ( ar.size() > 0 ) { tmp = ar[0]; for(size_t ind=1; ind< ar.size(); ind++) if ( ar[ind] > tmp ) tmp= ar[ind]; } return tmp; } #endif // transcendentals template valarray abs(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = abs(a[ind]); // note: abs need to be overloaded for // float, long double and long see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray acos(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = acos(a[ind]); // note: acos need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray asin(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = asin(a[ind]); // note: asin need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray atan(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = atan(a[ind]); // note: atan need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray cos(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = cos(a[ind]); // note: cos need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray cosh(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = cosh(a[ind]); // note: cosh need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray exp(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = exp(a[ind]); // note: exp need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray log(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = log(a[ind]); // note: log need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray log10(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = log10(a[ind]); // note: log10 need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray sinh(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = sinh(a[ind]); // note: sinh need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray sin(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = sin(a[ind]); // note: sin need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray sqrt(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = sqrt(a[ind]); _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray tan(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = tan(a[ind]); // note: tan need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray tanh(const valarray& a) { valarray tmp_array(a.size()); for(size_t ind=0; ind< a.size(); ind++ ) tmp_array[ind] = tanh(a[ind]); // note: tanh need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = a.size(); tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray atan2(const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = atan2(a[ind],b[ind]); // note: atan2 need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray atan2(const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = atan2(a[ind],b); // note: atan2 need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray atan2(const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = atan2(a,b[ind]); // note: atan2 need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray pow(const valarray& a, const valarray& b) { size_t length= ( a.size() > b.size() ) ? b.size() : a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = pow(a[ind],b[ind]); // note: pow need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray pow(const valarray& a, const T& b) { size_t length= a.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = pow(a[ind],b); // note: pow need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } template valarray pow(const T& a, const valarray& b) { size_t length= b.size(); valarray tmp_array(length); for(size_t ind=0; ind< length; ind++ ) tmp_array[ind] = pow(a,b[ind]); // note: pow need to be overloaded for // float, long double see (17.3.1.1) _RW_IMP_SPACE(_RW_temporary)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary); _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage(); _tmp_ret->length = length; tmp_array._RW_get_memory_array_adr()->_RW_invalidate(); return _tmp_ret; } /***************************************************************** * * * SLICE_ARRAY MEMBER FUNCTIONS * * * ******************************************************************/ // slice_array inline member functions template void slice_array::operator= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] = array[cpt]; ind+= slice_.stride(); cpt++; } } template void slice_array::operator= (const T& value) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( ind_get_length() ) (*ref_mem_array)[ind] = value; ind+= slice_.stride(); cpt++; } } // computed assignment template void slice_array::operator*= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] *= array[cpt]; ind+= slice_.stride(); cpt++; } } template void slice_array::operator/= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] /= array[cpt]; ind+= slice_.stride(); cpt++; } } template void slice_array::operator+= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] += array[cpt]; ind+= slice_.stride(); cpt++; } } template void slice_array::operator-= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] -= array[cpt]; ind+= slice_.stride(); cpt++; } } #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION template void slice_array::operator%= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] %= array[cpt]; ind+= slice_.stride(); cpt++; } } template void slice_array::operator^= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] ^= array[cpt]; ind+= slice_.stride(); cpt++; } } template void slice_array::operator&= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] &= array[cpt]; ind+= slice_.stride(); cpt++; } } template void slice_array::operator|= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] |= array[cpt]; ind+= slice_.stride(); cpt++; } } template void slice_array::operator<<= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] <<= array[cpt]; ind+= slice_.stride(); cpt++; } } template void slice_array::operator>>= (const valarray& array) const { size_t ind = slice_.start(); size_t cpt = 0; while( cpt < slice_.size() ) { if ( (cpt_get_length()) ) (*ref_mem_array)[ind] >>= array[cpt]; ind+= slice_.stride(); cpt++; } } #endif /***************************************************************** * * * GSLICE_ARRAY MEMBER FUNCTIONS * * * ******************************************************************/ // gslice_array inline member functions template void gslice_array::operator= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] = array[cpt]; ind= gsl->next_ind(); cpt++; } } template void gslice_array::operator= (const T& value) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); while( !gsl->is_reseted() ) { (*ref_mem_array)[ind] = value; ind= gsl->next_ind(); } } // computed assignment template void gslice_array::operator*= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] *= array[cpt]; ind= gsl->next_ind(); cpt++; } } template void gslice_array::operator/= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] /= array[cpt]; ind= gsl->next_ind(); cpt++; } } template void gslice_array::operator+= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] += array[cpt]; ind= gsl->next_ind(); cpt++; } } template void gslice_array::operator-= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] -= array[cpt]; ind= gsl->next_ind(); cpt++; } } #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION template void gslice_array::operator%= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] %= array[cpt]; ind= gsl->next_ind(); cpt++; } } template void gslice_array::operator^= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] ^= array[cpt]; ind= gsl->next_ind(); cpt++; } } template void gslice_array::operator&= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] &= array[cpt]; ind= gsl->next_ind(); cpt++; } } template void gslice_array::operator|= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] |= array[cpt]; ind= gsl->next_ind(); cpt++; } } template void gslice_array::operator<<= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] <<= array[cpt]; ind= gsl->next_ind(); cpt++; } } template void gslice_array::operator>>= (const valarray& array) const { gslice *gsl = (gslice *)&slice_; size_t ind = gsl->next_ind(); size_t cpt = 0; while( (!gsl->is_reseted()) && (cpt < array.size()) ) { (*ref_mem_array)[ind] >>= array[cpt]; ind= gsl->next_ind(); cpt++; } } #endif /***************************************************************** * * * MASK_ARRAY MEMBER FUNCTIONS * * * ******************************************************************/ // mask_array inline member functions template void mask_array::operator= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]= ar[cpt++]; } template void mask_array::operator= (const T& value) const { for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]= value; } template void mask_array::operator*= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter] *= ar[cpt++]; } template void mask_array::operator/= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]/= ar[cpt++]; } template void mask_array::operator+= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]+= ar[cpt++]; } template void mask_array::operator-= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]-= ar[cpt++]; } #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION template void mask_array::operator%= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]%= ar[cpt++]; } template void mask_array::operator^= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]^= ar[cpt++]; } template void mask_array::operator&= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]&= ar[cpt++]; } template void mask_array::operator|= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]|= ar[cpt++]; } template void mask_array::operator<<= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]<<= ar[cpt++]; } template void mask_array::operator>>= (const valarray& ar) const { size_t cpt = 0; for(size_t iter=0; iter < array.size(); iter++ ) if ( array[iter] ) (*ref_mem_array)[iter]>>= ar[cpt++]; } #endif /***************************************************************** * * * INDIRECT_ARRAY MEMBER FUNCTIONS * * * ******************************************************************/ // indirect_array inline member functions template void indirect_array::operator= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] = ar[cpt++]; } template void indirect_array::operator= (const T& value) const { for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] = value; } template void indirect_array::operator*= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] *= ar[cpt++]; } template void indirect_array::operator/= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] /= ar[cpt++]; } template void indirect_array::operator+= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] += ar[cpt++]; } template void indirect_array::operator-= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] -= ar[cpt++]; } #ifndef _RWSTD_NO_ONLY_NEEDED_INSTANTIATION template void indirect_array::operator%= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] %= ar[cpt++]; } template void indirect_array::operator^= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] ^= ar[cpt++]; } template void indirect_array::operator&= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] &= ar[cpt++]; } template void indirect_array::operator|= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] |= ar[cpt++]; } template void indirect_array::operator<<= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] <<= ar[cpt++]; } template void indirect_array::operator>>= (const valarray& ar) const { size_t cpt=0; for(size_t iter=0; iter < array.size(); iter++ ) (*ref_mem_array)[array[iter]] >>= ar[cpt++]; } #endif #ifndef _RWSTD_NO_NAMESPACE } #endif #pragma option pop #endif /* __VALARRAY_CC */