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