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