Changeset 2917 in Sophya for trunk/SophyaLib/TArray/basarr.cc
- Timestamp:
- Feb 23, 2006, 2:50:26 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/basarr.cc
r2788 r2917 360 360 } 361 361 362 //! C hange dimension if some size == 1362 //! Compact arrays - supresses size=1 axes. 363 363 void BaseArray::CompactAllDim() 364 364 { … … 383 383 } 384 384 385 //! C hange dimension if some trailed size == 1385 //! Compact array taling dimensions, for size=1 traling axes. 386 386 void BaseArray::CompactTrailingDim() 387 387 { … … 391 391 sa_size_t step[BASEARRAY_MAXNDIMS]; 392 392 for(int_4 k=0; k<ndim_; k++) { 393 size[ ndim] = size_[k];394 step[ ndim] = step_[k];395 if (size_[k] > 1) ndim=k ;393 size[k] = size_[k]; 394 step[k] = step_[k]; 395 if (size_[k] > 1) ndim=k+1; 396 396 } 397 397 if (ndim == 0) ndim = 1; … … 714 714 715 715 716 //! Update sizes and information relative to array \b a 717 /*! 718 \param a : array to be compare with 719 \param ndim : could be change (but should be less than the ndim of the current class) 720 \param siz[ndim],pos[ndim],step[ndim] : could be changed but must be 721 compatible within the memory size with those of the current class. 722 \return true if all OK, false if problems appear 723 \return string \b exmsg for explanation in case of problems 716 //! Update sizes information for sub-array \b ra 717 /*! 718 \param ra : sub-array for which size information has to be computed 719 \param ndim : number of dimensions for \b ra 720 \param siz[ndim],pos[ndim],step[ndim] : number of elements, offset and step along each dimension, 721 relative to the original array. 722 \warning throw SzMismatchError in case of incompatible dimensions. 724 723 */ 725 724 void BaseArray::UpdateSubArraySizes(BaseArray & ra, int_4 ndim, sa_size_t * siz, sa_size_t * pos, sa_size_t * step) const … … 729 728 int_4 k; 730 729 for(k=0; k<ndim; k++) 731 if ( ( siz[k]*step[k]+pos[k]) >size_[k] )730 if ( ((siz[k]-1)*step[k]+pos[k]) >= size_[k] ) 732 731 throw(SzMismatchError("BaseArray::UpdateSubArraySizes( ... ) Size/Pos Error") ); 733 732 sa_size_t offset = offset_;
Note:
See TracChangeset
for help on using the changeset viewer.