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

_drovector-drovector.hpp

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

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