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