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   
00015 #endif//CPPSL_DEBUG
00016 
00017   for(int i=0; i<vecA.Ll; i++){ vecA.Array[i] +=vecB.Array[i]; }
00018   
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   return vecA;
00040 }
00041 
00042 //=============================================================================
00043 /*! _dcovector^T*dcovector operator (inner product) */
00044 inline double operator%(const _dcovector& vecA, const dcovector& vecB)
00045 {
00046 #ifdef  CPPSL_DEBUG
00047   if(vecA.L!=vecB.L){
00048     std::cerr
00049       << "[ERROR] operator%(const _dcovector&, const dcovector&)" << std::endl
00050       << "These two vectors can not make a dot product." << std::endl
00051       << "Your input was (" << vecA.L << ") % (" << vecB.L << ")."
00052       << std::endl;
00053     exit(1);
00054   }
00055 #endif//CPPSL_DEBUG
00056   
00057   double val;
00058   pddot_( vecA.L, val,
00059           vecA.Array, 1, 1, vecA.Desc, 1, vecB.Array, 1, 1, vecB.Desc, 1 );
00060   
00061   vecA.destroy();
00062   return val;
00063 }

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