CPPLapack
 All Classes Files Functions Variables Friends
dgbmatrix-constructor.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! dgbmatrix constructor */
00003 inline dgbmatrix::dgbmatrix()
00004 {VERBOSE_REPORT;
00005   //////// initialize ////////
00006   m =0;
00007   n =0;
00008   kl=0;
00009   ku=0;
00010   array =NULL;
00011   darray =NULL;
00012 }
00013 
00014 //=============================================================================
00015 /*! dgbmatrix copy constructor */
00016 inline dgbmatrix::dgbmatrix(const dgbmatrix& mat)
00017 {VERBOSE_REPORT;
00018   //////// initialize ////////
00019   m =mat.m;
00020   n =mat.n;
00021   kl=mat.kl;
00022   ku=mat.ku;
00023   array =new double[(kl+ku+1)*n];
00024   darray =new double*[n];
00025   for(int i=0; i<n; i++){ darray[i] =&array[i*(kl+ku+1)]; }
00026   
00027   //////// copy ////////
00028   dcopy_((kl+ku+1)*n, mat.array, 1, array, 1);
00029 }
00030 
00031 //=============================================================================
00032 /*! dgbmatrix constructor to cast _dgbmatrix */
00033 inline dgbmatrix::dgbmatrix(const _dgbmatrix& mat)
00034 {VERBOSE_REPORT;
00035   m =mat.m;
00036   n =mat.n;
00037   kl =mat.kl;
00038   ku =mat.ku;
00039   array =mat.array;
00040   darray =mat.darray;
00041   
00042   mat.nullify();
00043 }
00044 
00045 //=============================================================================
00046 /*! dgbmatrix constructor with size specification */
00047 inline dgbmatrix::dgbmatrix(const long& _m, const long& _n,
00048                             const long& _kl, const long& _ku)
00049 {VERBOSE_REPORT;
00050 #ifdef  CPPL_DEBUG
00051   if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){
00052     ERROR_REPORT;
00053     std::cerr << "It is impossible to make a matrix you ordered. " << std::endl
00054               << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl;
00055     exit(1);
00056   }
00057 #endif//CPPL_DEBUG
00058   
00059   //////// initialize ////////
00060   m =_m;
00061   n =_n;
00062   kl =_kl;
00063   ku =_ku;
00064   array =new double[(kl+ku+1)*n];
00065   darray =new double*[n];
00066   for(int i=0; i<n; i++){ darray[i] =&array[i*(kl+ku+1)]; }
00067 }
00068 
00069 //=============================================================================
00070 /*! dgbmatrix constructor with filename */
00071 inline dgbmatrix::dgbmatrix(const char* filename)
00072 {VERBOSE_REPORT;
00073   array =NULL;
00074   darray =NULL;
00075   
00076   //// read ////
00077   read(filename);
00078 }
00079 
00080 ///////////////////////////////////////////////////////////////////////////////
00081 ///////////////////////////////////////////////////////////////////////////////
00082 ///////////////////////////////////////////////////////////////////////////////
00083 
00084 //=============================================================================
00085 /*! dgbmatrix destructor */
00086 inline dgbmatrix::~dgbmatrix()
00087 {VERBOSE_REPORT;
00088   //////// delete array ////////
00089   delete [] array;
00090   delete [] darray;
00091 }
 All Classes Files Functions Variables Friends