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(long i=0; i<vecA.Ll; i++){ vecA.Array[i] +=vecB.Array[i]; }
00017   
00018   vecB.destroy();
00019   return vecA;
00020 }
00021 
00022 //=============================================================================
00023 /*! _drovector-_drovector operator */
00024 inline _drovector operator-(const _drovector& vecA, const _drovector& vecB)
00025 {
00026 #ifdef  CPPSL_DEBUG
00027   if( vecA.L!=vecB.L ){
00028     std::cerr << "[ERROR] operator-(const _drovector&, const _drovector&)"
00029               << 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(long i=0; i<vecA.Ll; i++){ vecA.Array[i] -=vecB.Array[i]; }
00038   
00039   vecB.destroy();
00040   return vecA;
00041 }
00042 
00043 //=============================================================================
00044 /*! _drovector*_drovector^T operator (inner product) */
00045 inline double operator%(const _drovector& vecA, const _drovector& vecB)
00046 {
00047 #ifdef  CPPSL_DEBUG
00048   if( vecA.L!=vecB.L ){
00049     std::cerr << "[ERROR] operator%(const _drovector&, const _drovector&)"
00050               << 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