Changeset 758 in Sophya for trunk/SophyaLib/Samba/alm.h
- Timestamp:
- Mar 2, 2000, 5:25:35 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/alm.h
r729 r758 1 1 #ifndef ALM_SEEN 2 2 #define ALM_SEEN 3 3 4 #include "nbrandom.h" 4 5 #include "nbmath.h" 6 #include "triangmtx.h" 5 7 #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 TriangularMatrix10 {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) const37 {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) const44 {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 };58 8 59 9
Note:
See TracChangeset
for help on using the changeset viewer.