Changeset 2917 in Sophya for trunk/SophyaLib/TArray/utilarr.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/utilarr.cc

    r2915 r2917  
    313313  \class SOPHYA::Range
    314314  \ingroup TArray
    315   Class to define a range of indices, to be used with TArra<T> TMatrix<T> TVector<T> ...
    316 */
    317 
    318 /*!
    319   Constructor defining defining the range of indices, starting from \b start to the last.
    320   \param start : start index (inclusive)
     315  This class can be used to define a range of indices. Range objects are used to extract
     316  sub-arrays and slices, from arrays and matrices.
     317  \sa SOPHYA::TArray SOPHYA::TMatrix
     318*/
     319
     320/*!
     321  Constructor defining a range corresponding to the single index \b start
     322  \param start : start=end index
    321323*/
    322324Range::Range(sa_size_t start)
    323325{
    324326  start_ = start;
    325   end_ = Range::lastIndex();
    326   size_ = 0;
     327  end_ = start;
     328  size_ = 1;
    327329  step_ = 1;
    328330}
     
    375377  if (size > 0) {  // Nb d'elements fixe
    376378    size_ = size;
    377     if (end == Range::lastIndex()) start_ = end_ = end;
    378     else end_ = start_+size_*step_;   
     379    if ( (start == end) && (end == Range::lastIndex()) ) start_ = end_ = end;
     380    else end_ = start_+(size_-1)*step_;   
    379381  }
    380382  else {
     
    406408void Range::Update(sa_size_t osz)
    407409{
    408   if (end_ >= 0)  return;
     410  if (end_ >= 0)  return; 
    409411  if (osz == 0) {
    410412    start_ = end_ = 0;
     
    415417    end_ = osz-1;
    416418    if ((size_ > 0) && (size_ <= osz/step_))
    417       start_ = end_ - size_*step_;
     419      start_ = end_ - (size_-1)*step_;
    418420    else {
    419421      start_ = end_;
     
    425427    size_ = (end_-start_)/step_+1;
    426428  }
     429  //DBG  cout << ">>> DBG/Update start=" << start_ << " end=" << end_
     430  //DBG     << " size=" << size_ << " step=" << step_ << endl;
    427431  return;
    428432}
     
    443447  \class SOPHYA::IdentityMatrix
    444448  \ingroup TArray
    445   Class to define an identity matrix
    446 */
    447 
    448 //! Constructor of a (n,n) diagonal matrix with value diag on the diagonal
     449  Class to define an identity matrix. This class is mainly intented for
     450  initializing TMatrix<T> objects, proportional to the identity matrix.
     451*/
     452
     453//! Constructor representing a square matrix (\b n x \b n) with value \b diag on the diagonal
    449454IdentityMatrix::IdentityMatrix(double diag, sa_size_t n)
    450455{
Note: See TracChangeset for help on using the changeset viewer.