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 operator+(const _dcovector& vecA, const _dcovector& vecB)
00004 {
00005 #ifdef  CPPSL_DEBUG
00006   if(vecA.L!=vecB.L){
00007     std::cerr
00008       << "[ERROR] operator+(const _dcovector&, const _dcovector&)" << std::endl
00009       << "These two vectors can not make a sumation." << std::endl
00010       << "Your input was (" << vecA.L << ") + (" << vecB.L << ")."
00011       << std::endl;
00012     exit(1);
00013   }
00014 #endif//CPPSL_DEBUG
00015   
00016   for(int i=0; i<vecA.Ll; i++){ vecA.Array[i] +=vecB.Array[i]; }
00017   
00018   vecB.destroy();
00019   return vecA;
00020 }
00021 
00022 //=============================================================================
00023 /*! _dcovector-_dcovector operator */
00024 inline _dcovector operator-(const _dcovector& vecA, const _dcovector& vecB)
00025 {
00026 #ifdef  CPPSL_DEBUG
00027   if(vecA.L!=vecB.L){
00028     std::cerr
00029       << "[ERROR] operator-(const _dcovector&, const _dcovector&)" << std::endl
00030       << "These two vectors can not make a subtraction." << std::endl
00031       << "Your input was (" << vecA.L << ") - (" << vecB.L << ")."
00032       << std::endl;
00033     exit(1);
00034   }
00035 #endif//CPPSL_DEBUG
00036   
00037   for(int i=0; i<vecA.Ll; i++){ vecA.Array[i] -=vecB.Array[i]; }
00038   
00039   vecB.destroy();
00040   return vecA;
00041 }
00042 
00043 //=============================================================================
00044 /*! _dcovector^T*_dcovector operator (inner product) */
00045 inline double operator%(const _dcovector& vecA, const _dcovector& vecB)
00046 {
00047 #ifdef  CPPSL_DEBUG
00048   if(vecA.L!=vecB.L){
00049     std::cerr
00050       << "[ERROR] operator%(const _dcovector&, const _dcovector&)" << std::endl
00051       << "These two vectors can not make a dot product." << std::endl
00052       << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
00053       << std::endl;
00054     exit(1);
00055   }
00056 #endif//CPPSL_DEBUG
00057   
00058   double val;
00059   pddot_( vecA.L, val,
00060           vecA.Array, 1, 1, vecA.Desc, 1, vecB.Array, 1, 1, vecB.Desc, 1 );
00061   
00062   vecA.destroy();
00063   vecB.destroy();
00064   return val;
00065 }

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