CPPLapack
 All Classes Files Functions Variables Friends
zrovector-zrovector.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! zrovector=zrovector operator */
00003 inline zrovector& zrovector::operator=(const zrovector& vec)
00004 {VERBOSE_REPORT;
00005   if(array!=vec.array){ // if it is NOT self substitution
00006     copy(vec);
00007   }
00008   return *this;
00009 }
00010 
00011 ///////////////////////////////////////////////////////////////////////////////
00012 ///////////////////////////////////////////////////////////////////////////////
00013 ///////////////////////////////////////////////////////////////////////////////
00014 
00015 //=============================================================================
00016 /*! zrovector+=zrovector operator */
00017 inline zrovector& zrovector::operator+=(const zrovector& vec)
00018 {VERBOSE_REPORT;
00019 #ifdef  CPPL_DEBUG
00020   if( l!=vec.l ){
00021     ERROR_REPORT;
00022     std::cerr << "These two vectors can not make a sumation." << std::endl
00023               << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl;
00024     exit(1);
00025   }
00026 #endif//CPPL_DEBUG
00027   
00028   for(long i=0; i<l; i++){ array[i]+=vec.array[i]; }
00029   
00030   return *this;
00031 }
00032 
00033 //=============================================================================
00034 /*! zrovector operator-= */
00035 inline zrovector& zrovector::operator-=(const zrovector& vec)
00036 {VERBOSE_REPORT;
00037 #ifdef  CPPL_DEBUG
00038   if( l!=vec.l ){
00039     ERROR_REPORT;
00040     std::cerr << "These two vectors can not make a subtraction." << std::endl
00041               << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl;
00042     exit(1);
00043   }
00044 #endif//CPPL_DEBUG
00045   
00046   for(long i=0; i<l; i++){ array[i]-=vec.array[i]; }
00047   
00048   return *this;
00049 }
00050 
00051 ///////////////////////////////////////////////////////////////////////////////
00052 ///////////////////////////////////////////////////////////////////////////////
00053 ///////////////////////////////////////////////////////////////////////////////
00054 
00055 //=============================================================================
00056 /*! zrovector+zrovector operator */
00057 inline _zrovector operator+(const zrovector& vecA, const zrovector& vecB)
00058 {VERBOSE_REPORT;
00059 #ifdef  CPPL_DEBUG
00060   if(vecA.l!=vecB.l){
00061     ERROR_REPORT;
00062     std::cerr << "These two vectors can not make a sumation." << std::endl
00063               << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl;
00064     exit(1);
00065   }
00066   
00067 #endif//CPPL_DEBUG
00068   
00069   zrovector newvec(vecA.l);
00070   for(long i=0; i<newvec.l; i++){
00071     newvec.array[i] =vecA.array[i]+vecB.array[i];
00072   }
00073   
00074   return _(newvec);
00075 }
00076 
00077 //=============================================================================
00078 /*! zrovector-zrovector operator */
00079 inline _zrovector operator-(const zrovector& vecA, const zrovector& vecB)
00080 {VERBOSE_REPORT;
00081 #ifdef  CPPL_DEBUG
00082   if(vecA.l!=vecB.l){
00083     ERROR_REPORT;
00084     std::cerr << "These two vectors can not make a subtraction." << std::endl
00085               << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
00086     exit(1);
00087   }
00088 #endif//CPPL_DEBUG
00089   
00090   zrovector newvec(vecA.l);
00091   for(long i=0; i<newvec.l; i++){
00092     newvec.array[i] =vecA.array[i]-vecB.array[i];
00093   }
00094   
00095   return _(newvec);
00096 }
00097 
00098 //=============================================================================
00099 /*! zrovector^T*zrovector operator (inner product) */
00100 inline comple operator%(const zrovector& vecA, const zrovector& vecB)
00101 {VERBOSE_REPORT;
00102 #ifdef  CPPL_DEBUG
00103   if(vecA.l!=vecB.l){
00104     ERROR_REPORT;
00105     std::cerr << "These two vectors can not make a dot product." << std::endl
00106               << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
00107     exit(1);
00108   }
00109 #endif//CPPL_DEBUG
00110   
00111   comple val( zdotu_( vecA.l, vecA.array, 1, vecB.array, 1 ) );  
00112   return val;
00113 }
 All Classes Files Functions Variables Friends