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   shallow_copy(vec);
00006   return *this;
00007 }
00008 
00009 ///////////////////////////////////////////////////////////////////////////////
00010 ///////////////////////////////////////////////////////////////////////////////
00011 ///////////////////////////////////////////////////////////////////////////////
00012 
00013 //=============================================================================
00014 /*! zrovector+=_zrovector operator */
00015 inline zrovector& zrovector::operator+=(const _zrovector& vec)
00016 {VERBOSE_REPORT;
00017 #ifdef  CPPL_DEBUG
00018   if( l!=vec.l ){
00019     ERROR_REPORT;
00020     std::cerr << "These two vectors can not make a sumation." << std::endl
00021               << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl;
00022     exit(1);
00023   }
00024 #endif//CPPL_DEBUG
00025   
00026   for(long i=0; i<l; i++){ array[i]+=vec.array[i]; }
00027   
00028   vec.destroy();
00029   return *this;
00030 }
00031 
00032 //=============================================================================
00033 /*! zrovector operator-= */
00034 inline zrovector& zrovector::operator-=(const _zrovector& vec)
00035 {VERBOSE_REPORT;
00036 #ifdef  CPPL_DEBUG
00037   if( l!=vec.l ){
00038     ERROR_REPORT;
00039     std::cerr << "These two vectors can not make a subtraction." << std::endl
00040               << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl;
00041     exit(1);
00042   }
00043 #endif//CPPL_DEBUG
00044   
00045   for(long i=0; i<l; i++){ array[i]-=vec.array[i]; }
00046   
00047   vec.destroy();
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   for(long i=0; i<vecA.l; i++){ vecB.array[i]+=vecA.array[i]; }
00070   
00071   return vecB;
00072 }
00073 
00074 //=============================================================================
00075 /*! zrovector-zrovector operator */
00076 inline _zrovector operator-(const zrovector& vecA, const _zrovector& vecB)
00077 {VERBOSE_REPORT;
00078 #ifdef  CPPL_DEBUG
00079   if(vecA.l!=vecB.l){
00080     ERROR_REPORT;
00081     std::cerr << "These two vectors can not make a subtraction." << std::endl
00082               << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl;
00083     exit(1);
00084   }
00085 #endif//CPPL_DEBUG
00086   
00087   for(long i=0; i<vecA.l; i++){
00088     vecB.array[i] =vecA.array[i]-vecB.array[i];
00089   }
00090   
00091   return vecB;
00092 }
00093 
00094 //=============================================================================
00095 /*! zrovector^T*zrovector operator (inner product) */
00096 inline comple operator%(const zrovector& vecA, const _zrovector& vecB)
00097 {VERBOSE_REPORT;
00098 #ifdef  CPPL_DEBUG
00099   if(vecA.l!=vecB.l){
00100     ERROR_REPORT;
00101     std::cerr << "These two vectors can not make a dot product." << std::endl
00102               << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl;
00103     exit(1);
00104   }
00105 #endif//CPPL_DEBUG
00106   
00107   comple val( zdotu_( vecA.l, vecA.array, 1, vecB.array, 1 ) );
00108   
00109   vecB.destroy();
00110   return val;
00111 }
 All Classes Files Functions Variables Friends