synaps/linalg/sparse.h

00001 /*********************************************************************
00002 *   This file is part of the source code of the SYNAPS kernel.
00003 *   Author(s): Ph. Trebuchet, GALAAD, INRIA
00004 *   $Id: sparse.h,v 1.1 2005/07/11 08:33:36 mourrain Exp $
00005 **********************************************************************/
00006 #ifndef SYNAPS_LINALG_SPARSE
00007 #define SYNAPS_LINALG_SPARSE
00008 /*********************************************************************/
00009 //here external includes
00010 #include<cstddef>
00011 #include<cstdlib>
00012 #include<cstring>
00013 #include<cstdio>
00014 #include<cmath>
00015 #include<new>
00016 #include<iostream>
00017 #include<vector>
00018 //------------------------------------------------------------------------
00019 #include <synaps/init.h>
00020 #include "synaps/linalg/MethodName.h"
00021 
00022 //#ifdef SYNAPS_WITH_GMP
00023 //      #include "synaps/arithm/QQ.h"
00024 //      #include "synaps/arithm/RR.h"
00025 //#endif //SYNAPS_WITH_GMP
00026 
00027 
00028 __BEGIN_NAMESPACE_SYNAPS
00029 
00030 //=====================================================================
00032 namespace sparse {
00033 
00035   template <typename T>
00036   struct rep2d
00037   {
00038     typedef T value_type;
00039     typedef int size_type;
00040     typedef T coeff_t;
00041     int nrow;
00042     int ncol;
00043     int nnz;
00044     int *rowind;
00045     int *colptr;
00046     void *nzval;
00047 
00048     rep2d()
00049     {
00050       nrow=0;
00051       ncol=0;
00052       nnz=0;
00053       rowind=NULL;
00054       colptr=NULL;
00055       nzval=NULL;
00056     }
00057     rep2d(const int nrow, const int ncol);
00058     rep2d(const int nrow, const int ncol, const int nz);
00059     rep2d(const int nrow, const int ncol, const int nz,
00060           T* coeffs, const int *idx);
00061 
00062     ~rep2d();
00063     int nbrow() {return nrow;};
00064     int nbcol() {return ncol;};
00065     int nbrow() const {return nrow;};
00066     int nbcol() const {return ncol;};
00067     T & operator() (const int & i,const int & j,const T &d) ;
00068     T & operator() (const int &i,const int &j);
00069     T  operator() (const int &i,const int &j)const ;
00070     inline void destroystore();
00071   };
00072 
00073   //----------------------------------------------------------------------
00074 
00075   //  template<class C> void solve(LU,linalg::rep1d<C> & x,
00076   //                           const rep2d<C> & A, const linalg::rep1d<C> & b);
00077   //template<class C> void solve(LU,rep2d<C> & X, const rep2d<C> & A);
00078 
00079   //  template<class C> integer decomp(LU,rep2d<C> & A);
00080   //template<class C> integer decomp(LU,rep2d<C> & A, rep2d<C> & U);
00081   //template<class C> integer decomp(LU,rep2d<C> & A, integer *pivot);
00082 
00083   // template<class C> typename rep2d<C>::size_type rank(const rep2d<C> & M);
00084   //template<class C> typename rep2d<C>::size_type rank(const rep2d<C> & M,
00085   //                                 typename rep2d<C>::size_type* permut_col,
00086   //                                 typename rep2d<C>::size_type* permut_row);
00087   //----------------------------------------------------------------------
00088 
00089 } //namespace sparse
00090 
00091 __END_NAMESPACE_SYNAPS
00092 
00093 //======================================================================
00094 #ifndef SEPARATE_COMPILATION
00095         #include "synaps/linalg/sparse.C"
00096 #endif
00097 
00098 #endif // SYNAPS_LINALG_SPARSE

SYNAPS DOCUMENTATION
logo