CPPLapack
 All Classes Files Functions Variables Friends
_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 {VERBOSE_REPORT;
00005 #ifdef  CPPL_DEBUG
00006   if(vecA.l!=vecB.l){
00007     ERROR_REPORT;
00008     std::cerr << "These two vectors can not make a sumation." << std::endl
00009               << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl;
00010     exit(1);
00011   }
00012   
00013 #endif//CPPL_DEBUG
00014   
00015   for(long i=0; i<vecA.l; i++){ vecA.array[i]+=vecB.array[i]; }
00016   
00017   vecB.destroy();
00018   return vecA;
00019 }
00020 
00021 //=============================================================================
00022 /*! _drovector-_drovector operator */
00023 inline _drovector operator-(const _drovector& vecA, const _drovector& vecB)
00024 {VERBOSE_REPORT;
00025 #ifdef  CPPL_DEBUG
00026   if(vecA.l!=vecB.l){
00027     ERROR_REPORT;
00028     std::cerr << "These two vectors can not make a subtraction." << std::endl
00029               << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
00030     exit(1);
00031   }
00032 #endif//CPPL_DEBUG
00033   
00034   for(long i=0; i<vecA.l; i++){ vecA.array[i]-=vecB.array[i]; }
00035   
00036   vecB.destroy();
00037   return vecA;
00038 }
00039 
00040 //=============================================================================
00041 /*! _drovector^T*_drovector operator (inner product) */
00042 inline double operator%(const _drovector& vecA, const _drovector& vecB)
00043 {VERBOSE_REPORT;
00044 #ifdef  CPPL_DEBUG
00045   if(vecA.l!=vecB.l){
00046     ERROR_REPORT;
00047     std::cerr << "These two vectors can not make a dot product." << std::endl
00048               << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
00049     exit(1);
00050   }
00051 #endif//CPPL_DEBUG
00052   
00053   double val( ddot_( vecA.l, vecA.array, 1, vecB.array, 1 ) );
00054   
00055   vecA.destroy();
00056   vecB.destroy();
00057   return val;
00058 }
 All Classes Files Functions Variables Friends