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

drovector-constructor.hpp

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

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