CPPLapack
 All Classes Files Functions Variables Friends
dsymatrix-constructor.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! dsymatrix constructor without arguments */
00003 inline dsymatrix::dsymatrix()
00004   : m(n)
00005 {VERBOSE_REPORT;
00006   //////// initialize ////////
00007   n = 0;
00008   array =NULL;
00009   darray =NULL;
00010 }
00011 
00012 //=============================================================================
00013 /*! dsymatrix copy constructor */
00014 inline dsymatrix::dsymatrix(const dsymatrix& mat)
00015   : m(n)
00016 {VERBOSE_REPORT;
00017   //////// initialize ////////
00018   n =mat.n;
00019   array =new double[n*n];
00020   darray =new double*[n];
00021   for(int i=0; i<n; i++){ darray[i] =&array[i*n]; }
00022   
00023   //////// copy ////////
00024   dcopy_(n*n, mat.array, 1, array, 1);
00025 }
00026 
00027 //=============================================================================
00028 /*! dsymatrix constructor to cast _dsymatrix */
00029 inline dsymatrix::dsymatrix(const _dsymatrix& mat)
00030   : m(n)
00031 {VERBOSE_REPORT;
00032   n =mat.n;
00033   array =mat.array;
00034   darray =mat.darray;
00035   
00036   mat.nullify();
00037 }
00038 
00039 //=============================================================================
00040 /*! dsymatrix copy constructor to cast dssmatrix */
00041 /*
00042 inline dsymatrix::dsymatrix(const dssmatrix& mat)
00043   : m(n)
00044 {VERBOSE_REPORT;
00045   //////// initialize ////////
00046   n =mat.n;
00047   array =new double[n*n];
00048   darray =new double*[n];
00049   for(int i=0; i<n; i++){ darray[i] =&array[i*n]; }
00050   
00051   //////// copy ////////
00052   zero();
00053   for(int c=0; c<mat.vol; c++){
00054     (*this)(mat.indx[c],mat.jndx[c]) =mat.array[c];
00055   }
00056 }
00057 */
00058 
00059 //=============================================================================
00060 /*! dsymatrix constructor to cast _dssmatrix */
00061 /*
00062 inline dsymatrix::dsymatrix(const _dssmatrix& mat)
00063   : m(n)
00064 {VERBOSE_REPORT;
00065   n =mat.n;
00066   array =new double[n*n];
00067   darray =new double*[n];
00068   for(int i=0; i<n; i++){ darray[i] =&array[i*n]; }
00069   
00070   //////// copy ////////
00071   zero();
00072   for(int c=0; c<mat.vol; c++){
00073     (*this)(mat.indx[c],mat.jndx[c]) =mat.array[c];
00074   }
00075   
00076   mat.nullify();
00077 }
00078 */
00079 
00080 
00081 //=============================================================================
00082 /*! dsymatrix constructor with size specification */
00083 inline dsymatrix::dsymatrix(const long& _n)
00084   : m(n)
00085 {VERBOSE_REPORT;
00086 #ifdef  CPPL_DEBUG
00087   if( _n<0 ){
00088     ERROR_REPORT;
00089     std::cerr << "Matrix sizes must be positive integers. " << std::endl
00090               << "Your input was (" << _n << ")." << std::endl;
00091     exit(1);
00092   }
00093 #endif//CPPL_DEBUG
00094   
00095   //////// initialize ////////
00096   n =_n;
00097   array =new double[n*n];
00098   darray =new double*[n];
00099   for(int i=0; i<n; i++){ darray[i] =&array[i*n]; }
00100 }
00101 
00102 //=============================================================================
00103 /*! dsymatrix constructor with filename */
00104 inline dsymatrix::dsymatrix(const char* filename)
00105   : m(n)
00106 {VERBOSE_REPORT;
00107   array =NULL;
00108   darray =NULL;
00109   
00110   //// copy ////
00111   read(filename);
00112 }
00113 
00114 ///////////////////////////////////////////////////////////////////////////////
00115 ///////////////////////////////////////////////////////////////////////////////
00116 ///////////////////////////////////////////////////////////////////////////////
00117 
00118 //=============================================================================
00119 /*! dsymatrix destructor */
00120 inline dsymatrix::~dsymatrix()
00121 {VERBOSE_REPORT;
00122   delete [] array;
00123   delete [] darray;
00124 }
 All Classes Files Functions Variables Friends