Changeset 1099 in Sophya
- Timestamp:
- Jul 26, 2000, 6:29:46 PM (25 years ago)
- Location:
- trunk/SophyaLib/TArray
- Files:
-
- 8 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_; -
trunk/SophyaLib/TArray/basarr.h
r1081 r1099 62 62 63 63 // Returns true if ndim and sizes are equal 64 virtual bool CompareSizes(const BaseArray& a );64 virtual bool CompareSizes(const BaseArray& a, bool& smo); 65 65 66 66 // Compacts \b size=1 array dimensions … … 83 83 inline uint_4 Size(int ka) const { return(size_[CheckDI(ka,1)]); } 84 84 85 uint_4MaxSizeKA() const ;85 int MaxSizeKA() const ; 86 86 87 87 //! Get memory organization 88 inline short GetMemoryMapping() const88 inline short GetMemoryMapping() const 89 89 { return ( (marowi_ == 1) ? CMemoryMapping : FortranMemoryMapping) ; } 90 90 //! line index dimension 91 inline uint_4RowsKA() const {return marowi_; }91 inline int RowsKA() const {return marowi_; } 92 92 //! column index dimension 93 inline uint_4ColsKA() const {return macoli_; }93 inline int ColsKA() const {return macoli_; } 94 94 //! Index dimension of the elements of a vector 95 inline uint_4VectKA() const {return veceli_; }95 inline int VectKA() const {return veceli_; } 96 96 void SetMemoryMapping(short mm=AutoMemoryMapping); 97 97 … … 126 126 inline uint_4 Step(int ka) const { return(step_[CheckDI(ka,3)]); } 127 127 128 uint_4MinStepKA() const ;128 int MinStepKA() const ; 129 129 130 130 // Offset of element ip … … 137 137 virtual MuTyV & ValueAtPosition(uint_8 ip) const = 0; 138 138 139 // Impression, I/O, ... 139 // Pour recuperer pas et numero d'axe pour operations sur deux arrays 140 void GetOpeParams(const BaseArray& a, bool smo, int& ax, int& axa, uint_8& step, 141 uint_8& stepa, uint_8& gpas, uint_8& naxa); 142 // Impression, I/O, ... 140 143 void Show(ostream& os, bool si=false) const; 141 144 //! Show information on \b cout … … 166 169 uint_4 size_[BASEARRAY_MAXNDIMS]; //!< array of the size in each dimension 167 170 uint_8 totsize_; //!< Total number of elements 171 uint_8 offset_; //!< global offset -\> position of elem[0] in DataBlock 168 172 //! two consecutive elements distance in a given dimension 169 173 uint_4 step_[BASEARRAY_MAXNDIMS]; 170 174 uint_4 minstep_; //!< minimal step (in any axes) 171 175 uint_4 moystep_; //!< mean step, if == 0 --\> non regular steps 172 uint_8 offset_; //!< global offset -\> position of elem[0] in DataBlock 173 uint_4 marowi_; //!< For matrices, Row index in dimensions 174 uint_4 macoli_; //!< For matrices, Column index in dimensions 175 uint_4 veceli_; //!< For vectors, dimension index = marowi_/macoli_ (Row/Col vectors) 176 bool ck_memo_vt_; //!< if true, check MemoryOrg./VectorType for CompareSize 176 int_2 marowi_; //!< For matrices, Row index in dimensions 177 int_2 macoli_; //!< For matrices, Column index in dimensions 178 int_2 veceli_; //!< For vectors, dimension index = marowi_/macoli_ (Row/Col vectors) 179 int_2 arrtype_; //!< 0 a TArray, 1 TMatrix , 2 TVector 177 180 DVList* mInfo; //!< Infos (variables) attached to the array 178 181 -
trunk/SophyaLib/TArray/matharr.cc
r1013 r1099 148 148 mean /= dsz; 149 149 sig = sig/dsz - mean*mean; 150 // #if !defined(OS_LINUX) && !defined (__KCC__)151 150 #if !defined(__GNUG__) && !defined (__MWERKS__) 152 151 if (sig >= 0.) sig = sqrt(sig); -
trunk/SophyaLib/TArray/tarray.cc
r1085 r1099 223 223 void TArray<T>::ReSize(uint_4 ndim, uint_4 * siz, uint_4 step) 224 224 { 225 if (arrtype_ != 0) { 226 if (ndim != 2) 227 throw( ParmError("TArray<T>::ReSize(ndim!=2,...) for Matrix" ) ); 228 if ((arrtype_ == 2) && (siz[0] > 1) && (siz[1] > 1)) 229 throw( ParmError("TArray<T>::ReSize(,siz[0]>1 && size[1]>1) for Vector" ) ); 230 } 225 231 string exmsg = "TArray<T>::ReSize()"; 226 232 if (!UpdateSizes(ndim, siz, step, 0, exmsg)) throw( ParmError(exmsg) ); … … 239 245 void TArray<T>::Realloc(uint_4 ndim, uint_4 * siz, uint_4 step, bool force) 240 246 { 247 if (arrtype_ != 0) { 248 if (ndim != 2) 249 throw( ParmError("TArray<T>::Realloc(ndim!=2,...) for Matrix" ) ); 250 if ((arrtype_ == 2) && (siz[0] > 1) && (siz[1] > 1)) 251 throw( ParmError("TArray<T>::Realloc(,siz[0]>1 && size[1]>1) for Vector" ) ); 252 } 241 253 string exmsg = "TArray<T>::Realloc()"; 242 254 if (!UpdateSizes(ndim, siz, step, 0, exmsg)) throw( ParmError(exmsg) ); … … 545 557 if (NbDimensions() < 1) 546 558 throw RangeCheckError("TArray<T>::AddElt(const TArray<T>& ) - Not Allocated Array ! "); 547 if (!CompareSizes(a)) 559 bool smo; 560 if (!CompareSizes(a, smo)) 548 561 throw(SzMismatchError("TArray<T>::AddElt(const TArray<T>&) SizeMismatch")) ; 549 562 … … 551 564 const T * pea; 552 565 uint_8 j,k,ka; 553 if ( (AvgStep() > 0) && (a.AvgStep() > 0)) { // regularly spaced elements566 if (smo && (AvgStep() > 0) && (a.AvgStep() > 0)) { // regularly spaced elements 554 567 uint_8 step = AvgStep(); 555 568 uint_8 stepa = a.AvgStep(); … … 560 573 } 561 574 else { // Non regular data spacing ... 562 uint_4 ax = MaxSizeKA(); 563 uint_8 step = Step(ax); 564 uint_8 stepa = a.Step(ax); 565 uint_8 gpas = Size(ax)*step; 566 uint_8 naxa = Size()/Size(ax); 575 int ax,axa; 576 uint_8 step, stepa; 577 uint_8 gpas, naxa; 578 GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa); 567 579 for(j=0; j<naxa; j++) { 568 580 pe = mNDBlock.Begin()+Offset(ax,j); 569 pea = a.DataBlock().Begin()+a.Offset(ax ,j);581 pea = a.DataBlock().Begin()+a.Offset(axa,j); 570 582 for(k=0, ka=0; k<gpas; k+=step, ka+=stepa) pe[k] += pea[ka]; 571 583 } … … 584 596 if (NbDimensions() < 1) 585 597 throw RangeCheckError("TArray<T>::SubElt(const TArray<T>& ) - Not Allocated Array ! "); 586 if (!CompareSizes(a)) 598 bool smo; 599 if (!CompareSizes(a, smo)) 587 600 throw(SzMismatchError("TArray<T>::SubElt(const TArray<T>&) SizeMismatch")) ; 588 601 … … 590 603 const T * pea; 591 604 uint_8 j,k,ka; 592 if ( (AvgStep() > 0) && (a.AvgStep() > 0) ) { // regularly spaced elements605 if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) ) { // regularly spaced elements 593 606 uint_8 step = AvgStep(); 594 607 uint_8 stepa = a.AvgStep(); … … 602 615 } 603 616 else { // Non regular data spacing ... 604 uint_4 ax = MaxSizeKA(); 605 uint_8 step = Step(ax); 606 uint_8 stepa = a.Step(ax); 607 uint_8 gpas = Size(ax)*step; 608 uint_8 naxa = Size()/Size(ax); 617 int ax,axa; 618 uint_8 step, stepa; 619 uint_8 gpas, naxa; 620 GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa); 609 621 for(j=0; j<naxa; j++) { 610 622 pe = mNDBlock.Begin()+Offset(ax,j); 611 pea = a.DataBlock().Begin()+a.Offset(ax ,j);623 pea = a.DataBlock().Begin()+a.Offset(axa,j); 612 624 if (fginv) 613 625 for(k=0, ka=0; k<gpas; k+=step, ka+=stepa) pe[k] = pea[ka]-pe[k] ; … … 626 638 if (NbDimensions() < 1) 627 639 throw RangeCheckError("TArray<T>::MulElt(const TArray<T>& ) - Not Allocated Array ! "); 628 if (!CompareSizes(a)) 640 bool smo; 641 if (!CompareSizes(a, smo)) 629 642 throw(SzMismatchError("TArray<T>::MulElt(const TArray<T>&) SizeMismatch")) ; 630 643 … … 632 645 const T * pea; 633 646 uint_8 j,k,ka; 634 if ( (AvgStep() > 0) && (a.AvgStep() > 0) ) { // regularly spaced elements647 if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) ) { // regularly spaced elements 635 648 uint_8 step = AvgStep(); 636 649 uint_8 stepa = a.AvgStep(); … … 641 654 } 642 655 else { // Non regular data spacing ... 643 uint_4 ax = MaxSizeKA(); 644 uint_8 step = Step(ax); 645 uint_8 stepa = a.Step(ax); 646 uint_8 gpas = Size(ax)*step; 647 uint_8 naxa = Size()/Size(ax); 648 for(j=0; j<naxa; j++) { 649 pe = mNDBlock.Begin()+Offset(ax,j); 650 pea = a.DataBlock().Begin()+a.Offset(ax,j); 656 int ax,axa; 657 uint_8 step, stepa; 658 uint_8 gpas, naxa; 659 GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa); 660 for(j=0; j<naxa; j++) { 661 pe = mNDBlock.Begin()+Offset(axa,j); 662 pea = a.DataBlock().Begin()+a.Offset(axa,j); 651 663 for(k=0, ka=0; k<gpas; k+=step, ka+=stepa) pe[k] *= pea[ka]; 652 664 } … … 667 679 if (NbDimensions() < 1) 668 680 throw RangeCheckError("TArray<T>::DivElt(const TArray<T>& ) - Not Allocated Array ! "); 669 if (!CompareSizes(a)) 681 bool smo; 682 if (!CompareSizes(a, smo)) 670 683 throw(SzMismatchError("TArray<T>::DivElt(const TArray<T>&) SizeMismatch")) ; 671 684 … … 673 686 const T * pea; 674 687 uint_8 j,k,ka; 675 if ( (AvgStep() > 0) && (a.AvgStep() > 0) ) { // regularly spaced elements688 if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) ) { // regularly spaced elements 676 689 uint_8 step = AvgStep(); 677 690 uint_8 stepa = a.AvgStep(); … … 694 707 } 695 708 else { // Non regular data spacing ... 696 uint_4 ax = MaxSizeKA(); 697 uint_8 step = Step(ax); 698 uint_8 stepa = a.Step(ax); 699 uint_8 gpas = Size(ax)*step; 700 uint_8 naxa = Size()/Size(ax); 709 int ax,axa; 710 uint_8 step, stepa; 711 uint_8 gpas, naxa; 712 GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa); 701 713 for(j=0; j<naxa; j++) { 702 714 pe = mNDBlock.Begin()+Offset(ax,j); 703 pea = a.DataBlock().Begin()+a.Offset(ax ,j);715 pea = a.DataBlock().Begin()+a.Offset(axa,j); 704 716 if(divzero) { 705 717 if (fginv) … … 726 738 if (NbDimensions() < 1) 727 739 throw RangeCheckError("TArray<T>::CopyElt(const TArray<T>& ) - Not Allocated Array ! "); 728 if (!CompareSizes(a)) 740 bool smo; 741 if (!CompareSizes(a, smo)) 729 742 throw(SzMismatchError("TArray<T>::CopyElt(const TArray<T>&) SizeMismatch")) ; 730 743 … … 732 745 const T * pea; 733 746 uint_8 j,k,ka; 734 if ( (AvgStep() > 0) && (a.AvgStep() > 0) ) { // regularly spaced elements747 if (smo && (AvgStep() > 0) && (a.AvgStep() > 0) ) { // regularly spaced elements 735 748 uint_8 step = AvgStep(); 736 749 uint_8 stepa = a.AvgStep(); … … 741 754 } 742 755 else { // Non regular data spacing ... 743 uint_4 ax = MaxSizeKA(); 744 uint_8 step = Step(ax); 745 uint_8 stepa = a.Step(ax); 746 uint_8 gpas = Size(ax)*step; 747 uint_8 naxa = Size()/Size(ax); 756 int ax,axa; 757 uint_8 step, stepa; 758 uint_8 gpas, naxa; 759 GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa); 748 760 for(j=0; j<naxa; j++) { 749 761 pe = mNDBlock.Begin()+Offset(ax,j); 750 pea = a.DataBlock().Begin()+a.Offset(ax ,j);762 pea = a.DataBlock().Begin()+a.Offset(axa,j); 751 763 for(k=0, ka=0; k<gpas; k+=step, ka+=stepa) pe[k] = pea[ka]; 752 764 } … … 761 773 if (NbDimensions() < 1) 762 774 throw RangeCheckError("TArray<T>::ConvertAndCopyElt(const TArray<T>& ) - Not Allocated Array ! "); 763 if (!CompareSizes(a)) 775 bool smo; 776 if (!CompareSizes(a, smo)) 764 777 throw(SzMismatchError("TArray<T>::ConvertAndCopyElt(const TArray<T>&) SizeMismatch")) ; 765 778 … … 768 781 uint_8 offa; 769 782 // Non regular data spacing ... 770 uint_4 ax = MaxSizeKA(); 771 uint_8 step = Step(ax); 772 uint_8 stepa = a.Step(ax); 773 uint_8 gpas = Size(ax)*step; 774 uint_8 naxa = Size()/Size(ax); 783 int ax,axa; 784 uint_8 step, stepa; 785 uint_8 gpas, naxa; 786 GetOpeParams(a, smo, ax, axa, step, stepa, gpas, naxa); 775 787 for(j=0; j<naxa; j++) { 776 788 pe = mNDBlock.Begin()+Offset(ax,j); 777 offa = a.Offset(ax ,j);789 offa = a.Offset(axa,j); 778 790 #if !defined(__GNUG__) 779 791 for(k=0, ka=0; k<gpas; k+=step, ka+=stepa) pe[k] = (T)a.ValueAtPosition(offa+ka); -
trunk/SophyaLib/TArray/tmatrix.cc
r1081 r1099 1 // $Id: tmatrix.cc,v 1.1 3 2000-07-24 12:51:27ansari Exp $1 // $Id: tmatrix.cc,v 1.14 2000-07-26 16:29:45 ansari Exp $ 2 2 // C.Magneville 04/99 3 3 #include "machdefs.h" … … 22 22 : TArray<T>() 23 23 { 24 ck_memo_vt_ = true;24 arrtype_ = 1; // Type = Matrix 25 25 } 26 26 … … 39 39 if ( (r == 0) || (c == 0) ) 40 40 throw ParmError("TMatrix<T>::TMatrix(uint_4 r,uint_4 c) NRows or NCols = 0"); 41 arrtype_ = 1; // Type = Matrix 41 42 ReSize(r, c, mm); 42 43 } … … 52 53 : TArray<T>(a) 53 54 { 55 arrtype_ = 1; // Type = Matrix 54 56 } 55 57 … … 63 65 : TArray<T>(a, share) 64 66 { 67 arrtype_ = 1; // Type = Matrix 65 68 } 66 69 … … 77 80 ndim_ = 2; 78 81 } 82 arrtype_ = 1; // Type = Matrix 79 83 UpdateMemoryMapping(a, SameMemoryMapping); 80 84 } … … 97 101 ndim_ = 2; 98 102 } 103 arrtype_ = 1; // Type = Matrix 99 104 UpdateMemoryMapping(a, mm); 100 105 } 101 106 107 //! Constructor of a matrix from a TArray \b a , with a different data type 102 108 template <class T> 103 109 TMatrix<T>::TMatrix(const BaseArray& a) 104 110 : TArray<T>() 105 111 { 112 arrtype_ = 1; // Type = Matrix 106 113 SetBA(a); 107 114 } … … 125 132 if (a.NbDimensions() > 2) 126 133 throw SzMismatchError("TMatrix<T>::Set(const TArray<T>& a) a.NbDimensions() > 2"); 134 if ((arrtype_ == 2) && (a.NbDimensions() > 1) && (a.Size(0) > 1) && (a.Size(1) > 1) ) 135 throw SzMismatchError("TMatrix<T>::Set(const TArray<T>& a) Size(0,1)>1 for Vector"); 127 136 TArray<T>::Set(a); 128 137 if (NbDimensions() == 1) { … … 140 149 if (a.NbDimensions() > 2) 141 150 throw SzMismatchError("TMatrix<T>::SetBA(const BaseArray& a) a.NbDimensions() > 2"); 151 if ((arrtype_ == 2) && (a.NbDimensions() > 1) && (a.Size(0) > 1) && (a.Size(1) > 1) ) 152 throw SzMismatchError("TMatrix<T>::Set(const TArray<T>& a) Size(0,1)>1 for Vector"); 142 153 TArray<T>::SetBA(a); 143 154 if (NbDimensions() == 1) { … … 165 176 if(r==0||c==0) 166 177 throw(SzMismatchError("TMatrix::ReSize r or c==0 ")); 178 if ((arrtype_ == 2) && (r > 1) && (c > 1)) 179 throw(SzMismatchError("TMatrix::ReSize r>1&&c>1 for Vector ")); 167 180 uint_4 size[BASEARRAY_MAXNDIMS]; 168 181 for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++) size[kk] = 0; … … 194 207 if(r==0||c==0) 195 208 throw(SzMismatchError("TMatrix::Realloc r or c==0 ")); 209 if ((arrtype_ == 2) && (r > 1) && (c > 1)) 210 throw(SzMismatchError("TMatrix::Realloc r>1&&c>1 for Vector ")); 196 211 uint_4 size[BASEARRAY_MAXNDIMS]; 197 212 for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++) size[kk] = 0; -
trunk/SophyaLib/TArray/tmatrix.h
r1081 r1099 31 31 inline TMatrix<T>& operator = (const TMatrix<T>& a) 32 32 { Set(a); return(*this); } 33 //! Operator = between a matrix and an array 34 inline TMatrix<T>& operator = (const TArray<T>& a) 35 { Set(a); return(*this); } 33 36 34 37 virtual TArray<T>& SetBA(const BaseArray& a); 38 //! Operator = between matrices with different types 35 39 inline TMatrix<T>& operator = (const BaseArray& a) 36 40 { SetBA(a); return(*this); } -
trunk/SophyaLib/TArray/tvector.cc
r976 r1099 1 // $Id: tvector.cc,v 1. 8 2000-04-27 17:53:52ansari Exp $1 // $Id: tvector.cc,v 1.9 2000-07-26 16:29:46 ansari Exp $ 2 2 // C.Magneville 04/99 3 3 #include "machdefs.h" … … 35 35 : TMatrix<T>(1,1,mm) 36 36 { 37 arrtype_ = 2; // Type = Vector 37 38 lcv = SelectVectorType(lcv); 38 39 ReSize(n,lcv); … … 49 50 : TMatrix<T>(a) 50 51 { 52 arrtype_ = 2; // Type = Vector 51 53 } 52 54 … … 60 62 : TMatrix<T>(a, share) 61 63 { 64 arrtype_ = 2; // Type = Vector 62 65 } 63 66 … … 69 72 if ( (size_[0] != 1) && (size_[1] != 1) ) 70 73 throw SzMismatchError("TVector<T>::TVector(const TArray<T>& a) NRows()!=1 && NCols()!=1 "); 74 arrtype_ = 2; // Type = Vector 71 75 } 72 76 … … 86 90 if ( (size_[0] != 1) && (size_[1] != 1) ) 87 91 throw SzMismatchError("TVector<T>::TVector(const TArray<T>& a) NRows()!=1 && NCols()!=1 "); 92 arrtype_ = 2; // Type = Vector 88 93 if ( (size_[0] == 1) && (size_[1] == 1) ) { 89 94 if (lcv == SameVectorType) lcv = a.GetVectorType(); … … 91 96 veceli_ = (lcv == ColumnVector ) ? marowi_ : macoli_; 92 97 } 98 } 99 100 //! Constructor of a vector from a TArray \b a , with a different data type 101 template <class T> 102 TVector<T>::TVector(const BaseArray& a) 103 : TMatrix<T>() 104 { 105 arrtype_ = 2; // Type = Vector 106 SetBA(a); 93 107 } 94 108 -
trunk/SophyaLib/TArray/tvector.h
r976 r1099 19 19 TVector(const TArray<T>& a); 20 20 TVector(const TArray<T>& a, bool share, short lcv=AutoVectorType, short mm=AutoMemoryMapping); 21 TVector(const BaseArray& a); 21 22 22 23 virtual ~TVector(); … … 27 28 inline TVector<T>& operator = (const TVector<T>& a) 28 29 { Set(a); return(*this); } 29 30 //! Operator = between a vector and a matrix 31 inline TVector<T>& operator = (const TMatrix<T>& a) 32 { Set(a); return(*this); } 33 //! Operator = between a vector and an array 34 inline TVector<T>& operator = (const TArray<T>& a) 35 { Set(a); return(*this); } 36 //! Operator = between Vectors with different types 37 inline TVector<T>& operator = (const BaseArray& a) 38 { SetBA(a); return(*this); } 39 30 40 // Gestion taille/Remplissage 31 41 void ReSize(uint_4 n, short lcv=SameVectorType );
Note:
See TracChangeset
for help on using the changeset viewer.