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