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