Changeset 1156 in Sophya for trunk/SophyaLib/TArray/tmatrix.cc


Ignore:
Timestamp:
Aug 29, 2000, 6:10:32 PM (25 years ago)
Author:
ansari
Message:

Introduction du type sa_size_t (taille des tableaux), operateur - (TArray::operator - et NegateElt()) - Reza 29/8/2000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/TArray/tmatrix.cc

    r1103 r1156  
    1 // $Id: tmatrix.cc,v 1.15 2000-07-27 00:00:09 ansari Exp $
     1// $Id: tmatrix.cc,v 1.16 2000-08-29 16:10:30 ansari Exp $
    22//                         C.Magneville          04/99
    33#include "machdefs.h"
     
    3333 */
    3434template <class T>
    35 TMatrix<T>::TMatrix(uint_4 r,uint_4 c, short mm)
     35TMatrix<T>::TMatrix(sa_size_t r,sa_size_t c, short mm)
    3636// Construit une matrice de r lignes et c colonnes.
    3737  :  TArray<T>()
    3838{
    3939  if ( (r == 0) || (c == 0) )
    40     throw ParmError("TMatrix<T>::TMatrix(uint_4 r,uint_4 c) NRows or NCols = 0");
     40    throw ParmError("TMatrix<T>::TMatrix(sa_size_t r,sa_size_t c) NRows or NCols = 0");
    4141  arrtype_ = 1;   // Type = Matrix
    4242  ReSize(r, c, mm);
     
    175175 */
    176176template <class T>
    177 void TMatrix<T>::ReSize(uint_4 r, uint_4 c, short mm)
     177void TMatrix<T>::ReSize(sa_size_t r, sa_size_t c, short mm)
    178178{
    179179  if(r==0||c==0)
     
    181181  if ((arrtype_ == 2) && (r > 1) && (c > 1))
    182182    throw(SzMismatchError("TMatrix::ReSize r>1&&c>1 for Vector "));
    183   uint_4 size[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;
    185185  if (mm == SameMemoryMapping) mm = GetMemoryMapping(); 
    186186  else if ( (mm != CMemoryMapping) && (mm != FortranMemoryMapping) )
     
    206206 */
    207207template <class T>
    208 void TMatrix<T>::Realloc(uint_4 r,uint_4 c, short mm, bool force)
     208void TMatrix<T>::Realloc(sa_size_t r,sa_size_t c, short mm, bool force)
    209209{
    210210  if(r==0||c==0)
     
    212212  if ((arrtype_ == 2) && (r > 1) && (c > 1))
    213213    throw(SzMismatchError("TMatrix::Realloc r>1&&c>1 for Vector "));
    214   uint_4 size[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;
    216216  if (mm == SameMemoryMapping) mm = GetMemoryMapping(); 
    217217  else if ( (mm != CMemoryMapping) && (mm != FortranMemoryMapping) )
     
    249249{
    250250  short vt = (marowi_ == veceli_) ? ColumnVector : RowVector;
    251   uint_4 rci = macoli_;
     251  int_4 rci = macoli_;
    252252  macoli_ = marowi_;
    253253  marowi_ = rci;
     
    268268  if (mm == SameMemoryMapping) mm = GetMemoryMapping(); 
    269269  TMatrix<T> tm(NCols(), NRows(), mm);
    270   for(uint_4 i=0; i<NRows(); i++)
    271     for(uint_4 j=0; j<NCols(); j++)
     270  for(sa_size_t i=0; i<NRows(); i++)
     271    for(sa_size_t j=0; j<NCols(); j++)
    272272      tm(j,i) = (*this)(i,j);
    273273  tm.SetTemp(true);
     
    292292 
    293293  TMatrix<T> tm(NRows(), NCols(), mm);
    294   for(uint_4 i=0; i<NRows(); i++)
    295     for(uint_4 j=0; j<NCols(); j++)
     294  for(sa_size_t i=0; i<NRows(); i++)
     295    for(sa_size_t j=0; j<NCols(); j++)
    296296      tm(i,j) = (*this)(i,j);
    297297  tm.SetTemp(true);
     
    304304{
    305305  if (ndim_ == 0) {
    306     uint_4 sz = imx.Size();
     306    sa_size_t sz = imx.Size();
    307307    if (sz < 1) sz = 1;
    308308    ReSize(sz, sz);
     
    312312    throw SzMismatchError("TMatrix::operator= (IdentityMatrix) NRows() != NCols()") ;
    313313  *this = (T) 0;
    314   for(uint_4 i=0; i<NRows(); i++) (*this)(i,i) = diag;
     314  for(sa_size_t i=0; i<NRows(); i++) (*this)(i,i) = diag;
    315315
    316316  return (*this);
     
    343343{
    344344  if (maxprt < 0)  maxprt = max_nprt_;
    345   uint_4 npr = 0;
     345  sa_size_t npr = 0;
    346346  Show(os, si);
    347347  if (ndim_ < 1)  return;
    348   uint_4 kc,kr; 
     348  sa_size_t kc,kr; 
    349349  for(kr=0; kr<size_[marowi_]; kr++) {
    350350    if ( (size_[marowi_] > 1) && (size_[macoli_] > 10) ) cout << "----- Ligne Line= " << kr << endl;
     
    352352      if(kc > 0) os << ", "; 
    353353      os << (*this)(kr, kc);   npr++;
    354       if (npr >= (uint_4) maxprt) {
     354      if (npr >= (sa_size_t) maxprt) {
    355355        if (npr < totsize_)  os << "\n     .... " << endl; return;
    356356      }
     
    380380  const T * peb;
    381381  T sum;
    382   uint_4 r,c,k;
    383   uint_4 stepa = Step(ColsKA());
    384   uint_4 stepb = 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());
    385385  // Calcul de C=rm = A*B   (A=*this)
    386386  for(r=0; r<rm.NRows(); r++)      // Boucle sur les lignes de A
Note: See TracChangeset for help on using the changeset viewer.