synaps/linalg/lasym2d.h

00001 #ifndef array2d_H
00002 #define array2d_H
00003 //======================================================================
00004 #include <synaps/init.h>
00005 #include <synaps/arithm/Norm.h>
00006 #include <synaps/linalg/MethodName.h>
00007 #include <synaps/base/stride_iterator.h>
00008 #include <synaps/linalg/rep1d.h>
00009 
00010 
00011 
00012 __BEGIN_NAMESPACE_SYNAPS
00013 
00014 //======================================================================
00015 namespace lapack {  
00016 
00017   //----------------------------------------------------------------------
00018   typedef unsigned size_type;
00019   extern double TOL;
00020   //----------------------------------------------------------------------
00026   template <class C>
00027   struct repsym : public linalg::rep1d<C> {
00028     
00029     typedef C*                              col_iterator;
00030     typedef stride_iterator<C,C*,size_type> row_iterator;
00031     
00032     size_type nbrow_, nbcol_, lda_;
00033     
00034     repsym(): linalg::rep1d<C>(){}
00035     repsym(const rep<C> & v): 
00036       linalg::rep1d<C>(v), nbrow_(v.nbrow_), nbcol_(v.nbcol_),lda_(v.lda_) {}
00037     repsym(size_type i,size_type j=1): 
00038       linalg::rep1d<C>(i*j), nbrow_(i),nbcol_(j),lda_(i) {}
00039     repsym(size_type i, size_type j, C* t): 
00040       linalg::rep1d<C>(i*j,t), nbrow_(i), nbcol_(j),lda_(i) {}
00041     repsym(size_type i, size_type j, C* t, char c);
00042     repsym(const char * nm);
00043 
00044     repsym<C> & operator=(const repsym<C> & v)
00045       {
00046         this->linalg::rep1d<C>::operator=(v);
00047         nbrow_ = v.nbrow(); nbcol_ = v.nbcol();
00048         return *this;
00049       }
00050 
00051     C &       operator()(size_type i, size_type j) {return tab_[i+nbrow_*j];}
00052     const C & operator()(size_type i, size_type j) const {return tab_[i+nbrow_*j];}
00053   
00054     size_type nbrow() const {return nbrow_;}
00055     size_type nbcol() const {return nbcol_;}
00056     
00057   };
00058 
00059   template<class C>
00060   void reserve(repsym<C> & m, size_type i,size_type j)
00061   {
00062     linalg::reserve(m,i*j);
00063     m.nbrow_=i; m.nbcol_=j;
00064   }
00065 
00066 };
00067 //----------------------------------------------------------------------
00068 
00069 __END_NAMESPACE_SYNAPS
00070 
00071 #endif //lasym2d_H
00072 

SYNAPS DOCUMENTATION
logo