Changeset 1156 in Sophya for trunk/SophyaLib/TArray/tmatrix.cc
- Timestamp:
- Aug 29, 2000, 6:10:32 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/tmatrix.cc
r1103 r1156 1 // $Id: tmatrix.cc,v 1.1 5 2000-07-27 00:00:09ansari Exp $1 // $Id: tmatrix.cc,v 1.16 2000-08-29 16:10:30 ansari Exp $ 2 2 // C.Magneville 04/99 3 3 #include "machdefs.h" … … 33 33 */ 34 34 template <class T> 35 TMatrix<T>::TMatrix( uint_4 r,uint_4c, short mm)35 TMatrix<T>::TMatrix(sa_size_t r,sa_size_t c, short mm) 36 36 // Construit une matrice de r lignes et c colonnes. 37 37 : TArray<T>() 38 38 { 39 39 if ( (r == 0) || (c == 0) ) 40 throw ParmError("TMatrix<T>::TMatrix( uint_4 r,uint_4c) NRows or NCols = 0");40 throw ParmError("TMatrix<T>::TMatrix(sa_size_t r,sa_size_t c) NRows or NCols = 0"); 41 41 arrtype_ = 1; // Type = Matrix 42 42 ReSize(r, c, mm); … … 175 175 */ 176 176 template <class T> 177 void TMatrix<T>::ReSize( uint_4 r, uint_4c, short mm)177 void TMatrix<T>::ReSize(sa_size_t r, sa_size_t c, short mm) 178 178 { 179 179 if(r==0||c==0) … … 181 181 if ((arrtype_ == 2) && (r > 1) && (c > 1)) 182 182 throw(SzMismatchError("TMatrix::ReSize r>1&&c>1 for Vector ")); 183 uint_4size[BASEARRAY_MAXNDIMS];184 for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++) size[kk] = 0;183 sa_size_t size[BASEARRAY_MAXNDIMS]; 184 for(int_4 kk=0; kk<BASEARRAY_MAXNDIMS; kk++) size[kk] = 0; 185 185 if (mm == SameMemoryMapping) mm = GetMemoryMapping(); 186 186 else if ( (mm != CMemoryMapping) && (mm != FortranMemoryMapping) ) … … 206 206 */ 207 207 template <class T> 208 void TMatrix<T>::Realloc( uint_4 r,uint_4c, short mm, bool force)208 void TMatrix<T>::Realloc(sa_size_t r,sa_size_t c, short mm, bool force) 209 209 { 210 210 if(r==0||c==0) … … 212 212 if ((arrtype_ == 2) && (r > 1) && (c > 1)) 213 213 throw(SzMismatchError("TMatrix::Realloc r>1&&c>1 for Vector ")); 214 uint_4size[BASEARRAY_MAXNDIMS];215 for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++) size[kk] = 0;214 sa_size_t size[BASEARRAY_MAXNDIMS]; 215 for(int_4 kk=0; kk<BASEARRAY_MAXNDIMS; kk++) size[kk] = 0; 216 216 if (mm == SameMemoryMapping) mm = GetMemoryMapping(); 217 217 else if ( (mm != CMemoryMapping) && (mm != FortranMemoryMapping) ) … … 249 249 { 250 250 short vt = (marowi_ == veceli_) ? ColumnVector : RowVector; 251 uint_4 rci = macoli_;251 int_4 rci = macoli_; 252 252 macoli_ = marowi_; 253 253 marowi_ = rci; … … 268 268 if (mm == SameMemoryMapping) mm = GetMemoryMapping(); 269 269 TMatrix<T> tm(NCols(), NRows(), mm); 270 for( uint_4i=0; i<NRows(); i++)271 for( uint_4j=0; j<NCols(); j++)270 for(sa_size_t i=0; i<NRows(); i++) 271 for(sa_size_t j=0; j<NCols(); j++) 272 272 tm(j,i) = (*this)(i,j); 273 273 tm.SetTemp(true); … … 292 292 293 293 TMatrix<T> tm(NRows(), NCols(), mm); 294 for( uint_4i=0; i<NRows(); i++)295 for( uint_4j=0; j<NCols(); j++)294 for(sa_size_t i=0; i<NRows(); i++) 295 for(sa_size_t j=0; j<NCols(); j++) 296 296 tm(i,j) = (*this)(i,j); 297 297 tm.SetTemp(true); … … 304 304 { 305 305 if (ndim_ == 0) { 306 uint_4sz = imx.Size();306 sa_size_t sz = imx.Size(); 307 307 if (sz < 1) sz = 1; 308 308 ReSize(sz, sz); … … 312 312 throw SzMismatchError("TMatrix::operator= (IdentityMatrix) NRows() != NCols()") ; 313 313 *this = (T) 0; 314 for( uint_4i=0; i<NRows(); i++) (*this)(i,i) = diag;314 for(sa_size_t i=0; i<NRows(); i++) (*this)(i,i) = diag; 315 315 316 316 return (*this); … … 343 343 { 344 344 if (maxprt < 0) maxprt = max_nprt_; 345 uint_4npr = 0;345 sa_size_t npr = 0; 346 346 Show(os, si); 347 347 if (ndim_ < 1) return; 348 uint_4kc,kr;348 sa_size_t kc,kr; 349 349 for(kr=0; kr<size_[marowi_]; kr++) { 350 350 if ( (size_[marowi_] > 1) && (size_[macoli_] > 10) ) cout << "----- Ligne Line= " << kr << endl; … … 352 352 if(kc > 0) os << ", "; 353 353 os << (*this)(kr, kc); npr++; 354 if (npr >= ( uint_4) maxprt) {354 if (npr >= (sa_size_t) maxprt) { 355 355 if (npr < totsize_) os << "\n .... " << endl; return; 356 356 } … … 380 380 const T * peb; 381 381 T sum; 382 uint_4r,c,k;383 uint_4stepa = Step(ColsKA());384 uint_4stepb = b.Step(RowsKA());382 sa_size_t r,c,k; 383 sa_size_t stepa = Step(ColsKA()); 384 sa_size_t stepb = b.Step(RowsKA()); 385 385 // Calcul de C=rm = A*B (A=*this) 386 386 for(r=0; r<rm.NRows(); r++) // Boucle sur les lignes de A
Note:
See TracChangeset
for help on using the changeset viewer.