Main Page | Class List | File List | Class Members | File Members | Related Pages

dgematrix-constructor.hpp

Go to the documentation of this file.
00001 //============================================================================
00002 /*! dgematrix constructor without arguments */
00003 inline dgematrix::dgematrix()
00004   : m(M), n(N), ml(Ml), nl(Nl), desc(Desc), array(Array)
00005 {
00006   //////// initialize ////////
00007   M =N =0;
00008   Ml =Nl =0;
00009   Desc[0]=1; Desc[1]=icontxt; Desc[2]=0; Desc[3]=0; Desc[4]=mb; Desc[5]=nb;
00010   Desc[6]=0; Desc[7]=0; Desc[8]=max(1,Ml);
00011   Array =new double[0];
00012   
00013 #ifdef  CPPSL_DEBUG
00014   std::cerr << "# [NOTE] dgematrix::dgematrix() "
00015             << "A new 0x0 matrix at " << Array
00016             << " has been made." << std::endl;
00017 #endif//CPPSL_DEBUG
00018 }
00019 
00020 
00021 //////////////////////////////////////////////////////////////////////////////
00022 //////////////////////////////////////////////////////////////////////////////
00023 //////////////////////////////////////////////////////////////////////////////
00024 //============================================================================
00025 /*! dgematrix copy constructor */
00026 inline dgematrix::dgematrix(const dgematrix& mat)
00027   : m(M), n(N), ml(Ml), nl(Nl), desc(Desc), array(Array)
00028 {
00029   //////// initialize ////////
00030   M =mat.M; N =mat.N;
00031   Ml =mat.Ml; Nl =mat.Nl;
00032   for(int i=0; i<9; i++){ Desc[i] =mat.Desc[i]; }
00033   Array =new double[Ml*Nl];
00034   
00035   //////// copy ////////
00036   dcopy_(Ml*Nl, mat.Array, 1, Array, 1);
00037   
00038 #ifdef  CPPSL_DEBUG
00039   std::cerr << "# [NOTE] dgematrix::dgematrix(const dgematrix&) "
00040             << "A new matrix at " << array << " has been made." << std::endl;
00041 #endif//CPPSL_DEBUG
00042 }
00043 
00044 //============================================================================
00045 /*! dgematrix constructor to cast _dgematrix */
00046 inline dgematrix::dgematrix(const _dgematrix& mat)
00047   : m(M), n(N), ml(Ml), nl(Nl), desc(Desc), array(Array)
00048 {
00049   M =mat.M; N =mat.N;
00050   Ml =mat.Ml; Nl =mat.Nl;
00051   for(int i=0; i<9; i++){ Desc[i] =mat.Desc[i]; }
00052   Array =mat.Array;
00053   
00054 #ifdef  CPPSL_DEBUG
00055   std::cerr << "# [NOTE] dgematrix::dgematrix(const _dgematrix&) "
00056             << "A new matrix pointing at " << Array << " has been made."
00057             << std::endl;
00058 #endif//CPPSL_DEBUG
00059 }
00060 
00061 //////////////////////////////////////////////////////////////////////////////
00062 //////////////////////////////////////////////////////////////////////////////
00063 //////////////////////////////////////////////////////////////////////////////
00064 
00065 //============================================================================
00066 /*! dgematrix constructor with size specification */
00067 inline dgematrix::dgematrix(const long& _m, const long& _n)
00068   : m(M), n(N), ml(Ml), nl(Nl), desc(Desc), array(Array)
00069 {
00070 #ifdef  CPPSL_DEBUG
00071   if( _m<0 || _n<0 ){
00072     std::cerr << "[ERROR] dgematrix::dgematrix(const long, const long)"
00073               << std::endl
00074               << "Matrix sizes must be positive integers. " << std::endl
00075               << "Your input was (" << _m << "," << _n << ")." << std::endl;
00076     exit(1);
00077   }
00078 #endif//CPPSL_DEBUG
00079   
00080   //////// initialize ////////
00081   M =_m; N =_n;
00082   Ml =numroc_( M, mb, myrow, 0, nprow );
00083   Nl =numroc_( N, nb, mycol, 0, npcol );
00084   Desc[0]=1; Desc[1]=icontxt; Desc[2]=M; Desc[3]=N; Desc[4]=mb; Desc[5]=nb;
00085   Desc[6]=0; Desc[7]=0; Desc[8]=max(1,Ml);
00086   Array =new double[Ml*Nl];
00087   
00088 #ifdef  CPPSL_DEBUG
00089   std::cerr << "# [NOTE] dgematrix(const long&, const long&) "
00090             << "A new matrix at " << array << " has been made." << std::endl;
00091 #endif//CPPSL_DEBUG
00092 }
00093 
00094 ///////////////////////////////////////////////////////////////////////////////
00095 ///////////////////////////////////////////////////////////////////////////////
00096 ///////////////////////////////////////////////////////////////////////////////
00097 
00098 //============================================================================
00099 /*! dgematrix destructor */
00100 inline dgematrix::~dgematrix()
00101 {
00102 #ifdef  CPPSL_DEBUG
00103   std::cerr << "# [NOTE] dgematrix::~dgematrix() "
00104             << "A matrix at " << array
00105             << " is going to be deleted." << std::endl;
00106 #endif//CPPSL_DEBUG
00107   //////// delete array ////////
00108   delete [] Array;
00109 }

Generated on Sat Jan 31 19:25:43 2004 for CPPScaLapack by doxygen 1.3.5