Changeset 1636 in Sophya
- Timestamp:
- Aug 13, 2001, 2:38:17 PM (24 years ago)
- Location:
- trunk/SophyaLib/TArray
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/basarr.cc
r1583 r1636 206 206 void BaseArray::SetMemoryMapping(short mm) 207 207 { 208 if (mm == SameMemoryMapping) return;209 if (mm == AutoMemoryMapping) mm = default_memory_mapping;210 if ( (mm != CMemoryMapping) && (mm != FortranMemoryMapping) ) return;211 short vt = (marowi_ == veceli_) ? ColumnVector : RowVector;208 if (mm == SameMemoryMapping) mm = GetMemoryMapping(); 209 else if (mm == AutoMemoryMapping) mm = default_memory_mapping; 210 if ( (mm != CMemoryMapping) && (mm != FortranMemoryMapping) ) mm = CMemoryMapping; 211 short vt = GetVectorType(); 212 212 if (mm == CMemoryMapping) { 213 213 marowi_ = 1; macoli_ = 0; … … 216 216 marowi_ = 0; macoli_ = 1; 217 217 } 218 if ( (ndim_ == 2) && ((size_[0] == 1) || (size_[1] == 1)) ) { 218 if ( (ndim_ == 2) && ((size_[0] == 1) || (size_[1] == 1)) 219 && (size_[0] != size_[1]) ) { 219 220 // Choix automatique Vecteur ligne ou colonne 220 221 if ( size_[macoli_] == 1) veceli_ = marowi_; 221 222 else veceli_ = macoli_; 222 223 } 223 else 224 else veceli_ = (vt == ColumnVector ) ? marowi_ : macoli_; 224 225 } 225 226 … … 562 563 } 563 564 offset_ = offset; 564 // Default for matrices : Memory organisation and Vector type565 if (default_memory_mapping == CMemoryMapping) {566 marowi_ = 1; macoli_ = 0;567 }568 else {569 marowi_ = 0; macoli_ = 1;570 }571 veceli_ = (default_vector_type == ColumnVector ) ? marowi_ : macoli_;572 565 // Update OK 573 566 ndim_ = ndim; 567 // Default for matrices : Memory organisation and Vector type 568 SetMemoryMapping(BaseArray::SameMemoryMapping); 574 569 return true; 575 570 } … … 614 609 sa_size_t plast = 0; 615 610 for(k=0; k<ndim; k++) plast += (siz[k]-1)*step[k]; 616 if (plast == minstep* totsize_) moystep_ = minstep;611 if (plast == minstep*(totsize_-1) ) moystep_ = minstep; 617 612 else moystep_ = 0; 618 613 minstep_ = minstep; 619 614 offset_ = offset; 620 // Default for matrices : Memory organisation and Vector type621 if (default_memory_mapping == CMemoryMapping) {622 marowi_ = 1; macoli_ = 0;623 }624 else {625 marowi_ = 0; macoli_ = 1;626 }627 veceli_ = (default_vector_type == ColumnVector ) ? marowi_ : macoli_;628 615 // Update OK 629 616 ndim_ = ndim; 617 // Default for matrices : Memory organisation and Vector type 618 SetMemoryMapping(BaseArray::SameMemoryMapping); 630 619 return true; 631 620 } -
trunk/SophyaLib/TArray/tarray.cc
r1558 r1636 87 87 string exmsg = "TArray<T>::TArray(int_4, sa_size_t *, NDataBlock<T> & ... )"; 88 88 if (!UpdateSizes(ndim, siz, step, offset, exmsg)) throw( ParmError(exmsg) ); 89 89 if (mNDBlock.Size() < ComputeTotalSize(ndim, siz, step, offset)) { 90 exmsg += " DataBlock.Size() < ComputeTotalSize(...) " ; 91 throw( ParmError(exmsg) ); 92 } 90 93 } 91 94
Note:
See TracChangeset
for help on using the changeset viewer.