Changeset 2917 in Sophya for trunk/SophyaLib/TArray/basarr.cc


Ignore:
Timestamp:
Feb 23, 2006, 2:50:26 PM (20 years ago)
Author:
ansari
Message:

Documentation + debug Range et extraction sous-tableaux , Reza 23/02/2006

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/TArray/basarr.cc

    r2788 r2917  
    360360}
    361361
    362 //! Change dimension if some size == 1
     362//! Compact arrays - supresses size=1 axes.
    363363void BaseArray::CompactAllDim()
    364364{
     
    383383}
    384384
    385 //! Change dimension if some trailed size == 1
     385//! Compact array taling dimensions, for size=1 traling axes.
    386386void BaseArray::CompactTrailingDim()
    387387{
     
    391391  sa_size_t step[BASEARRAY_MAXNDIMS];
    392392  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;
    396396  }
    397397  if (ndim == 0)  ndim = 1;
     
    714714
    715715
    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.
    724723 */
    725724void BaseArray::UpdateSubArraySizes(BaseArray & ra, int_4 ndim, sa_size_t * siz, sa_size_t * pos, sa_size_t * step) const
     
    729728  int_4 k;
    730729  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] ) 
    732731      throw(SzMismatchError("BaseArray::UpdateSubArraySizes( ... ) Size/Pos Error") );
    733732  sa_size_t offset = offset_;
Note: See TracChangeset for help on using the changeset viewer.