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

dcovector-_dcovector.hpp

Go to the documentation of this file.
00001 //=============================================================================
00002 /*! dcovector=_dcovector operator */
00003 inline dcovector& dcovector::operator=(const _dcovector& vec)
00004 {
00005 #ifdef  CPPL_DEBUG
00006   std::cerr << "# [NOTE] dcovector::operator=(const _dcovector&) was called."
00007             << std::endl;
00008 #endif//CPPL_DEBUG
00009   
00010   shallow_copy(vec);
00011   return *this;
00012 }
00013 
00014 ///////////////////////////////////////////////////////////////////////////////
00015 ///////////////////////////////////////////////////////////////////////////////
00016 ///////////////////////////////////////////////////////////////////////////////
00017 
00018 //=============================================================================
00019 /*! dcovector+=_dcovector operator */
00020 inline dcovector& dcovector::operator+=(const _dcovector& vec)
00021 {
00022 #ifdef  CPPSL_DEBUG
00023   if( L!=vec.L ){
00024     std::cerr << "[ERROR] dcovector::operator+=(const _dcovector&)" << std::endl
00025               << "These two vectors can not make a sumation." << std::endl
00026               << "Your input was (" << L << ") += (" << vec.L << ")."
00027               << std::endl;
00028     exit(1);
00029   }
00030 #endif//CPPSL_DEBUG
00031   
00032   for(int i=0; i<Ll; i++){ Array[i] +=vec.Array[i]; }
00033   
00034   vec.destroy();
00035   return *this;
00036 }
00037 
00038 //=============================================================================
00039 /*! dcovector-=_dcovector operator */
00040 inline dcovector& dcovector::operator-=(const _dcovector& vec)
00041 {
00042 #ifdef  CPPSL_DEBUG
00043   if( L!=vec.L ){
00044     std::cerr << "[ERROR] dcovector::operator-=(const _dcovector&)" << std::endl
00045               << "These two vectors can not make a subtraction." << std::endl
00046               << "Your input was (" << L << ") -= (" << vec.L << ")."
00047               << std::endl;
00048     exit(1);
00049   }
00050 #endif//CPPSL_DEBUG
00051   
00052   for(int i=0; i<Ll; i++){ Array[i] -=vec.Array[i]; }
00053   
00054   vec.destroy();
00055   return *this;
00056 }
00057 
00058 ///////////////////////////////////////////////////////////////////////////////
00059 ///////////////////////////////////////////////////////////////////////////////
00060 ///////////////////////////////////////////////////////////////////////////////
00061 
00062 //=============================================================================
00063 /*! dcovector+_dcovector operator */
00064 inline _dcovector operator+(const dcovector& vecA, const _dcovector& vecB)
00065 {
00066 #ifdef  CPPSL_DEBUG
00067   if(vecA.L!=vecB.L){
00068     std::cerr
00069       << "[ERROR] operator+(const dcovector&, const _dcovector&)" << std::endl
00070       << "These two vectors can not make a sumation." << std::endl
00071       << "Your input was (" << vecA.L << ") + (" << vecB.L << ")."
00072       << std::endl;
00073     exit(1);
00074   }
00075 #endif//CPPSL_DEBUG
00076   
00077   for(int i=0; i<vecA.Ll; i++){ vecB.Array[i] +=vecA.Array[i]; }
00078   
00079   return vecB;
00080 }
00081 
00082 //=============================================================================
00083 /*! dcovector-_dcovector operator */
00084 inline _dcovector operator-(const dcovector& vecA, const _dcovector& vecB)
00085 {
00086 #ifdef  CPPSL_DEBUG
00087   if(vecA.L!=vecB.L){
00088     std::cerr
00089       << "[ERROR] operator-(const dcovector&, const _dcovector&)" << std::endl
00090       << "These two vectors can not make a subtraction." << std::endl
00091       << "Your input was (" << vecA.L << ") - (" << vecB.L << ")."
00092       << std::endl;
00093     exit(1);
00094   }
00095 #endif//CPPSL_DEBUG
00096   
00097   for(int i=0; i<vecA.Ll; i++){
00098     vecB.Array[i] =vecA.Array[i]-vecB.Array[i];
00099   }
00100   
00101   return vecB;
00102 }
00103 
00104 //=============================================================================
00105 /*! dcovector^T*_dcovector operator (inner product) */
00106 inline double operator%(const dcovector& vecA, const _dcovector& vecB)
00107 {
00108 #ifdef  CPPSL_DEBUG
00109   if(vecA.L!=vecB.L){
00110     std::cerr
00111       << "[ERROR] operator%(const dcovector&, const _dcovector&)" << std::endl
00112       << "These two vectors can not make a dot product." << std::endl
00113       << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
00114       << std::endl;
00115     exit(1);
00116   }
00117 #endif//CPPSL_DEBUG
00118   
00119   double val;
00120   pddot_( vecA.L, val,
00121           vecA.Array, 1, 1, vecA.Desc, 1, vecB.Array, 1, 1, vecB.Desc, 1 );
00122   
00123   vecB.destroy();
00124   return val;
00125 }

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