Changeset 1683 in Sophya for trunk/SophyaLib/TArray


Ignore:
Timestamp:
Oct 11, 2001, 5:22:03 PM (24 years ago)
Author:
lemeur
Message:

methode iterative pour analyse harmonique

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/TArray/triangmtx.h

    r1624 r1683  
    1515
    1616namespace SOPHYA {
    17 
     17 
    1818//! Class for inferior triangular matrix (base class for the class Alm)
    1919template <class T>
     
    3535  }
    3636
    37 //! Equal operator
    38 inline TriangularMatrix<T>& operator = (const TriangularMatrix<T>& a)
    39 {
    40   elem_=a.elem_;
    41   long_diag_ = a.long_diag_;
    42   return *this;
    43 }
     37TriangularMatrix<T>& SetT(T a)
     38  {
     39    if (long_diag_ < 1)
     40    throw RangeCheckError("TriangularMatrix<T>::SetT(T )  - TriangularMatrix not dimensionned ! ");
     41    elem_ = a;
     42    return (*this);
     43  }
    4444
    4545//! () operator : access to elements row \b l and column \b m
    4646inline T& operator()(int l, int m)
    4747  {
    48       return  elem_(adr_ij(l,m));
     48      return  elem_(indexOfElement(l,m));
    4949  }
     50
     51inline T& operator()(int index)
     52  {
     53      return  elem_(index);
     54  }
     55
     56
    5057//! () operator : access to elements row \b l and column \b m
    5158inline T const& operator()(int l, int m) const
    5259  {
    53       return *(elem_.Begin()+ adr_ij(l,m));
     60      return *(elem_.Begin()+ indexOfElement(l,m));
    5461  }
     62
     63inline T const& operator()(int index) const
     64  {
     65      return *(elem_.Begin()+ index);
     66  }
     67
    5568
    5669//! Return number of rows
    5770inline  int_4  rowNumber() const {return (int_4)long_diag_;}
    5871
     72void Print(int nbLignes=0)
     73  {
     74    if (nbLignes == 0 ) nbLignes = long_diag_;
     75    cout << " ***** matrice triangulaire : ********* " << endl;
     76    for (int k=0; k < nbLignes; k++)
     77      {
     78        for (int kc = 0; kc <= k ; kc++)
     79          {
     80            cout << " " << elem_(indexOfElement(k,kc));
     81          }
     82        cout << endl;
     83      }
     84    cout << "---------------- fin matrice ------------" << endl;
     85  }
     86
     87  //Return pointer to first element address
     88  //inline T* Data()  {return elem_.Begin();}
     89
     90//! compute the address of an element in the single array representing the matrix
     91inline uint_4 indexOfElement(int i,int j) const
     92{
     93  //  return(i*(i+1)/2+j);
     94  // the (inferior triangular )matrix is stored column by column
     95  return(i+ long_diag_*j-j*(j+1)/2);
     96}
     97
    5998private:
    60 //! compute the address of an element in the single array representing the matrix
    61 inline uint_4 adr_ij(int i,int j) const
    62 {
    63   //  int adr= i*(i+1)/2+j;
    64   //  if ( adr >= elem_.Size() || adr <0 )
    65   //{
    66   // cout << " attention depassement dans triangularMatrix " << endl;
    67   // cout << " l= " << i << " m= " << j << " tableau reserve longueur " << elem_.Size() << endl;
    68   //}
    69   return(i*(i+1)/2+j);
    70 }
    7199
    72100uint_4 long_diag_;    //!< size of the square matrix
     
    74102
    75103  };
    76 
     104 
    77105}   // namespace SOPHYA
    78106
Note: See TracChangeset for help on using the changeset viewer.