Changeset 2917 in Sophya for trunk/SophyaLib/TArray/utilarr.cc
- Timestamp:
- Feb 23, 2006, 2:50:26 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/utilarr.cc
r2915 r2917 313 313 \class SOPHYA::Range 314 314 \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 321 323 */ 322 324 Range::Range(sa_size_t start) 323 325 { 324 326 start_ = start; 325 end_ = Range::lastIndex();326 size_ = 0;327 end_ = start; 328 size_ = 1; 327 329 step_ = 1; 328 330 } … … 375 377 if (size > 0) { // Nb d'elements fixe 376 378 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_; 379 381 } 380 382 else { … … 406 408 void Range::Update(sa_size_t osz) 407 409 { 408 if (end_ >= 0) return; 410 if (end_ >= 0) return; 409 411 if (osz == 0) { 410 412 start_ = end_ = 0; … … 415 417 end_ = osz-1; 416 418 if ((size_ > 0) && (size_ <= osz/step_)) 417 start_ = end_ - size_*step_;419 start_ = end_ - (size_-1)*step_; 418 420 else { 419 421 start_ = end_; … … 425 427 size_ = (end_-start_)/step_+1; 426 428 } 429 //DBG cout << ">>> DBG/Update start=" << start_ << " end=" << end_ 430 //DBG << " size=" << size_ << " step=" << step_ << endl; 427 431 return; 428 432 } … … 443 447 \class SOPHYA::IdentityMatrix 444 448 \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 449 454 IdentityMatrix::IdentityMatrix(double diag, sa_size_t n) 450 455 {
Note:
See TracChangeset
for help on using the changeset viewer.