Changeset 1099 in Sophya for trunk/SophyaLib/TArray/basarr.cc
- Timestamp:
- Jul 26, 2000, 6:29:46 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/basarr.cc
r958 r1099 164 164 } 165 165 else veceli_ = (vt == ColumnVector ) ? marowi_ : macoli_; 166 ck_memo_vt_ = true; // Check MemMapping and VectorType for CompareSize167 166 } 168 167 … … 196 195 } 197 196 else veceli_ = (vt == ColumnVector ) ? marowi_ : macoli_; 198 ck_memo_vt_ = true; // Check MemMapping and VectorType for CompareSize199 197 } 200 198 … … 224 222 } 225 223 else veceli_ = (vt == ColumnVector ) ? marowi_ : macoli_; 226 ck_memo_vt_ = true; // Check MemMapping and VectorType for CompareSize227 224 } 228 225 … … 243 240 } 244 241 else veceli_ = (vt == ColumnVector ) ? marowi_ : macoli_; 245 ck_memo_vt_ = true; // Check MemMapping and VectorType for CompareSize246 242 } 247 243 … … 268 264 } 269 265 veceli_ = (default_vector_type == ColumnVector ) ? marowi_ : macoli_; 270 ck_memo_vt_ = false; // Default : Don't Check MemMapping and VectorType for CompareSize 266 arrtype_ = 0; // Default Array type, not a Matrix or Vector 267 271 268 } 272 269 … … 277 274 278 275 279 //! Returns true if dimension and sizes are equal276 //! Returns true if the two arrays have compatible dimensions. 280 277 /*! 281 278 \param a : array to be compared 282 \return true if ndim and sizes[ndim] are equal, false if not 279 \param smo : Return flag = true if the two arrays have the same memory organisation 280 \return true if \c NbDimensions() and \c Size() are equal, false if not 281 282 If the array (on which the operation is being performed, \c this) 283 is a \b Matrix or a \b Vector, the matrix dimensions \c NRows() \c NCols() 284 are checked. The flag \c smo is returned true if the two arrays, viewed 285 as a matrix have the same memory organisation. 286 Otherwise, (if the array is of not a Matrix or a Vector) 287 the size compatibility viewed as a TArray is checked <tt> 288 (Size(k) == a.Size(k), k=0,...NbDimensions()), </tt> disregard of the memory 289 organisation and the row and column index. The flag \c smo is returned true 290 in this case. 283 291 */ 284 bool BaseArray::CompareSizes(const BaseArray& a )292 bool BaseArray::CompareSizes(const BaseArray& a, bool& smo) 285 293 { 286 294 if (ndim_ != a.ndim_) return(false); 287 for(uint_4 k=0; k<ndim_; k++) 288 if (size_[k] != a.size_[k]) return(false); 289 // $CHECK$ Reza doit-on verifier ca 290 if (ck_memo_vt_ && a.ck_memo_vt_) 291 if ( (macoli_ != a.macoli_) || (marowi_ != a.marowi_) || 292 (veceli_ != a.veceli_) ) return(false); 293 return(true); 295 if (arrtype_ == 0) { // Simple TArray, not a matrix 296 smo = true; 297 for(uint_4 k=0; k<ndim_; k++) 298 if (size_[k] != a.size_[k]) return(false); 299 return(true); 300 } 301 else { 302 smo = false; 303 if ( (size_[marowi_] != a.size_[marowi_]) || 304 (size_[macoli_] != a.size_[macoli_]) ) return(false); 305 if ( (macoli_ == a.macoli_) && (marowi_ == a.marowi_) || 306 (veceli_ == a.veceli_) ) smo = true; 307 return(true); 308 } 294 309 } 295 310 … … 336 351 337 352 //! return minimum value for step[ndim] 338 uint_4BaseArray::MinStepKA() const339 { 340 for( uint_4ka=0; ka<ndim_; ka++)353 int BaseArray::MinStepKA() const 354 { 355 for(int ka=0; ka<ndim_; ka++) 341 356 if (step_[ka] == minstep_) return(ka); 342 357 return(0); … … 344 359 345 360 //! return maximum value for step[ndim] 346 uint_4BaseArray::MaxSizeKA() const347 { 348 uint_4ka = 0;361 int BaseArray::MaxSizeKA() const 362 { 363 int ka = 0; 349 364 uint_4 mx = size_[0]; 350 for( uint_4k=0; k<ndim_; k++)351 if (size_[k] > mx) { ka = k; mx = size_[k]; }365 for(int k=0; k<ndim_; k++) 366 if (size_[k] > mx) { ka = k; mx = size_[k]; } 352 367 return(ka); 353 368 } … … 410 425 } 411 426 427 //! return various parameters for double loop operations on two arrays. 428 void BaseArray::GetOpeParams(const BaseArray& a, bool smo, int& ax, int& axa, uint_8& step, 429 uint_8& stepa, uint_8& gpas, uint_8& naxa) 430 { 431 if (smo) { // Same memory organisation 432 ax = axa = MaxSizeKA(); 433 } 434 else { 435 if (Size(RowsKA()) >= Size(ColsKA()) ) { 436 ax = RowsKA(); 437 axa = a.RowsKA(); 438 } 439 else { 440 ax = ColsKA(); 441 axa = a.ColsKA(); 442 } 443 } 444 step = Step(ax); 445 stepa = a.Step(axa); 446 gpas = Size(ax)*step; 447 naxa = Size()/Size(ax); 448 return; 449 } 412 450 413 451 // ---------------------------------------------------- … … 505 543 } 506 544 veceli_ = (default_vector_type == ColumnVector ) ? marowi_ : macoli_; 507 ck_memo_vt_ = false; // Default : Don't Check MemMapping and VectorType for CompareSize508 545 // Update OK 509 546 ndim_ = ndim; … … 562 599 } 563 600 veceli_ = (default_vector_type == ColumnVector ) ? marowi_ : macoli_; 564 ck_memo_vt_ = false; // Default : Don't Check MemMapping and VectorType for CompareSize565 601 // Update OK 566 602 ndim_ = ndim; … … 609 645 marowi_ = a.marowi_; 610 646 veceli_ = a.veceli_; 611 ck_memo_vt_ = a.ck_memo_vt_;612 647 // Update OK 613 648 ndim_ = a.ndim_;
Note:
See TracChangeset
for help on using the changeset viewer.