Changeset 1099 in Sophya for trunk/SophyaLib/TArray/tmatrix.cc
- Timestamp:
- Jul 26, 2000, 6:29:46 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.