Changeset 758 in Sophya for trunk/SophyaLib/Samba/alm.h


Ignore:
Timestamp:
Mar 2, 2000, 5:25:35 PM (26 years ago)
Author:
ansari
Message:

Restructuration de Sophya en petits modules (creation de SkyMap en particulier)

Reza 2/3/2000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Samba/alm.h

    r729 r758  
    11#ifndef ALM_SEEN
    22#define ALM_SEEN
     3
    34#include "nbrandom.h"
    45#include "nbmath.h"
     6#include "triangmtx.h"
    57#include "tvector.h"
    6 #include "pexceptions.h"
    7 /*! Class for inferior triangular matrix (base class for the class Alm) */
    8 template <class T>
    9 class TriangularMatrix
    10   {
    11    
    12   public :
    13 
    14 TriangularMatrix()   {};
    15   /* instanciate a triangular matrix from the number of rows */
    16 TriangularMatrix(int rowSize)  : long_diag_((uint_4)rowSize) {elem_.ReSize((uint_4) (rowSize*(rowSize+1)/2) ); };
    17 TriangularMatrix(const TriangularMatrix<T>& a,  bool share=false)  : elem_(a.elem_, share),  long_diag_(a.long_diag_) {;}
    18 /*! resize the matrix with a new number of rows */
    19 inline void ReSizeRow(int rowSize)
    20   {
    21     long_diag_=(uint_4)rowSize;
    22     elem_.ReSize(long_diag_*(long_diag_+1)/2);
    23   }
    24  inline void SetTemp(bool temp=false) const {elem_.SetTemp(temp);}
    25 
    26 inline TriangularMatrix<T>& operator = (const TriangularMatrix<T>& a)
    27 {
    28   elem_=a.elem_;
    29   long_diag_ = a.long_diag_;
    30   return *this;
    31 }
    32 inline T& operator()(int l, int m)
    33   {
    34       return  elem_(adr_ij(l,m));
    35   }
    36 inline T const& operator()(int l, int m) const
    37   {
    38       return *(elem_.Begin()+ adr_ij(l,m));
    39   }
    40  inline  int_4  rowNumber() const {return (int_4)long_diag_;}
    41   private:
    42  /*! compute the address of an element in the single array representing the matrix */
    43 inline uint_4 adr_ij(int i,int j) const
    44 {
    45   int adr= i*(i+1)/2+j;
    46   if ( adr >= elem_.Size() || adr <0 )
    47 {
    48  cout << " attention depassement dans triangularMatrix " << endl;
    49  cout << " l= " << i << " m= " << j << " tableau reserve longueur " << elem_.Size() << endl;
    50 }
    51   return(i*(i+1)/2+j);
    52 }
    53 
    54  uint_4 long_diag_;
    55  NDataBlock<T> elem_;
    56 
    57   };
    588
    599
Note: See TracChangeset for help on using the changeset viewer.